build.gradle 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. it.options.encoding = "UTF-8"
  32. }
  33. java {
  34. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  35. // if it is present.
  36. withSourcesJar()
  37. }
  38. jar {
  39. from "LICENSE"
  40. }
  41. javadoc {
  42. options {
  43. source = "8"
  44. encoding = "UTF-8"
  45. charSet = "UTF-8"
  46. memberLevel = JavadocMemberLevel.PROTECTED
  47. // Disable the crazy super-strict doclint tool in Java 8
  48. addStringOption("Xdoclint:none", "-quiet")
  49. }
  50. source = sourceSets.main.allJava
  51. failOnError false
  52. }
  53. task javadocJar(type: Jar) {
  54. dependsOn javadoc
  55. from javadoc.destinationDir
  56. archiveClassifier = "javadoc"
  57. }
  58. build.dependsOn javadocJar
  59. // configure the maven publication
  60. publishing {
  61. publications {
  62. mavenJava(MavenPublication) {
  63. artifact(remapJar) {
  64. builtBy remapJar
  65. }
  66. artifact(sourcesJar) {
  67. builtBy remapSourcesJar
  68. }
  69. artifact javadocJar
  70. }
  71. }
  72. }