From 4f5d0cc3bc81589ce9cbf1257281a7361787ea98 Mon Sep 17 00:00:00 2001 From: bombcar Date: Thu, 2 Dec 2021 17:52:34 -0600 Subject: [PATCH] update build --- build.gradle | 238 +++++++++++++---------- build.properties | 22 +-- gradle.properties | 0 gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 130 ++++++++----- gradlew.bat | 30 ++- 6 files changed, 242 insertions(+), 181 deletions(-) delete mode 100644 gradle.properties diff --git a/build.gradle b/build.gradle index 10f4e8261..8d259cb87 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,14 @@ buildscript { } } +plugins { + id 'idea' + id 'scala' + id("org.ajoberstar.grgit") version("3.1.1") + id("com.github.johnrengelman.shadow") version("4.0.4") + id("com.palantir.git-version") version("0.12.3") +} + apply plugin: 'scala' apply plugin: 'forge' apply plugin: 'idea' @@ -27,16 +35,136 @@ tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = ["-deprecation:false"] } -file "build.properties" withReader { - def prop = new Properties() - prop.load(it) - ext.config = new ConfigSlurper().parse prop +repositories { + maven { + name = "mightypirates" + url = "https://maven.cil.li/" + metadataSources { + mavenPom() + artifact() + } + } + // These are necessary because some parts of the maven repo is weirdly structured, this needs to be fixed. + ivy { + name 'weird maven repos' + artifactPattern "https://maven.cil.li/[module]/[revision]/[module]-[revision].[ext]" + metadataSources { + ivyDescriptor() + artifact() + } + } + ivy { + name 'weird maven repos 2' + artifactPattern "https://maven.cil.li/[module]/[revision]/[module]-[revision]-[classifier].[ext]" + metadataSources { + ivyDescriptor() + artifact() + } + } + maven { + name "Mobius Repo" + url "http://mobiusstrip.eu/maven" + metadataSources { + mavenPom() + artifact() + } + } + maven { + name = "ic2" + url = "https://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + name = "gt" + url = "https://gregtech.overminddl1.com/" + } + ivy { + name 'gtnh_download_source' + artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]" + } + maven { // GalacticGreg, YAMCore,.. + name 'UsrvDE' + url "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/" + } + maven { + url "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/" + } + maven { + name = "jitpack" + url = "https://jitpack.io" + } + maven { + name = "curse.maven" + url = "https://cursemaven.com" + } } -version = "${config.oc.version}" group = "li.cil.oc" archivesBaseName = "OpenComputers" +// Define properties file +ext.configFile = file "build.properties" + +configFile.withReader { + // Load config. It shall from now be referenced as simply config or project.config + def prop = new Properties() + prop.load(it) + project.ext.config = new ConfigSlurper().parse prop +} + +dependencies { + compileOnly ("appeng:RotaryCraft:${project.config.rotc_version}:api") { + transitive = false + } + compileOnly "com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:EnderStorage:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:Waila:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:ForgeMultipart:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:dev" + compileOnly ("com.github.GTNewHorizons:Galacticraft:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly "com.github.GTNewHorizons:Railcraft:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:ThaumicEnergistics:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:ExtraCells2:master-SNAPSHOT:dev" + compileOnly "com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:dev" + compileOnly "com.mod-buildcraft:buildcraft:7.1.23:dev" + compileOnly "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev" + compileOnly "curse.maven:mekanism-268560:2475797" //mekanism - not needed in gtnh, won't build without + compileOnly "codechicken:WR-CBE:${project.config.minecraft_version}-${project.config.wrcbe_version}:dev" + compileOnly "com.bluepowermod:BluePower:${project.config.bluepower.version}:deobf" + compileOnly "igwmod:IGW-Mod-1.7.10:${project.config.igwmod.version}:userdev" + compileOnly "li.cil.tis3d:TIS-3D:${project.config.tis3d.version}:dev" + compileOnly "net.industrial-craft:industrialcraft-2:${project.config.ic2.version}:dev" + compileOnly "dev.modwarriors.notenoughkeys:NotEnoughKeys:${project.config.minecraft_version}-${project.config.nek.version}:deobf-dev" + compileOnly "qmunity:QmunityLib:${project.config.qmunitylib.version}:deobf" + compileOnly "tmech:TMechworks:${project.config.minecraft_version}-${project.config.tmech.version}:deobf" + compileOnly ("mrtjp:ProjectRed:${project.config.projred.version}:dev") { + exclude module: 'CoFHCore' + } + compileOnly name: 'redlogic', version: project.config.redlogic.version, ext: 'jar' + compileOnly name: 'MineFactoryReloaded', version: project.config.mfr.version, ext: 'jar' + compileOnly name: 'ComputerCraft', version: project.config.cc.version, ext: 'jar' + compileOnly name: 'BloodMagic', version: project.config.bloodmagic.version, ext: 'jar' + + implementation 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs. + + //embedded files('libs/OpenComputers-JNLua.jar', 'libs/OpenComputers-LuaJ.jar') + + testCompile "org.mockito:mockito-all:1.10.19" + testCompile "org.scalactic:scalactic_2.11:2.2.6" + testCompile "org.scalatest:scalatest_2.11:2.2.6" +} + +version = "${project.config.mod_version}" ?: "1" + +println config.minecraft_version + "-" + config.forge_version + def getGitRef() { try { def stdout = new ByteArrayOutputStream() @@ -58,7 +186,9 @@ else version += "+" + getGitRef() ext.simpleVersion = version -version = "MC${config.minecraft.version}-${project.version}" +version = "MC${config.minecraft_version}-${project.version}" + +def root = project.projectDir.parentFile runClient { jvmArgs '-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader' @@ -75,110 +205,18 @@ if (JavaVersion.current().isJava8Compatible()) { } } -repositories { - maven { - name = "mightypirates" - url = "https://maven.cil.li/" - } - // These are necessary because some parts of the maven repo is weirdly structured, this needs to be fixed. - ivy { - name 'weird maven repos' - artifactPattern "https://maven.cil.li/[module]/[revision]/[module]-[revision].[ext]" - } - ivy { - name 'weird maven repos 2' - artifactPattern "https://maven.cil.li/[module]/[revision]/[module]-[revision]-[classifier].[ext]" - } - maven { - name "Mobius Repo" - url "http://mobiusstrip.eu/maven" - } - maven { - name = "ic2" - url = "https://maven.ic2.player.to/" - } - maven { - name = "gt" - url = "https://gregtech.overminddl1.com/" - } - ivy { - name 'gtnh_download_source' - artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]" - } - maven { // GalacticGreg, YAMCore,.. - name 'UsrvDE' - url "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/" - } - maven { - url "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/" - } - maven { - name = "jitpack" - url = "https://jitpack.io" - } - maven { - name = "curse.maven" - url = "https://cursemaven.com" - } -} - configurations { embedded implementation.extendsFrom embedded } -dependencies { - compileOnly "appeng:RotaryCraft:${config.rotc.version}:api" - compileOnly "com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev" - compileOnly "com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev" - compileOnly "com.github.GTNewHorizons:EnderStorage:master-SNAPSHOT:dev" - compileOnly "com.github.GTNewHorizons:Waila:master-SNAPSHOT:dev" - compileOnly "com.github.GTNewHorizons:ForgeMultipart:master-SNAPSHOT:dev" - compileOnly "codechicken:WR-CBE:${config.minecraft.version}-${config.wrcbe.version}:dev" - compileOnly "com.bluepowermod:BluePower:${config.bluepower.version}:deobf" - compileOnly "com.gregoriust.gregtech:gregtech:${config.gt.version}:dev" - compileOnly "igwmod:IGW-Mod-1.7.10:${config.igwmod.version}:userdev" - compileOnly "li.cil.tis3d:TIS-3D:${config.tis3d.version}:dev" - compileOnly "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" - compileOnly "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev" - compileOnly "dev.modwarriors.notenoughkeys:NotEnoughKeys:${config.minecraft.version}-${config.nek.version}:deobf-dev" - compileOnly "qmunity:QmunityLib:${config.qmunitylib.version}:deobf" - compileOnly "tmech:TMechworks:${config.minecraft.version}-${config.tmech.version}:deobf" - compileOnly ("mrtjp:ProjectRed:${config.projred.version}:dev") { - exclude module: 'CoFHCore' - } - // compileOnly "coloredlightscore:ColoredLightsCore:${config.coloredlights.version}:api" - compileOnly name: 'buildcraft', version: config.bc.version, classifier: "dev", ext: 'jar' - compileOnly name: 'GalacticraftCoreAll', version: config.gc.version, ext: 'jar' - compileOnly name: 'MekanismAll', version: config.mekanism.version, ext: 'jar' - compileOnly name: 'redlogic', version: config.redlogic.version, ext: 'jar' - - compileOnly name: 'CoFHLib', version: config.cofhlib.version, ext: 'jar' - compileOnly name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar' - compileOnly name: 'MineFactoryReloaded', version: config.mfr.version, ext: 'jar' - compileOnly name: 'ComputerCraft', version: config.cc.version, ext: 'jar' - compileOnly name: 'EnderIO', version: config.eio.version, ext: 'jar' - compileOnly name: 'Railcraft', version: config.rc.version, ext: 'jar' - compileOnly name: 'BloodMagic', version: config.bloodmagic.version, ext: 'jar' - compileOnly name: 'ExtraCells', version: config.ec.version, ext: 'jar' - compileOnly name: 'ThaumicEnergistics', version: config.thaumicenergistics.version, ext: 'jar' - compileOnly "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev" - - compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs. - - embedded files('libs/OpenComputers-JNLua.jar', 'libs/OpenComputers-LuaJ.jar') - - testCompile "org.mockito:mockito-all:1.10.19" - testCompile "org.scalactic:scalactic_2.11:2.2.6" - testCompile "org.scalatest:scalatest_2.11:2.2.6" -} minecraft { - version = "${config.minecraft.version}-${config.forge.version}" + version = config.minecraft_version + "-" + config.forge_version + "-" + config.minecraft_version replace "@VERSION@", project.simpleVersion - replace "/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version},${config.minecraft.version}+)\"" + //replace "/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version},${config.minecraft.version}+)\"" } processResources { diff --git a/build.properties b/build.properties index baa7dfd61..1b161c331 100644 --- a/build.properties +++ b/build.properties @@ -1,8 +1,8 @@ -minecraft.version=1.7.10 -forge.version=10.13.4.1614-1.7.10 - -oc.version=1.7.5.16-GTNH - +minecraft_version=1.7.10 +forge_version=10.13.4.1614 +mod_version=1.7.5.16-GTNH +rotc_version=V5c +wrcbe_version=1.4.1.2 ae2.version=rv3-beta-31 bc.version=7.0.9 bloodmagic.cf=2223/203 @@ -24,30 +24,20 @@ fmp.version=1.1.0.308 forestry.version=4.4.0.0 gc.build=3 gc.version=3.0.7 -gt.version=5.09.33.52 ic2.version=2.2.828-experimental igwmod.version=1.1.3-18 mekanism.build=5 mekanism.version=7.1.2 mfr.cf=2229/626 mfr.version=[1.7.10]2.8.0RC8-86 -nei.version=1.0.3.57 nek.version=2.0.0b4 projred.version=1.7.10-4.6.2.82 qmunitylib.version=0.1.105 rc.cf=2219/321 rc.version=1.7.10-9.4.0.0 redlogic.version=59.0.3 -rotc.version=V5c -thaumicenergistics.cf=2277/520 -thaumicenergistics.version=1.0.0.1-RV2 tis3d.version=MC1.7.10-1.2.4.70 tmech.version=75.0afb56c re.version=3.0.0.342 -waila.version=1.5.10 -wrcbe.version=1.4.1.2 cofhcore.cf=2246/697 -cofhcore.version=[1.7.10]3.0.3B4-302-dev - -curse.project.id=223008 -curse.project.releaseType=release +cofhcore.version=[1.7.10]3.0.3B4-302-dev \ No newline at end of file diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index e69de29bb..000000000 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6afbcbb43..3ab0b725e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Mar 07 00:48:03 EST 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip diff --git a/gradlew b/gradlew index 91a7e269e..83f2acfdc 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## ## @@ -6,47 +22,6 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" @@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do fi done SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- +cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" -cd "$SAVED" >&- +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -90,7 +105,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -110,10 +125,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +170,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ca9c9360d..9618d8d96 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,14 +24,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS=-Xmx1G -XX:MaxPermSize=256M - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +62,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +75,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line