Advertisement
Elrol

build.gradle

Apr 19th, 2021
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. buildscript {
  2. repositories {
  3. maven { url = 'https://files.minecraftforge.net/maven' }
  4. jcenter()
  5. mavenCentral()
  6. }
  7. dependencies {
  8. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.+', changing: true
  9. }
  10. }
  11. apply plugin: 'net.minecraftforge.gradle'
  12. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  13. apply plugin: 'eclipse'
  14. apply plugin: 'maven-publish'
  15.  
  16. sourceSets {
  17. api {
  18. java {
  19. srcDir 'src/api/java'
  20. }
  21. compileClasspath += configurations.getByName("minecraft")
  22. }
  23. main {
  24. java {
  25. srcDir 'src/main/java'
  26. }
  27. resources {
  28. srcDir 'src/main/resources'
  29. srcDir 'src/main/generated/resources'
  30. }
  31. compileClasspath += compileClasspath += sourceSets.api.output
  32. }
  33. }
  34.  
  35. version = modMinecraftVersion + "-" + modVersion
  36. group = modGroup
  37. archivesBaseName = modFileName
  38.  
  39. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  40.  
  41. println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
  42. minecraft {
  43. mappings channel: 'snapshot', version: modForgeMappings + '-' + modMinecraftVersion
  44. runs {
  45. client {
  46. workingDirectory project.file('run')
  47. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  48. property 'forge.logging.console.level', 'debug'
  49. property 'mixin.env.remapRefMap', 'true'
  50. property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
  51. mods {
  52. serverutilities {
  53. source sourceSets.main
  54. source sourceSets.api
  55. }
  56. }
  57. }
  58.  
  59. server {
  60. workingDirectory project.file('run')
  61.  
  62. // Recommended logging data for a userdev environment
  63. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  64.  
  65. // Recommended logging level for the console
  66. property 'forge.logging.console.level', 'debug'
  67. property 'mixin.env.remapRefMap', 'true'
  68. property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
  69. mods {
  70. serverutilities {
  71. source sourceSets.main
  72. source sourceSets.api
  73. }
  74. }
  75. }
  76.  
  77. data {
  78. workingDirectory project.file('run')
  79.  
  80. // Recommended logging data for a userdev environment
  81. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  82.  
  83. // Recommended logging level for the console
  84. property 'forge.logging.console.level', 'debug'
  85.  
  86. args '--mod', 'serverutilities', '--all', '--output', file('src/generated/resources/')
  87.  
  88. mods {
  89. serverutilities {
  90. source sourceSets.main
  91. source sourceSets.api
  92. }
  93. }
  94. }
  95. }
  96. }
  97.  
  98. repositories {
  99. flatDir name: 'libs', dirs: 'libs'
  100. }
  101.  
  102. dependencies {
  103. minecraft 'net.minecraftforge:forge:' + modMinecraftVersion + '-' + modForgeVersion
  104. compile fg.deobf('blank:architectury-1.8.131:forge')
  105. compile fg.deobf('blank:ftb-chunks-1605.2.3:build.75')
  106. compile fg.deobf('blank:ftb-gui-library-1605.2.1.41:forge')
  107. compile fg.deobf('blank:ftb-ranks:1604.1.1.11')
  108. compile fg.deobf('blank:ftb-teams-1604.1.0.15:forge')
  109. }
  110.  
  111. // Example for how to get properties into the manifest for reading by the runtime..
  112. jar {
  113. from sourceSets.api.output
  114. from sourceSets.main.output
  115.  
  116. manifest {
  117. attributes([
  118. "Specification-Title": "serverutilities",
  119. "Specification-Vendor": "serverutilities",
  120. "Specification-Version": "1", // We are version 1 of ourselves
  121. "Implementation-Title": project.name,
  122. "Implementation-Version": "${version}",
  123. "Implementation-Vendor" :"serverutilities",
  124. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  125. ])
  126. }
  127. }
  128.  
  129. // Example configuration to allow publishing using the maven-publish task
  130. // This is the preferred method to reobfuscate your jar file
  131. jar.finalizedBy('reobfJar')
  132. // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
  133. //publish.dependsOn('reobfJar')
  134.  
  135. publishing {
  136. publications {
  137. mavenJava(MavenPublication) {
  138. artifact jar
  139. }
  140. }
  141. repositories {
  142. maven {
  143. url "file:///${project.projectDir}/mcmodsrepo"
  144. }
  145. }
  146. }
  147.  
  148. task apiJar(type: Jar) {
  149. from sourceSets.api.output
  150. classifier 'api'
  151. }
  152.  
  153. reob {
  154. jar {}
  155. apiJar {}
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement