Advertisement
Guest User

Untitled

a guest
Dec 6th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. buildscript {
  2. repositories {
  3. mavenCentral()
  4. maven { url = "http://files.minecraftforge.net/maven" }
  5. maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
  6. }
  7. dependencies {
  8. classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
  9. classpath 'org.ajoberstar:gradle-git:0.10.1'
  10. }
  11. }
  12.  
  13. apply plugin: 'forge'
  14.  
  15. ext.configFile = file "build.properties"
  16. configFile.withReader {
  17. def prop = new Properties()
  18. prop.load(it)
  19. project.ext.config = new ConfigSlurper().parse prop
  20. }
  21.  
  22. version = config.mc_version + "-" + config.mod_version + "-" + config.build_number
  23. group= config.package_group
  24. archivesBaseName = config.mod_name
  25.  
  26. import org.ajoberstar.grgit.Grgit
  27.  
  28. def gitHash = 'unknown'
  29. if (new File(projectDir, '.git').exists()) {
  30. def repo = Grgit.open(project.file('.'))
  31. gitHash = repo.log().find().abbreviatedId
  32. }
  33.  
  34. minecraft {
  35. version = config.mc_version + "-" + config.forge_version
  36. runDir = "run"
  37.  
  38. if (project.hasProperty('mappings_version'))
  39. mappings = project.mappings_version
  40. }
  41.  
  42. repositories {
  43. ivy {
  44. name "CoFHLib"
  45. artifactPattern "http://addons.cursecdn.com/files/2218/257/[module]-[revision].[ext]"
  46. }
  47. ivy {
  48. name "CoFHCore"
  49. artifactPattern "http://addons.cursecdn.com/files/2218/330/[module]-[revision].[ext]"
  50. }
  51. ivy {
  52. name "ThermalExpansion"
  53. artifactPattern "http://addons.curse.cursecdn.com/files/2218/263/[module]-[revision].[ext]"
  54. }
  55. ivy {
  56. name "ThermalFoundation"
  57. artifactPattern "http://addons.curse.cursecdn.com/files/2212/444/[module]-[revision].[ext]"
  58. }
  59. }
  60.  
  61. dependencies {
  62. compile name: 'CoFHLib', version: "${cofhlib_version}", ext: 'jar'
  63. compile name: 'CoFHCore', version: "${cofhcore_version}", ext: 'jar'
  64. compile name: 'ThermalExpansion', version: "${texpansion_version}", ext: 'jar'
  65. compile name: 'ThermalFoundation', version: "${tfoundation_version}", ext: 'jar'
  66. }
  67.  
  68. processResources {
  69. inputs.property "version", project.version
  70. inputs.property "mcversion", project.minecraft.version
  71.  
  72. from(sourceSets.main.resources.srcDirs) {
  73. include '**/*.info'
  74. include '**/*.properties'
  75.  
  76. expand 'version': project.version, 'mcversion': project.minecraft.version
  77. }
  78. from(sourceSets.main.resources.srcDirs) {
  79. exclude '**/*.info'
  80. exclude '**/*.properties'
  81. exclude '**/*.db'
  82. }
  83. }
  84.  
  85. jar {
  86. dependsOn "incrementBuildNumber"
  87. classifier = 'universal'
  88. manifest.mainAttributes(
  89. "Built-By": System.getProperty('user.name'),
  90. "Created-By": "${System.getProperty('java.vm.version')} + (${System.getProperty('java.vm.vendor')})",
  91. "Implementation-Title": project.name,
  92. "Implementation-Version": project.version,
  93. "Git-Hash": gitHash
  94. )
  95. }
  96.  
  97. // add a source jar
  98. task sourceJar(type: Jar) {
  99. from sourceSets.main.allSource
  100. classifier = 'sources'
  101. }
  102.  
  103. // add a javadoc jar
  104. task javadocJar(type: Jar, dependsOn: javadoc) {
  105. from javadoc.destinationDir
  106. classifier = 'javadoc'
  107. }
  108.  
  109. // because the normal output has been made to be obfuscated
  110. task deobfJar(type: Jar) {
  111. from sourceSets.main.output
  112. classifier = 'deobf'
  113. }
  114.  
  115. tasks.build.dependsOn sourceJar, javadocJar, deobfJar
  116.  
  117. tasks.withType(JavaCompile) { task ->
  118. task.options.encoding = 'UTF-8'
  119. }
  120.  
  121. task("incrementBuildNumber") {
  122. // increment build number
  123. doFirst {
  124. // increment
  125. config.build_number = (config.build_number.toString().toInteger()) + 1
  126.  
  127. // write back to the file
  128. configFile.withWriter {
  129. config.toProperties().store(it, "")
  130. }
  131. }
  132. }
  133.  
  134. // Uncomment this line if you want to auto-upload to CurseForge when you build. This requires you to setup curse.gradle yourself.
  135. // fileTree('gradle').include('curse.gradle').collect().sort().each { apply from: it }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement