Advertisement
Guest User

Untitled

a guest
Jan 11th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 5.64 KB | None | 0 0
  1.  
  2. allprojects {
  3.     repositories {
  4.         jcenter()
  5.         mavenCentral()
  6.         mavenLocal()
  7.     }
  8. }
  9.  
  10. buildscript {
  11.     repositories {
  12.         maven { url = 'https://files.minecraftforge.net/maven' }
  13.         gradlePluginPortal()
  14.     }
  15.     dependencies {
  16.         classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  17.         classpath "gradle.plugin.com.lazan:gradle-maven-share:0.4"
  18.     }
  19. }
  20.  
  21.  
  22.  
  23. allprojects {
  24.     apply plugin: 'idea'
  25.     apply plugin: 'eclipse'
  26.     apply plugin: 'maven-publish'
  27.     ext {
  28.         isDepForge = false
  29.         isMaven = false
  30.         delayedSetup = {}
  31.     }
  32. }
  33. subprojects {
  34.  
  35.     ext {
  36.         title = project.name
  37.         fmlmodtype = "MOD"
  38.     }
  39.     group = 'org.oilmod'
  40. }
  41.  
  42. //important to now evaluate children as they might change properties we depend on and we do not want to read the default values!
  43. evaluationDependsOnChildren()
  44.  
  45. allprojects {
  46.  
  47.     if (project.isDepForge) {
  48.         println "$project.name is forge dep"
  49.         apply plugin: 'net.minecraftforge.gradle'
  50.         configurations {
  51.             // configuration that holds jars to copy into lib
  52.             compileJars
  53.             providedJars
  54.             releaseJars
  55.             releaseJars.extendsFrom(compileJars)
  56.             compile.extendsFrom(compileJars)
  57.         }
  58.     }
  59.     if (project.isMaven) {
  60.         apply plugin: 'java'
  61.         apply plugin: 'com.lazan.gradlemavenshare'
  62.         fmlmodtype = 'NONE/MAVEN-LIB' //only for debug purposes, is never read
  63.     }
  64.  
  65.  
  66.     project.delayedSetup()
  67.  
  68.     if (project.isDepForge) {
  69.         archivesBaseName = project.projectDir.name
  70.         sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  71.  
  72.  
  73.         dependencies {
  74.             // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
  75.             // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
  76.             // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  77.             minecraft 'net.minecraftforge:forge:1.14.4-28.1.90'
  78.  
  79.             // You may put jars on which you depend on in ./libs or you may define them like so..
  80.             // compile "some.group:artifact:version:classifier"
  81.             // compile "some.group:artifact:version"
  82.  
  83.             // Real examples
  84.             // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
  85.             // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  86.  
  87.             // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
  88.             // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  89.  
  90.             // These dependencies get remapped to your current MCP mappings
  91.             // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  92.  
  93.             // For more info...
  94.             // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  95.             // http://www.gradle.org/docs/current/userguide/dependency_management.html
  96.  
  97.  
  98.         }
  99.  
  100.         minecraft {
  101.             // The mappings can be changed at any time, and must be in the following format.
  102.             // snapshot_YYYYMMDD   Snapshot are built nightly.
  103.             // stable_#            Stables are built at the discretion of the MCP team.
  104.             // Use non-default mappings at your own risk. they may not always work.
  105.             // Simply re-run your setup task after changing the mappings to update your workspace.
  106.             mappings channel: 'snapshot', version: '20190719-1.14.3'
  107.             // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  108.  
  109.             // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  110.  
  111.         }
  112.  
  113.  
  114.         if (project.metaClass.respondsTo(project, "setupForge")) {
  115.             setupForge() //if the subproject wants to do extra forge setup this gets called
  116.         }
  117.  
  118.         //println "Subproject $project.name properties:  FMLMODTYPE $project.fmlmodtype"
  119.         jar {
  120.             doFirst { task ->
  121.                 println "Doing jar task for $task.project.name version ${task.project.version} and FMLMODTYPE $task.project.fmlmodtype"
  122.             }
  123.             manifest {
  124.                 attributes([
  125.                         "Specification-Title": project.title,
  126.                         "Specification-Vendor": "oilforge",
  127.                         "Specification-Version": "1", // We are version 1 of ourselves
  128.                         "Implementation-Title": project.name,
  129.                         "Implementation-Version": "${version}",
  130.                         "Implementation-Vendor" :"oilforge",
  131.                         "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
  132.                         "FMLModType": fmlmodtype,
  133.                         //"Class-Path": configurations.releaseJars.collect { "META-INF/libraries/${it.getName()}" }.join(' ') //todo fix dependency inclusion
  134.                 ])
  135.             }
  136.  
  137.             into('META-INF/libraries/') {
  138.                 from configurations.releaseJars
  139.             }
  140.         }
  141.     }
  142. }
  143.  
  144.  
  145. subprojects {
  146. // Example for how to get properties into the manifest for reading by the runtime..
  147.  
  148.  
  149.     task hello {
  150.         doLast { task ->
  151.             println "I'm $task.project.name version ${task.project.version} and FMLMODTYPE $task.project.fmlmodtype"
  152.         }
  153.     }
  154.  
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement