build.gradle 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. plugins {
  2. id 'fabric-loom' version '0.5-SNAPSHOT'
  3. id 'maven-publish'
  4. }
  5. sourceCompatibility = JavaVersion.VERSION_1_8
  6. targetCompatibility = JavaVersion.VERSION_1_8
  7. archivesBaseName = project.archives_base_name
  8. version = project.mod_version
  9. group = project.maven_group
  10. dependencies {
  11. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  12. mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
  13. modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
  14. //Fabric API is only required for Cloth Config which includes old version and crashes
  15. //TODO: Update Cloth Config and remove Fabric API dependency
  16. modImplementation "net.fabricmc.fabric-api:fabric-api:0.19.0+build.398-1.16"
  17. modImplementation "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
  18. compileOnly "org.projectlombok:lombok:${project.lombok_version}"
  19. annotationProcessor "org.projectlombok:lombok:${project.lombok_version}"
  20. }
  21. processResources {
  22. inputs.property "version", project.version
  23. filesMatching("fabric.mod.json") {
  24. expand "version": project.version
  25. }
  26. }
  27. tasks.withType(JavaCompile).configureEach {
  28. // ensure that the encoding is set to UTF-8, no matter what the system default is
  29. // this fixes some edge cases with special characters not displaying correctly
  30. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  31. // If Javadoc is generated, this must be specified in that task too.
  32. it.options.encoding = "UTF-8"
  33. }
  34. java {
  35. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  36. // if it is present.
  37. // If you remove this line, sources will not be generated.
  38. withSourcesJar()
  39. }
  40. jar {
  41. from("LICENSE") {
  42. rename { "${it}_${project.archivesBaseName}"}
  43. }
  44. }
  45. javadoc {
  46. options {
  47. source = "8"
  48. encoding = "UTF-8"
  49. charSet = "UTF-8"
  50. memberLevel = JavadocMemberLevel.PROTECTED
  51. // Disable the crazy super-strict doclint tool in Java 8
  52. addStringOption("Xdoclint:none", "-quiet")
  53. }
  54. source = sourceSets.main.allJava
  55. failOnError false
  56. }
  57. task javadocJar(type: Jar) {
  58. dependsOn javadoc
  59. from javadoc.destinationDir
  60. archiveClassifier = "javadoc"
  61. }
  62. build.dependsOn javadocJar
  63. // configure the maven publication
  64. publishing {
  65. publications {
  66. mavenJava(MavenPublication) {
  67. // add all the jars that should be included when publishing to maven
  68. artifact(remapJar) {
  69. builtBy remapJar
  70. }
  71. artifact(sourcesJar) {
  72. builtBy remapSourcesJar
  73. }
  74. artifact javadocJar
  75. }
  76. }
  77. // select the repositories you want to publish to
  78. repositories {
  79. // uncomment to publish to the local maven
  80. // mavenLocal()
  81. }
  82. }