build.gradle 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. maven {
  12. url 'https://jitpack.io'
  13. }
  14. }
  15. dependencies {
  16. //to change the versions see the gradle.properties file
  17. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  18. mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
  19. modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
  20. //Fabric API is only required for Cloth Config (required for CompleteConfig) which includes old version (1.16) and crashes
  21. //TODO: Update CompleteConfig and remove Fabric API dependency
  22. modImplementation "net.fabricmc.fabric-api:fabric-api:0.18.0+build.397-1.16"
  23. modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"
  24. modApi "com.gitlab.Lortseam:completeconfig:${project.completeconfig_version}"
  25. include "com.gitlab.Lortseam:completeconfig:${project.completeconfig_version}"
  26. include "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
  27. compileOnly "org.projectlombok:lombok:${project.lombok_version}"
  28. annotationProcessor "org.projectlombok:lombok:${project.lombok_version}"
  29. }
  30. processResources {
  31. inputs.property "version", project.version
  32. from(sourceSets.main.resources.srcDirs) {
  33. include "fabric.mod.json"
  34. expand "version": project.version
  35. }
  36. from(sourceSets.main.resources.srcDirs) {
  37. exclude "fabric.mod.json"
  38. }
  39. }
  40. // ensure that the encoding is set to UTF-8, no matter what the system default is
  41. // this fixes some edge cases with special characters not displaying correctly
  42. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  43. tasks.withType(JavaCompile) {
  44. options.encoding = "UTF-8"
  45. }
  46. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  47. // if it is present.
  48. // If you remove this task, sources will not be generated.
  49. task sourcesJar(type: Jar, dependsOn: classes) {
  50. classifier = "sources"
  51. from sourceSets.main.allSource
  52. }
  53. jar {
  54. from "LICENSE"
  55. }
  56. // configure the maven publication
  57. publishing {
  58. publications {
  59. mavenJava(MavenPublication) {
  60. // add all the jars that should be included when publishing to maven
  61. artifact(remapJar) {
  62. builtBy remapJar
  63. }
  64. artifact(sourcesJar) {
  65. builtBy remapSourcesJar
  66. }
  67. }
  68. }
  69. }