build.gradle 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. repositories {
  11. jcenter()
  12. }
  13. dependencies {
  14. minecraft("com.mojang:minecraft:${project.minecraft_version}")
  15. mappings("net.fabricmc:yarn:${project.yarn_mappings}:v2")
  16. modImplementation("net.fabricmc:fabric-loader:${project.loader_version}")
  17. modApi("me.shedaniel.cloth:config-2:${project.cloth_config_version}") {
  18. exclude(group: "net.fabricmc.fabric-api")
  19. }
  20. // Using modImplementation because implementation does not include dependency inside Maven pom file (see https://github.com/FabricMC/fabric-loom/issues/200)
  21. modImplementation("org.spongepowered:configurate-hocon:${project.configurate_version}")
  22. compileOnly("org.projectlombok:lombok:${project.lombok_version}")
  23. annotationProcessor("org.projectlombok:lombok:${project.lombok_version}")
  24. }
  25. processResources {
  26. inputs.property "version", project.version
  27. filesMatching("fabric.mod.json") {
  28. expand "version": project.version
  29. }
  30. }
  31. tasks.withType(JavaCompile).configureEach {
  32. // ensure that the encoding is set to UTF-8, no matter what the system default is
  33. // this fixes some edge cases with special characters not displaying correctly
  34. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  35. it.options.encoding = "UTF-8"
  36. }
  37. java {
  38. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  39. // if it is present.
  40. withSourcesJar()
  41. }
  42. jar {
  43. from "LICENSE"
  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. artifact(remapJar) {
  68. builtBy remapJar
  69. }
  70. artifact(sourcesJar) {
  71. builtBy remapSourcesJar
  72. }
  73. artifact javadocJar
  74. }
  75. }
  76. }