From 6a9e4145277de2ccfbb82aec5907ee71e73b5897 Mon Sep 17 00:00:00 2001 From: Mikhail <68438915+mikhailkfv@users.noreply.github.com> Date: Thu, 21 Jul 2022 21:47:58 -0500 Subject: [PATCH] Fix buildscript (again) --- build.gradle | 147 ++++++++++++----------- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 78 insertions(+), 71 deletions(-) diff --git a/build.gradle b/build.gradle index 38ead8da..b6f13792 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,15 @@ buildscript { repositories { mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } + jcenter() + //maven { + // name = "forge" + // url = "http://files.minecraftforge.net/maven" + //} + maven { + name = "gt" + url = "https://gregtech.overminddl1.com/" + } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" @@ -15,10 +20,30 @@ buildscript { } } -apply plugin: 'forge' -apply plugin: 'idea' +// Because Forge is too stupid to fix Deprecation Issues, and we cannot fix it on our end! (until we fork Forge) +allprojects { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint:deprecation" + } +} -idea.module.inheritOutputDirs = true +apply plugin: 'eclipse' +eclipse { + classpath { + downloadJavadoc = true + downloadSources = true + } +} + +apply plugin: 'idea' +idea{ + module { + downloadJavadoc = true + downloadSources = true + } +} + +apply plugin: 'forge' file "build.properties" withReader { def prop = new Properties() @@ -26,24 +51,24 @@ file "build.properties" withReader { ext.config = new ConfigSlurper().parse prop } -allprojects { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:deprecation" - } -} - version = "${config.gt.version}" group= "gregtech" archivesBaseName = "gregtech" sourceCompatibility = 1.7 targetCompatibility = 1.7 +compileJava.options.bootClasspath = org.gradle.internal.jvm.Jvm.current().getJre().getHomeDir().toString() +"/lib/rt.jar" +compileJava { + options.encoding = "UTF-8" +} minecraft { version = "${config.minecraft.version}-${config.forge.version}" runDir = "eclipse" } +idea { module { inheritOutputDirs = true } } + configurations { provided embedded @@ -51,41 +76,21 @@ configurations { } repositories { - //maven { - // name 'Forge' - // url 'http://files.minecraftforge.net/maven' - //} - maven { - name = "gt" - url = "https://gregtech.overminddl1.com/" - } - maven { - name = "chickenbones" - url = "http://chickenbones.net/maven/" - } - maven { - name = "ic2, forestry" - url = "http://maven.ic2.player.to/" - } - maven { // EnderIO & EnderCore - name 'tterrag Repo' - url "http://maven.tterrag.com" - } - maven { // AppleCore - url "http://www.ryanliptak.com/maven/" - } - maven { - name = "Covers (COFH)" - url = "http://maven.covers1624.net/" - } - maven { - name = "local" - url = "file:///C:/Users/michael/Documents/forge/maven/" - } + maven { + name = "gt" + url = "http://gregtech.overminddl1.com/" + } + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + } } dependencies { - compile "ic2:IC2Classic:1.2.1.8:dev" +// compile fileTree(dir: 'libs', include: '*.jar') + + // Mostly Used for compileOnly, if you prefer normal IC2, uncomment it instead. + provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" compile "mcp.mobius.waila:Waila:1.5.11-RC2-NONEI_1.7.10:dev" compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev" @@ -110,6 +115,7 @@ dependencies { compileOnly "appeng:appliedenergistics2:rv3-beta-6:dev" compileOnly "applecore:AppleCore:1.7.10-3.1.1:deobf" compileOnly "com.shedar.IC2NuclearControl:IC2NuclearControl:2.4.3a:dev" + } processResources @@ -118,34 +124,35 @@ processResources inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version - ext.srcFiles = "$projectDir/src/main/resources" - ext.destDir = "$projectDir/build/classes/main" - - // registering inputs & outputs allow gradle to skip if UP-TO-DATE - inputs.files srcFiles - outputs.dir destDir - - println 'starting processResources' - println 'srcFiles: ' + srcFiles - println 'destDir: ' + destDir - - - copy { - // replace stuff in mcmod.info, nothing else - from(srcFiles) - into(destDir) + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - // replace version and mcversion - expand 'version': project.version, 'mcversion': project.minecraft.version - + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version } - - - copy { - // copy everything else, thats not the mcmod.info - from(srcFiles) - into(destDir) + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' + } + exclude '**/Thumbs.db' +} +task sourceJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' +} + +task devJar(type: Jar) { + from sourceSets.main.output + classifier = 'dev' + manifest { + //attributes 'FMLCorePlugin': 'WhateverLoaderClass' + //attributes 'FMLCorePluginContainsFMLMod': 'true' } } + +artifacts { + archives devJar +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0e828e2b..d60634ff 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip \ No newline at end of file