build.gradle 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
  2. import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext
  3. import shadow.org.apache.tools.zip.ZipEntry
  4. import shadow.org.apache.tools.zip.ZipOutputStream
  5. import shadow.org.codehaus.plexus.util.IOUtil
  6. plugins {
  7. id "com.github.johnrengelman.shadow" version "5.0.0"
  8. id "com.matthewprenger.cursegradle"
  9. }
  10. loom {
  11. accessWidener = file("src/main/resources/architectury.accessWidener")
  12. }
  13. configurations {
  14. shadow
  15. dev
  16. }
  17. artifacts {
  18. dev(jar)
  19. }
  20. architectury {
  21. platformSetupLoomIde()
  22. }
  23. dependencies {
  24. minecraft "com.mojang:minecraft:${rootProject.architectury.minecraft}"
  25. mappings minecraft.officialMojangMappings()
  26. modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
  27. modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
  28. modCompileOnly "io.github.prospector:modmenu:${rootProject.mod_menu_version}"
  29. implementation "net.jodah:typetools:0.6.2"
  30. shadow "net.jodah:typetools:0.6.2"
  31. compileOnly(project(path: ":common")) {
  32. transitive = false
  33. }
  34. runtimeOnly(project(path: ":common", configuration: "transformDevelopmentFabric")) {
  35. transitive = false
  36. }
  37. shadow(project(path: ":common", configuration: "transformProductionFabric")) {
  38. transitive = false
  39. }
  40. }
  41. processResources {
  42. filesMatching("fabric.mod.json") {
  43. expand "version": project.version
  44. }
  45. inputs.property "version", project.version
  46. }
  47. shadowJar {
  48. relocate "net.jodah.typetools", "me.shedaniel.architectury.shadowed.impl.net.jodah.typetools"
  49. configurations = [project.configurations.shadow]
  50. classifier "shadow"
  51. }
  52. remapJar {
  53. dependsOn(shadowJar)
  54. input.set(shadowJar.archiveFile)
  55. archiveClassifier = "fabric"
  56. }
  57. publishing {
  58. publications {
  59. mavenFabric(MavenPublication) {
  60. artifact(remapJar.archivePath) {
  61. builtBy build
  62. classifier "fabric"
  63. }
  64. }
  65. }
  66. repositories {
  67. if (System.getenv("MAVEN_PASS") != null) {
  68. maven {
  69. url = "https://deploy.shedaniel.me/"
  70. credentials {
  71. username = "shedaniel"
  72. password = System.getenv("MAVEN_PASS")
  73. }
  74. }
  75. }
  76. }
  77. }
  78. curseforge {
  79. if (project.hasProperty("curse_api_key") || System.getenv("curse_api_key") != null) {
  80. apiKey = project.hasProperty("curse_api_key") ? project.property("curse_api_key") : System.getenv("curse_api_key")
  81. project {
  82. id = "419697"
  83. releaseType = "release"
  84. changelogType = "html"
  85. changelog = releaseChangelog()
  86. addGameVersion "1.16-Snapshot"
  87. addGameVersion "1.16.4"
  88. addGameVersion "1.16.5"
  89. addGameVersion "Java 8"
  90. addGameVersion "Fabric"
  91. relations {
  92. requiredDependency "fabric-api"
  93. }
  94. mainArtifact(remapJar.archivePath) {
  95. displayName = "[Fabric $rootProject.supported_version] v$project.version"
  96. }
  97. afterEvaluate {
  98. uploadTask.dependsOn("build")
  99. }
  100. }
  101. }
  102. options {
  103. forgeGradleIntegration = false
  104. javaVersionAutoDetect = false
  105. }
  106. }
  107. rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge")