build.gradle 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. modApi("me.shedaniel.cloth:config-2:${project.cloth_config_version}") {
  15. exclude(group: "net.fabricmc.fabric-api")
  16. }
  17. compileOnly "org.projectlombok:lombok:${project.lombok_version}"
  18. annotationProcessor "org.projectlombok:lombok:${project.lombok_version}"
  19. }
  20. processResources {
  21. inputs.property "version", project.version
  22. filesMatching("fabric.mod.json") {
  23. expand "version": project.version
  24. }
  25. }
  26. tasks.withType(JavaCompile).configureEach {
  27. // ensure that the encoding is set to UTF-8, no matter what the system default is
  28. // this fixes some edge cases with special characters not displaying correctly
  29. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  30. it.options.encoding = "UTF-8"
  31. }
  32. java {
  33. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  34. // if it is present.
  35. withSourcesJar()
  36. }
  37. jar {
  38. from "LICENSE"
  39. }
  40. javadoc {
  41. options {
  42. source = "8"
  43. encoding = "UTF-8"
  44. charSet = "UTF-8"
  45. memberLevel = JavadocMemberLevel.PROTECTED
  46. // Disable the crazy super-strict doclint tool in Java 8
  47. addStringOption("Xdoclint:none", "-quiet")
  48. }
  49. source = sourceSets.main.allJava
  50. failOnError false
  51. }
  52. task javadocJar(type: Jar) {
  53. dependsOn javadoc
  54. from javadoc.destinationDir
  55. archiveClassifier = "javadoc"
  56. }
  57. build.dependsOn javadocJar
  58. // configure the maven publication
  59. publishing {
  60. publications {
  61. mavenJava(MavenPublication) {
  62. artifact(remapJar) {
  63. builtBy remapJar
  64. }
  65. artifact(sourcesJar) {
  66. builtBy remapSourcesJar
  67. }
  68. artifact javadocJar
  69. }
  70. }
  71. }