build.gradle 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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/tf_at.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. // Recommended logging data for a userdev environment
  54. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  55. // Recommended logging level for the console
  56. property 'forge.logging.console.level', 'debug'
  57. mods {
  58. twilightforest {
  59. source sourceSets.main
  60. }
  61. }
  62. }
  63. server {
  64. workingDirectory project.file('run')
  65. // Recommended logging data for a userdev environment
  66. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  67. // Recommended logging level for the console
  68. property 'forge.logging.console.level', 'debug'
  69. mods {
  70. twilightforest {
  71. source sourceSets.main
  72. }
  73. }
  74. }
  75. }
  76. }
  77. /*
  78. processResources {
  79. //replaceIn 'assets/twilightforest/patchouli_books/guide/book.json'
  80. //replace '@EDITION@', project.version
  81. // this will ensure that this task is redone when the versions change.
  82. inputs.property "version", project.version
  83. inputs.property "mcversion", project.minecraft.version
  84. // replace stuff in mcmod.info, nothing else
  85. from(sourceSets.main.resources.srcDirs) {
  86. //include '.info'
  87. //include '.properties'
  88. include 'assets/twilightforest/patchouli_books/guide/book.json'
  89. // replace version and mcversion
  90. expand ([
  91. 'version':project.version,
  92. 'mcversion':project.minecraft.version,
  93. 'forge_version': config.forge_version,
  94. 'mod_version': config.mod_version,
  95. 'minecraft_version': config.minecraft_version,
  96. 'edition': (project.version - (config.mod_version + '.')),
  97. 's': '$'
  98. ])
  99. }
  100. // copy everything else, thats not the mcmod.info
  101. from(sourceSets.main.resources.srcDirs) {
  102. exclude 'mcmod.info'
  103. exclude 'assets/twilightforest/patchouli_books/guide/book.json'
  104. }
  105. }*/
  106. compileJava {
  107. options.encoding = 'UTF-8'
  108. }
  109. jar {
  110. classifier = 'universal'
  111. }
  112. repositories {
  113. maven {
  114. name 'progwm\'s Maven' // JEI + Mantle + TCon
  115. url 'https://dvs1.progwml6.com/files/maven'
  116. }
  117. /*maven {
  118. name 'tterrag\'s Maven' // CTM
  119. url 'https://maven.tterrag.com/'
  120. }
  121. maven {
  122. name 'Jared\'s Maven' // Immersive Engineering + Patchouli
  123. url 'https://blamejared.com/maven'
  124. }
  125. maven {
  126. name 'player\'s Maven' // Forestry
  127. url 'http://maven.ic2.player.to/'
  128. }
  129. maven {
  130. name 'Curseforge Maven' // Baubles + Thaumcraft
  131. url 'https://minecraft.curseforge.com/api/maven/'
  132. }*/
  133. }
  134. dependencies {
  135. // progwml6
  136. runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
  137. /*deobfCompile "slimeknights.mantle:Mantle:${minecraft_sub_version}-${mantle_version}"
  138. deobfCompile "slimeknights:TConstruct:${minecraft_version}-${tcon_version}"
  139. // tterrag
  140. deobfCompile "team.chisel.ctm:CTM:MC${minecraft_version}-${ctm_version}"
  141. deobfCompile "team.chisel:Chisel:MC${minecraft_version}-${chisel_version}"
  142. // blamejared
  143. deobfCompile "blusunrize:ImmersiveEngineering:${immersive_engineering_version}"
  144. deobfCompile "vazkii.patchouli:Patchouli:${patchouli_version}"
  145. // player
  146. deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:${forestry_version}"
  147. // curseforge
  148. deobfCompile "baubles:Baubles:${minecraft_sub_version}:${baubles_version}"
  149. deobfCompile "thaumcraft:Thaumcraft:${minecraft_version}:${thaumcraft_version}"*/
  150. minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
  151. }
  152. task createPom {
  153. doLast {
  154. pom {
  155. project {
  156. groupId project.group
  157. artifactId project.archivesBaseName
  158. version project.version
  159. inceptionYear '2012'
  160. licenses {
  161. license {
  162. name 'LGPL 2.1'
  163. url 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html'
  164. distribution 'repo'
  165. }
  166. }
  167. }
  168. }.writeTo(libsDir.path + "/" + project.archivesBaseName + "-" + project.version + ".pom")
  169. }
  170. }
  171. build.dependsOn createPom