build.gradle 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. plugins {
  2. id 'fabric-loom' version '0.4-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. from(sourceSets.main.resources.srcDirs) {
  24. include "fabric.mod.json"
  25. expand "version": project.version
  26. }
  27. from(sourceSets.main.resources.srcDirs) {
  28. exclude "fabric.mod.json"
  29. }
  30. }
  31. // ensure that the encoding is set to UTF-8, no matter what the system default is
  32. // this fixes some edge cases with special characters not displaying correctly
  33. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  34. tasks.withType(JavaCompile) {
  35. options.encoding = "UTF-8"
  36. }
  37. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  38. // if it is present.
  39. // If you remove this task, sources will not be generated.
  40. task sourcesJar(type: Jar, dependsOn: classes) {
  41. classifier = "sources"
  42. from sourceSets.main.allSource
  43. }
  44. jar {
  45. from "LICENSE"
  46. }
  47. task javadocs(type: Javadoc) {
  48. source = sourceSets.main.allJava
  49. }
  50. task javadocsJar(type: Jar, dependsOn: javadocs) {
  51. classifier = "javadocs"
  52. from javadocs.destinationDir
  53. }
  54. // configure the maven publication
  55. publishing {
  56. publications {
  57. mavenJava(MavenPublication) {
  58. // add all the jars that should be included when publishing to maven
  59. artifact(remapJar) {
  60. builtBy remapJar
  61. }
  62. artifact(sourcesJar) {
  63. builtBy remapSourcesJar
  64. }
  65. artifact javadocsJar
  66. }
  67. }
  68. // select the repositories you want to publish to
  69. repositories {
  70. // uncomment to publish to the local maven
  71. // mavenLocal()
  72. }
  73. }