build.gradle 3.4 KB

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