build.gradle 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. plugins {
  2. id 'java-library'
  3. id 'eclipse'
  4. id 'idea'
  5. id 'maven-publish'
  6. id 'net.neoforged.gradle.userdev' version '7.0.142'
  7. }
  8. def secrets = new Properties()
  9. def secretsFile = file('secrets.properties')
  10. if (secretsFile.exists()) {
  11. secretsFile.withInputStream {
  12. stream -> secrets.load(stream)
  13. }
  14. fileTree("secrets").matching {
  15. include "**/*.properties"
  16. }.each {
  17. File file ->
  18. file.withInputStream {
  19. stream -> secrets.load(stream)
  20. }
  21. }
  22. }
  23. idea {
  24. // Tell IDEA to always download sources/javadoc artifacts from maven.
  25. module {
  26. downloadJavadoc = true
  27. downloadSources = true
  28. }
  29. }
  30. jarJar.enable()
  31. version = (hasProperty("CIRevision") ? CIRevision : project.mod_version)
  32. group = group_name
  33. java {
  34. toolchain {
  35. languageVersion.set(JavaLanguageVersion.of(21))
  36. }
  37. }
  38. compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation,-this-escape" << "-Werror"
  39. base {
  40. archivesName = "${project.mod_id}-${project.minecraft_version}"
  41. }
  42. subprojects {
  43. version = project(":").version
  44. group = project(":").group
  45. }
  46. minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
  47. runs {
  48. configureEach {
  49. workingDirectory project.file('run')
  50. systemProperty 'forge.logging.console.level', 'debug'
  51. systemProperty 'fml.earlyprogresswindow', 'false'
  52. systemProperty 'mixin.env.disableRefMap', 'true'
  53. modSource project.sourceSets.main
  54. dependencies {
  55. runtime project(":tf-asm")
  56. }
  57. }
  58. client {
  59. systemProperty 'forge.enabledGameTestNamespaces', mod_id
  60. programArguments.addAll '--username', secrets.getProperty("username") ?: 'Dev', secrets.getProperty("uuid") ? '--uuid' : '', secrets.getProperty("uuid") ?: ''
  61. }
  62. server {
  63. systemProperty 'forge.enabledGameTestNamespaces', mod_id
  64. programArgument '--nogui'
  65. }
  66. gameTestServer {
  67. systemProperty 'forge.enabledGameTestNamespaces', mod_id
  68. }
  69. data {
  70. workingDirectory project.file('run-data')
  71. programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
  72. }
  73. }
  74. jar {
  75. exclude 'data/twilightforest/functions/**'
  76. }
  77. sourceSets.main.resources { srcDir 'src/generated/resources' }
  78. repositories {
  79. mavenLocal()
  80. maven {
  81. name 'Jared\'s Maven' // JEI
  82. url 'https://maven.blamejared.com/'
  83. }
  84. maven {
  85. name 'tterrag\'s Maven' // CTM
  86. url 'https://maven.tterrag.com/'
  87. }
  88. maven {
  89. name 'theillusivec4\'s Maven' // Curios
  90. url 'https://maven.theillusivec4.top/'
  91. }
  92. maven {
  93. name 'Tama\'s Maven' // Cross-Dim Commands
  94. url "https://maven.tamaized.com/releases"
  95. }
  96. maven {
  97. name 'Shedaniel\'s Maven' //REI
  98. url "https://maven.shedaniel.me"
  99. }
  100. maven {
  101. name = "TerraformersMC" //EMI
  102. url = "https://maven.terraformersmc.com/"
  103. }
  104. maven { // TOP
  105. url "https://maven.k-4u.nl"
  106. }
  107. maven {
  108. name 'Curseforge Maven' // Jade
  109. url "https://www.cursemaven.com"
  110. content {
  111. includeGroup "curse.maven"
  112. }
  113. }
  114. }
  115. dependencies {
  116. //minecraft
  117. implementation "net.neoforged:neoforge:${project.neo_version}"
  118. jarJar project(":tf-asm")
  119. //make sure to only pick one of these when testing (switch others to compileOnly)
  120. // compileOnly "mezz.jei:jei-${project.minecraft_version}-neoforge:${project.jei_version}"
  121. compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:${project.rei_version}"
  122. implementation "dev.emi:emi-neoforge:${project.emi_version}+${project.minecraft_version}"
  123. // theillusivec4
  124. implementation "top.theillusivec4.curios:curios-neoforge:${project.curios_version}+${project.minecraft_version}"
  125. //curse maven
  126. implementation "curse.maven:jade-324717:5366595"
  127. // runtimeOnly "curse.maven:jeed-532286:4599236"
  128. // runtimeOnly "curse.maven:museum-curator-859070:4629894"
  129. implementation "mcjty.theoneprobe:theoneprobe:${project.top_version}"
  130. //mods we dont have compat with but are nice to have
  131. // runtimeOnly "team-twilight:crossdimcommands:${project.base_minecraft_version}-1.0"
  132. }
  133. tasks.named('jar', Jar).configure {
  134. manifest {
  135. archiveClassifier = 'slim'
  136. attributes([
  137. 'Specification-Title' : mod_id,
  138. 'Specification-Vendor' : "TeamTwilight",
  139. 'Specification-Version' : "1",
  140. 'Implementation-Title' : project.name,
  141. 'Implementation-Version' : project.jar.archiveVersion,
  142. 'Implementation-Vendor' : "TeamTwilight",
  143. 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  144. ])
  145. }
  146. }
  147. tasks.named('jarJar') {
  148. archiveClassifier = 'universal'
  149. }
  150. publishing {
  151. publications {
  152. mavenJava(MavenPublication) {
  153. afterEvaluate {
  154. artifact source: project.tasks.jarJar.outputs.getFiles().getSingleFile(), classifier: 'universal'
  155. artifact project.sourceJar
  156. }
  157. setGroupId 'team-twilight'
  158. setArtifactId project.mod_id
  159. }
  160. }
  161. repositories {
  162. maven {
  163. //url "file:///${project.projectDir}/mcmodsrepo"
  164. url "https://maven.tamaized.com/releases"
  165. credentials {
  166. username System.getenv('ARTIFACTORY_USER')
  167. password System.getenv('ARTIFACTORY_PASS')
  168. }
  169. }
  170. }
  171. }
  172. tasks.register('sourceJar', Jar) {
  173. dependsOn 'classes'
  174. from sourceSets.main.allSource
  175. archiveClassifier = 'sources'
  176. }
  177. tasks.withType(JavaCompile).configureEach {
  178. options.encoding = 'UTF-8'
  179. }