Advertisement
Guest User

Untitled

a guest
Jan 5th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 8.31 KB | None | 0 0
  1. buildscript {
  2.     repositories {
  3.         jcenter()
  4.         maven { url "http://files.minecraftforge.net/maven" }
  5.         maven {
  6.             url "https://plugins.gradle.org/m2/"
  7.         }
  8.     }
  9.     dependencies {
  10.         classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
  11.     }
  12. }
  13. apply plugin: 'net.minecraftforge.gradle.forge'
  14. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  15. apply plugin: 'java'
  16.  
  17. version = "0.0.4"
  18. group = "io.github.lukas2005.lda" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  19. archivesBaseName = "lda"
  20.  
  21. def jxbrowser_version = "6.16"
  22.  
  23. compileJava.options.encoding = 'UTF-8'
  24. sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  25. compileJava {
  26.     sourceCompatibility = targetCompatibility = '1.8'
  27. }
  28.  
  29. repositories {
  30.     maven { url 'https://jitpack.io' }
  31.     maven { url 'http://repo.jenkins-ci.org/releases' }
  32. }
  33.  
  34. minecraft {
  35.     version = "1.12.2-14.23.1.2555"
  36.     runDir = "run"
  37.    
  38.     // the mappings can be changed at any time, and must be in the following format.
  39.     // snapshot_YYYYMMDD   snapshot are built nightly.
  40.     // stable_#            stables are built at the discretion of the MCP team.
  41.     // Use non-default mappings at your own risk. they may not always work.
  42.     // simply re-run your setup task after changing the mappings to update your workspace.
  43.     mappings = "snapshot_20171003"
  44.     // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  45. }
  46.  
  47. // Add "embedded" configuration
  48. configurations {
  49.     embed
  50.     compile.extendsFrom(embed)
  51. }
  52.  
  53. dependencies {
  54.     // you may put jars on which you depend on in ./libs
  55.     // or you may define them like so..
  56.     //compile "some.group:artifact:version:classifier"
  57.     //compile "some.group:artifact:version"
  58.      
  59.     embed ('com.google.apis:google-api-services-youtube:v3-rev186-1.23.0') {
  60.         exclude group: 'com.google.guava'
  61.     }
  62.  
  63.     embed files("lib/vorbisspi1.0.3.jar")
  64.     embed files("lib/tritonus_share.jar")
  65.     embed files("lib/jorbis-0.0.15.jar")
  66.     embed files("lib/jogg-0.0.7.jar")
  67.    
  68.     embed files("lib/jxbrowser/licence.jar")
  69.     embed files("lib/jxbrowser/lib/jxbrowser-"+jxbrowser_version+".jar")
  70.  
  71.     compile files("lib/jxbrowser/lib/jxbrowser-linux64-"+jxbrowser_version+".jar")
  72.     compile files("lib/jxbrowser/lib/jxbrowser-mac-"+jxbrowser_version+".jar")
  73.     compile files("lib/jxbrowser/lib/jxbrowser-win32-"+jxbrowser_version+".jar")
  74.    
  75.     embed files("lib/javassist.jar")
  76.  
  77.     deobfCompile 'com.github.MrCrayfish:MrCrayfishDeviceMod:c2a4b9b85a'
  78.  
  79.     // https://mvnrepository.com/artifact/org.apache.openjpa/openjpa
  80.     compile group: 'org.apache.openjpa', name: 'openjpa', version: '2.4.2'
  81.     // https://mvnrepository.com/artifact/org.kohsuke/github-api
  82.     compile (group: 'org.kohsuke', name: 'github-api', version: '1.90') {
  83.         exclude group: 'commons-io'
  84.     }
  85.  
  86.  
  87.     // real examples
  88.     //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
  89.     //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  90.  
  91.     // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
  92.     //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  93.  
  94.     // the deobf configurations:  'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
  95.     // except that these dependencies get remapped to your current MCP mappings
  96.     //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  97.     //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  98.  
  99.     // for more info...
  100.     // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  101.     // http://www.gradle.org/docs/current/userguide/dependency_management.html
  102.  
  103. }
  104.  
  105. // Add dependencies to the JAR
  106. jar {
  107.     from configurations.embed.collect {
  108.         exclude '.classpath'
  109.         exclude '.project'
  110.         exclude 'META-INF/LICENSE.txt'
  111.         exclude 'META-INF/NOTICE.txt'
  112.         exclude 'META-INF/LICENSE'
  113.         exclude 'META-INF/NOTICE'
  114.         it.isDirectory() ? it : zipTree(it)
  115.     }
  116. }
  117.  
  118. processResources {
  119.     // this will ensure that this task is redone when the versions change.
  120.     inputs.property "version", project.version
  121.     inputs.property "mcversion", project.minecraft.version
  122.  
  123.     // replace stuff in mcmod.info, nothing else
  124.     from(sourceSets.main.resources.srcDirs) {
  125.         include 'mcmod.info'
  126.  
  127.         // replace version and mcversion
  128.         expand 'version':project.version, 'mcversion':project.minecraft.version
  129.     }
  130.        
  131.     // copy everything else except the mcmod.info
  132.     from(sourceSets.main.resources.srcDirs) {
  133.         exclude 'mcmod.info'
  134.     }
  135. }
  136. //reobfJar.dependsOn shadowJar
  137.  
  138. // Custom tasks
  139.  
  140. task makeTmpWin32(type:Exec) {
  141.     commandLine = ['cmd.exe', '/c', 'mkdir', 'tmp']
  142. }
  143.  
  144. task unpackModWin32(type:Exec) {
  145.     workingDir = 'tmp'
  146.     commandLine = ['cmd.exe', '/c', 'jar', '-xvf', '..\\build\\libs\\'+archivesBaseName+'-'+version+'.jar']
  147. }
  148.  
  149. task makeTmpMac(type:Exec) {
  150.     commandLine = ['cmd.exe', '/c', 'mkdir', 'tmp']
  151. }
  152.  
  153. task unpackModMac(type:Exec) {
  154.     workingDir = 'tmp'
  155.     commandLine = ['cmd.exe', '/c', 'jar', '-xvf', '..\\build\\libs\\'+archivesBaseName+'-'+version+'.jar']
  156. }
  157.  
  158. task makeTmpLinux64(type:Exec) {
  159.     commandLine = ['cmd.exe', '/c', 'mkdir', 'tmp']
  160. }
  161.  
  162. task unpackModLinux64(type:Exec) {
  163.     workingDir = 'tmp'
  164.     commandLine = ['cmd.exe', '/c', 'jar', '-xvf', '..\\build\\libs\\'+archivesBaseName+'-'+version+'.jar']
  165. }
  166.  
  167. task unpackLibWin32(type:Exec) {
  168.     workingDir = 'tmp'
  169.     commandLine = ['cmd.exe', '/c', 'jar', '-xvf', '..\\lib\\jxbrowser\\lib\\jxbrowser-win32-'+jxbrowser_version+'.jar']
  170. }
  171.  
  172. task unpackLibMac(type:Exec) {
  173.     workingDir = 'tmp'
  174.     commandLine = ['cmd.exe', '/c', 'jar', '-xvf', '..\\lib\\jxbrowser\\lib\\jxbrowser-mac-'+jxbrowser_version+'.jar']
  175. }
  176.  
  177. task unpackLibLinux64(type:Exec) {
  178.     workingDir = 'tmp'
  179.     commandLine = ['cmd.exe', '/c', 'jar', '-xvf', '..\\lib\\jxbrowser\\lib\\jxbrowser-linux64-'+jxbrowser_version+'.jar']
  180. }
  181.  
  182. task repackWin32(type:Exec) {
  183.     workingDir = 'tmp'
  184.     commandLine = ['cmd.exe', '/c', 'jar', '-cvf',  '..\\build\\'+archivesBaseName+'-'+version+'-win32.jar', '.']
  185. }
  186.  
  187. task repackMac(type:Exec) {
  188.     workingDir = 'tmp'
  189.     commandLine = ['cmd.exe', '/c', 'jar', '-cvf',  '..\\build\\'+archivesBaseName+'-'+version+'-mac.jar', '.']
  190. }
  191.  
  192. task repackLinux64(type:Exec) {
  193.     workingDir = 'tmp'
  194.     commandLine = ['cmd.exe', '/c', 'jar', '-cvf',  '..\\build\\'+archivesBaseName+'-'+version+'-linux64.jar', '.']
  195. }
  196.  
  197. task removeTmpWin32(type:Exec) {
  198.     commandLine = ['cmd.exe', '/c', 'rmdir', '/S', '/Q','tmp']
  199. }
  200.  
  201. task removeTmpMac(type:Exec) {
  202.     commandLine = ['cmd.exe', '/c', 'rmdir', '/S', '/Q','tmp']
  203. }
  204.  
  205. task removeTmpLinux64(type:Exec) {
  206.     commandLine = ['cmd.exe', '/c', 'rmdir', '/S', '/Q','tmp']
  207. }
  208.  
  209. task packageWin32() {
  210.     dependsOn makeTmpWin32
  211.     dependsOn unpackModWin32
  212.     dependsOn unpackLibWin32
  213.     dependsOn repackWin32
  214.     dependsOn removeTmpWin32
  215.    
  216.     tasks.findByName('unpackModWin32').mustRunAfter 'makeTmpWin32'
  217.     tasks.findByName('unpackLibWin32').mustRunAfter 'unpackModWin32'
  218.     tasks.findByName('repackWin32').mustRunAfter 'unpackLibWin32'
  219.     tasks.findByName('removeTmpWin32').mustRunAfter 'repackWin32'
  220. }
  221.  
  222. task packageMac() {
  223.     dependsOn makeTmpMac
  224.     dependsOn unpackModMac
  225.     dependsOn unpackLibMac
  226.     dependsOn repackMac
  227.     dependsOn removeTmpMac
  228.    
  229.     tasks.findByName('unpackModMac').mustRunAfter 'makeTmpMac'
  230.     tasks.findByName('unpackLibMac').mustRunAfter 'unpackModMac'
  231.     tasks.findByName('repackMac').mustRunAfter 'unpackLibMac'
  232.     tasks.findByName('removeTmpMac').mustRunAfter 'repackMac'
  233. }
  234.  
  235. task packageLinux64() {
  236.     dependsOn makeTmpLinux64
  237.     dependsOn unpackModLinux64
  238.     dependsOn unpackLibLinux64
  239.     dependsOn repackLinux64
  240.     dependsOn removeTmpLinux64
  241.    
  242.     tasks.findByName('unpackModLinux64').mustRunAfter 'makeTmpLinux64'
  243.     tasks.findByName('unpackLibLinux64').mustRunAfter 'unpackModLinux64'
  244.     tasks.findByName('repackLinux64').mustRunAfter 'unpackLibLinux64'
  245.     tasks.findByName('removeTmpLinux64').mustRunAfter 'repackLinux64'
  246. }
  247.  
  248. task buildAll() {
  249.     dependsOn build
  250.     dependsOn packageWin32
  251.     dependsOn packageMac
  252.     dependsOn packageLinux64
  253.    
  254.     tasks.findByName('packageWin32').mustRunAfter 'build'
  255.     tasks.findByName('packageMac').mustRunAfter 'packageWin32'
  256.     tasks.findByName('packageLinux64').mustRunAfter 'packageMac'
  257. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement