build.gradle 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. javadocs.failOnError false
  53. from javadocs.destinationDir
  54. }
  55. // configure the maven publication
  56. publishing {
  57. publications {
  58. mavenJava(MavenPublication) {
  59. // add all the jars that should be included when publishing to maven
  60. artifact(remapJar) {
  61. builtBy remapJar
  62. }
  63. artifact(sourcesJar) {
  64. builtBy remapSourcesJar
  65. }
  66. artifact javadocsJar
  67. }
  68. }
  69. // select the repositories you want to publish to
  70. repositories {
  71. // uncomment to publish to the local maven
  72. // mavenLocal()
  73. }
  74. }