build.gradle 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. // define the properties file
  2. ext.configFile = file "gradle.properties"
  3. configFile.withReader {
  4. // read config. it shall from now on be referenced as simply config or as project.config
  5. def prop = new Properties()
  6. prop.load(it)
  7. project.ext.config = new ConfigSlurper().parse prop
  8. }
  9. // For those who want the bleeding edge
  10. buildscript {
  11. repositories {
  12. maven { url = 'https://files.minecraftforge.net/maven' }
  13. jcenter()
  14. mavenCentral()
  15. }
  16. dependencies {
  17. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  18. }
  19. }
  20. apply plugin: 'java'
  21. apply plugin: 'idea'
  22. apply plugin: 'net.minecraftforge.gradle'
  23. apply plugin: 'maven-publish'
  24. apply plugin: 'eclipse'
  25. ///////////////////////////////////////////////////
  26. // IDE Settings
  27. ///////////////////////////////////////////////////
  28. idea {
  29. project {
  30. languageLevel = '1.8'
  31. }
  32. }
  33. ///////////////////////////////////////////////////
  34. // ForgeGradle
  35. ///////////////////////////////////////////////////
  36. version = (hasProperty("CIRevision") ? CIRevision : config.mod_version)
  37. group = config.group_name
  38. archivesBaseName = "${config.mod_id}-${config.minecraft_version}"
  39. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  40. minecraft {
  41. mappings channel: "snapshot", version: config.mcp_mappings
  42. //version = config.minecraft_version + "-" + config.forge_version // grab latest forge
  43. //makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  44. accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  45. //replace '@mod_version@', version
  46. //replace '@mod_id@', config.mod_id
  47. //replace '@ci_build@', hasProperty("CIRevision") ? 'true' : 'false'
  48. //replaceIn 'TwilightForestMod.java'
  49. //replace '@VERSION@', project.version
  50. runs {
  51. client {
  52. workingDirectory project.file('run')
  53. property 'forge.logging.markers', 'REGISTRIES'
  54. property 'forge.logging.console.level', 'debug'
  55. property 'fml.earlyprogresswindow', 'false'
  56. mods {
  57. twilightforest {
  58. source sourceSets.main
  59. }
  60. }
  61. }
  62. server {
  63. workingDirectory project.file('run')
  64. // Recommended logging level for the console
  65. property 'forge.logging.console.level', 'debug'
  66. mods {
  67. twilightforest {
  68. source sourceSets.main
  69. }
  70. }
  71. }
  72. data {
  73. properties 'fml.earlyprogresswindow': 'false'
  74. workingDirectory project.file('run')
  75. mods {
  76. twilightforest {
  77. source sourceSets.main
  78. }
  79. }
  80. args '--mod', 'twilightforest', '--all',
  81. '--existing', '"' + file('src/main/resources/') + '"',
  82. '--existing', '"' + file('src/generated/resources/') + '"',
  83. '--output', '"' + file('src/generated/resources/') + '"'
  84. }
  85. }
  86. }
  87. sourceSets.main.resources {
  88. srcDir 'src/generated/resources'
  89. }
  90. /*
  91. processResources {
  92. //replaceIn 'assets/twilightforest/patchouli_books/guide/book.json'
  93. //replace '@EDITION@', project.version
  94. // this will ensure that this task is redone when the versions change.
  95. inputs.property "version", project.version
  96. inputs.property "mcversion", project.minecraft.version
  97. // replace stuff in mcmod.info, nothing else
  98. from(sourceSets.main.resources.srcDirs) {
  99. //include '.info'
  100. //include '.properties'
  101. include 'assets/twilightforest/patchouli_books/guide/book.json'
  102. // replace version and mcversion
  103. expand ([
  104. 'version':project.version,
  105. 'mcversion':project.minecraft.version,
  106. 'forge_version': config.forge_version,
  107. 'mod_version': config.mod_version,
  108. 'minecraft_version': config.minecraft_version,
  109. 'edition': (project.version - (config.mod_version + '.')),
  110. 's': '$'
  111. ])
  112. }
  113. // copy everything else, thats not the mcmod.info
  114. from(sourceSets.main.resources.srcDirs) {
  115. exclude 'mcmod.info'
  116. exclude 'assets/twilightforest/patchouli_books/guide/book.json'
  117. }
  118. }*/
  119. compileJava {
  120. options.encoding = 'UTF-8'
  121. }
  122. jar {
  123. classifier = 'universal'
  124. }
  125. repositories {
  126. maven {
  127. name 'progwm\'s Maven' // JEI + Mantle + TCon
  128. url 'https://dvs1.progwml6.com/files/maven'
  129. }
  130. maven {
  131. name 'tterrag\'s Maven' // CTM
  132. url 'https://maven.tterrag.com/'
  133. }
  134. /*maven {
  135. name 'Jared\'s Maven' // Immersive Engineering + Patchouli
  136. url 'https://blamejared.com/maven'
  137. }
  138. maven {
  139. name 'player\'s Maven' // Forestry
  140. url 'http://maven.ic2.player.to/'
  141. }
  142. maven {
  143. name 'Curseforge Maven' // Baubles + Thaumcraft
  144. url 'https://minecraft.curseforge.com/api/maven/'
  145. }*/
  146. }
  147. dependencies {
  148. // progwml6
  149. compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
  150. runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
  151. /*deobfCompile "slimeknights.mantle:Mantle:${minecraft_sub_version}-${mantle_version}"
  152. deobfCompile "slimeknights:TConstruct:${minecraft_version}-${tcon_version}"
  153. */
  154. // tterrag
  155. runtimeOnly fg.deobf("team.chisel.ctm:CTM:MC${minecraft_version}-${ctm_version}")
  156. // deobfCompile "team.chisel:Chisel:MC${minecraft_version}-${chisel_version}"
  157. /*
  158. // blamejared
  159. deobfCompile "blusunrize:ImmersiveEngineering:${immersive_engineering_version}"
  160. deobfCompile "vazkii.patchouli:Patchouli:${patchouli_version}"
  161. // player
  162. deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:${forestry_version}"
  163. // curseforge
  164. deobfCompile "baubles:Baubles:${minecraft_sub_version}:${baubles_version}"
  165. deobfCompile "thaumcraft:Thaumcraft:${minecraft_version}:${thaumcraft_version}"*/
  166. minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
  167. }
  168. /*task createPom {
  169. doLast {
  170. pom {
  171. project {
  172. groupId project.group
  173. artifactId project.archivesBaseName
  174. version project.version
  175. inceptionYear '2012'
  176. licenses {
  177. license {
  178. name 'LGPL 2.1'
  179. url 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html'
  180. distribution 'repo'
  181. }
  182. }
  183. }
  184. }.writeTo(libsDir.path + "/" + project.archivesBaseName + "-" + project.version + ".pom")
  185. }
  186. }
  187. build.dependsOn createPom*/