build.gradle 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. plugins {
  2. id "com.github.johnrengelman.shadow" version "7.1.2"
  3. id "com.matthewprenger.cursegradle"
  4. }
  5. loom {
  6. accessWidener = file("src/main/resources/architectury.accessWidener")
  7. }
  8. architectury {
  9. platformSetupLoomIde()
  10. fabric()
  11. }
  12. configurations {
  13. common
  14. shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
  15. compileClasspath.extendsFrom common
  16. runtimeClasspath.extendsFrom common
  17. developmentFabric.extendsFrom common
  18. }
  19. repositories {
  20. maven { url "https://maven.terraformersmc.com/releases/" }
  21. }
  22. dependencies {
  23. modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
  24. modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
  25. modCompileOnly "com.terraformersmc:modmenu:${rootProject.mod_menu_version}"
  26. implementation "net.jodah:typetools:0.6.2"
  27. shadowCommon "net.jodah:typetools:0.6.2"
  28. common(project(path: ":common", configuration: "namedElements")) { transitive false }
  29. shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
  30. }
  31. processResources {
  32. filesMatching("fabric.mod.json") {
  33. expand "version": project.version
  34. }
  35. inputs.property "version", project.version
  36. }
  37. shadowJar {
  38. exclude "architectury-common.accessWidener"
  39. exclude "architectury.common.json"
  40. relocate "net.jodah.typetools", "me.shedaniel.architectury.shadowed.impl.net.jodah.typetools"
  41. configurations = [project.configurations.shadowCommon]
  42. classifier "dev-shadow"
  43. }
  44. remapJar {
  45. input.set shadowJar.archiveFile
  46. dependsOn shadowJar
  47. classifier null
  48. }
  49. jar {
  50. classifier "dev"
  51. }
  52. sourcesJar {
  53. afterEvaluate {
  54. [":common"].forEach {
  55. def depSources = project(it).sourcesJar
  56. dependsOn depSources
  57. from(depSources.archiveFile.map { zipTree(it) }) {
  58. exclude "architectury.accessWidener"
  59. }
  60. }
  61. }
  62. }
  63. components.java {
  64. withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
  65. skip()
  66. }
  67. }
  68. publishing {
  69. publications {
  70. mavenFabric(MavenPublication) {
  71. artifactId = rootProject.archivesBaseName + "-fabric"
  72. from components.java
  73. }
  74. }
  75. repositories {
  76. if (System.getenv("MAVEN_PASS") != null) {
  77. maven {
  78. url = "https://deploy.shedaniel.me/"
  79. credentials {
  80. username = "shedaniel"
  81. password = System.getenv("MAVEN_PASS")
  82. }
  83. }
  84. }
  85. }
  86. }
  87. curseforge {
  88. if (project.hasProperty("CURSE_API_KEY") || System.getenv("CURSE_API_KEY") != null) {
  89. apiKey = project.hasProperty("CURSE_API_KEY") ? project.property("CURSE_API_KEY") : System.getenv("CURSE_API_KEY")
  90. project {
  91. id = "419699"
  92. releaseType = "release"
  93. changelogType = "html"
  94. changelog = releaseChangelog()
  95. addGameVersion "1.16-Snapshot"
  96. addGameVersion "1.16.4"
  97. addGameVersion "1.16.5"
  98. addGameVersion "Java 8"
  99. addGameVersion "Fabric"
  100. relations {
  101. requiredDependency "fabric-api"
  102. }
  103. mainArtifact(remapJar.archivePath) {
  104. displayName = "[Fabric $rootProject.supported_version] v$project.version"
  105. }
  106. afterEvaluate {
  107. uploadTask.dependsOn("build")
  108. }
  109. }
  110. }
  111. options {
  112. forgeGradleIntegration = false
  113. javaVersionAutoDetect = false
  114. }
  115. }
  116. rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge")