build.gradle 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 (1.16) and crashes
  15. //TODO: Update Cloth Config and remove Fabric API dependency
  16. modImplementation "net.fabricmc.fabric-api:fabric-api:0.18.0+build.397-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. // configure the maven publication
  48. publishing {
  49. publications {
  50. mavenJava(MavenPublication) {
  51. // add all the jars that should be included when publishing to maven
  52. artifact(remapJar) {
  53. builtBy remapJar
  54. }
  55. artifact(sourcesJar) {
  56. builtBy remapSourcesJar
  57. }
  58. }
  59. }
  60. // select the repositories you want to publish to
  61. repositories {
  62. // uncomment to publish to the local maven
  63. // mavenLocal()
  64. }
  65. }