From af3a51c0a8cd24a86175df8d999a79f01eb09105 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Thu, 2 Dec 2021 19:59:50 +0100 Subject: Migrate to unified build script (#59) Former-commit-id: 9b48b72af5e2885baffbe3f89984364d99bc58d4 --- .github/FUNDING.yml | 12 - .github/scripts/test-no-crash-reports.sh | 9 + .github/workflows/build-and-test.yml | 45 ++ .github/workflows/gradle.yml | 26 -- .github/workflows/release-tags.yml | 45 ++ .gitignore | 73 +-- .travis.yml | 43 -- addon.gradle | 3 + build.bat | 2 - build.gradle | 517 +++++++++++++++++++++ build.gradle.kts | 236 ---------- dependencies.gradle | 32 ++ ...-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id | 1 + gradle.properties | 92 ++-- gradle/wrapper/gradle-wrapper.jar | Bin 51017 -> 55616 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 98 ++-- gradlew.bat | 30 +- jitpack.yml | 2 + ...-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id | 1 - repositories.gradle | 26 ++ .../github/bartimaeusnek/bartworks/MainMod.java | 4 +- src/main/resources/mcmod.info | 8 +- 23 files changed, 853 insertions(+), 455 deletions(-) delete mode 100644 .github/FUNDING.yml create mode 100644 .github/scripts/test-no-crash-reports.sh create mode 100644 .github/workflows/build-and-test.yml delete mode 100644 .github/workflows/gradle.yml create mode 100644 .github/workflows/release-tags.yml delete mode 100644 .travis.yml create mode 100644 addon.gradle delete mode 100644 build.bat create mode 100644 build.gradle delete mode 100644 build.gradle.kts create mode 100644 dependencies.gradle create mode 100644 dependencies/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id create mode 100644 jitpack.yml delete mode 100644 libs/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id create mode 100644 repositories.gradle diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 8b1d0623a8..0000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: bartimaeusnek -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with a single custom sponsorship URL diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh new file mode 100644 index 0000000000..c67e342c06 --- /dev/null +++ b/.github/scripts/test-no-crash-reports.sh @@ -0,0 +1,9 @@ +directory="run/crash-reports" +if [ -d $directory ]; then + echo "Crash reports detected:" + cat $directory/* + exit 1 +else + echo "No crash reports detected" + exit 0 +fi diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000000..a60a2b6468 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Build and test + +on: + pull_request: + branches: [ master, main ] + push: + branches: [ master, main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Run server for 1 minute + run: | + mkdir run + echo "eula=true" > run/eula.txt + timeout 60 ./gradlew runServer || true + + - name: Test no crashes happend + run: | + chmod +x .github/scripts/test-no-crash-reports.sh + .github/scripts/test-no-crash-reports.sh diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 3af6a933ed..0000000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.http.connectionTimeout=60000 diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml new file mode 100644 index 0000000000..25c354b227 --- /dev/null +++ b/.github/workflows/release-tags.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release tagged build + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Release under current tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.RELEASE_VERSION }}" + prerelease: false + title: "${{ env.RELEASE_VERSION }}" + files: build/libs/*.jar diff --git a/.gitignore b/.gitignore index 44a1b8107b..558ad12d27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,51 +1,28 @@ -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# IDEA files -.idea/ +.gradle +.settings +/.idea/ +/run/ +/build/ +/eclipse/ +.classpath +.project +/bin/ +/config/ +/crash-reports/ +/logs/ +options.txt +/saves/ +usernamecache.json +banned-ips.json +banned-players.json +eula.txt +ops.json +server.properties +servers.dat +usercache.json +whitelist.json +/out/ *.iml *.ipr *.iws - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar -*.bin -*.lock -*.sqlite -/old - - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -/eclipse -/build -/out -/run -/.gradle -/venv -/libs/* -!/libs/TecTech-1.7.10-3.7.3-deobf.jar -!/libs/CodeChickenCore-1.7.10-1.0.4.35-dev.jar -!/libs/CodeChickenLib-1.7.10-1.1.1.99-dev.jar -!/libs/NotEnoughItems-1.7.10-1.0.4.95-dev.jar -!/libs/gregtech-5.09.33.32-dev.jar -!/libs/GalacticGreg-1.7.10-1.0.3.jar -SetupWorkspaces.bat -SetupDevWorkspaces.bat -Idea.bat -*.bat -.idea \ No newline at end of file +src/main/resources/mixins.*.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9470b6a66f..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -language: java -sudo: false -install: true -cache: - directories: - - "$HOME/.gradle/caches/2.14.1" - - "$HOME/.gradle/caches/jars-1" - - "$HOME/.gradle/caches/jars-2" - - "$HOME/.gradle/caches/jars-3" - - "$HOME/.gradle/native" - - "$HOME/.gradle/daemon" - - "$HOME/.gradle/wrapper" - - "$HOME/.gradle/minecraft" -jdk: - - openjdk8 -jobs: - include: -# - stage: sonar -# addons: -# sonarcloud: -# organization: "bartimaeusnek-github" -# token: -# secure: "KW2U8HenTpLQOXT+OxCsu4noCKH6ZkUATld36YTbwAwzVKt6aesqtKHkZuo+Y+a143GI184pdnhMcRB1F49Wf0IQTkOhvopfnSEg+AKWZJb+gAbZQaYkaoe04pVzdwnpBXPDZR0DnTJX09VJGlES0RMiYfaQDHAYuPRQRBf17mLWvhXf7ZfNshGLikmzQcXWoXMpB+z9BaJ9Vr9/+Jn4Geuh9MWsbc2xZyQU8hoTTtKxqj5sTVRkwmxTf0ooGrMKohoOQ5JeZLDWM0Z/7KW64kFCE3xDrKg2gnKyKNLU6qIwbgCtVkcqGb28tXuqNdRSZ5BHb70dZb0E2+9VGhS7xPA8iUVmktJRKKG+f34HtDlsXqA00SEF2u+fq+TDz7fcPHLM8z1IcUI2XF5c5A/6E1k161i3kMB9xpd5Rq4waywo+/2j+L2CE6u5aj7BeL7KUQKD7k5gx3bXUyIo2QdjzeJeUJTSaxchcae9iIO+W6rwc68fD5/UNHVp+O75QNz2B+pklz6hCFVaoUep8rl4LO58ODBU1GL4JfeTM0RzOofOFepPXIi39iCk89c61WBtxX8RPkv3nBDsrXCGU7UNH1thP1nmgCfB4HGRxixWBAnmPDHNLEW81RG+meGRpHX7RkWISmrl95x15QXb016hldvK3sAegxxVPUdyJxRplgE=" -# script: "./gradlew sonarqube" - - stage: buildAndDeploy - script: "./gradlew build -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.http.connectionTimeout=60000" - deploy: - provider: releases - api_key: - secure: "fZcmkACyjZv8rEjG9hjsNq6ZT/przBeSGYzdfpT55YV/xWXj18Lkqr4XfrY4GiTp/pJwOGYT5dUUybRSlMM3eSMWNcAjBOW7WuJDEkZIHPKTb5/H+SJgUeuxj0W7cTqANWvYlMaNv2WSQfV2UW09xvSuMJuVMUcng1E1AZj6hF5285DrbxygEiF0ZY77Rsq+Q3l29bJxrj+x5D8ui8m2rn2tug8+W5/iCxYLpNEQ0hLcxPOh/0GbdHtsett81F9CVW+aPnVE7AlVnGK6lftWfiwPHqglpbx7lwEr6/gHBFuJIasreP5+GJvMx0D96la4KRvREFfS4eAZXLG7Syx0zzVInf6SHtMtzVM7heIY/aEnZ8clYxfnOBw10hyuev4QUdCvBb0tndsrCBI4kEIqvvNVcpHatJyzr+q0gj7mvGsXu3DIN5teo6h6DBJrbuhS6QKM2Lm/FsrboeSfIFlXE94IORmQzH0evgbk8u+CER1VNvrRHBngfEqypGd06TbXVW/uvfCedpvOZ3ewuPhLqOZHCzXbjBDAf0xzIcwWIzkEcpT4hXujHexyGAPJVHZDO2KA/7oFWEks9gCdnSJ7Qet5VwsUyDHzsDACix5+9tiYc0CFyRcEuWsvfVCqYCs1NwDJcHH0KxFceah1UzvS+6QB5MFfR5uFxhgUA4qsMd0=" - file: build/libs/*.jar - skip_cleanup: true - file_glob: true - on: - tags: false -after_success: - - wget https://raw.githubusercontent.com/bartimaeusnek/travis-ci-discord-webhook/master/send.sh - - chmod +x send.sh - - ./send.sh success $WEBHOOK_URL -after_failure: - - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh - - chmod +x send.sh - - ./send.sh failure $WEBHOOK_URL diff --git a/addon.gradle b/addon.gradle new file mode 100644 index 0000000000..cc0f5d57e5 --- /dev/null +++ b/addon.gradle @@ -0,0 +1,3 @@ +compileJava { + options.encoding = "UTF-8" +} diff --git a/build.bat b/build.bat deleted file mode 100644 index 3c93bfe30e..0000000000 --- a/build.bat +++ /dev/null @@ -1,2 +0,0 @@ -call gradlew.bat build -pause \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..a380f6c76f --- /dev/null +++ b/build.gradle @@ -0,0 +1,517 @@ +//version: ffe7b130f98fdfa1ac7c6ba4bd34722a55ab28d4 +/* +DO NOT CHANGE THIS FILE! + +Also, you may replace this file at any time if there is an update available. +Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates. + */ + + +import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +import java.util.concurrent.TimeUnit + +buildscript { + repositories { + maven { + name = "forge" + url = "https://maven.minecraftforge.net" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + name = "Scala CI dependencies" + url = "https://repo1.maven.org/maven2/" + } + maven { + name = "jitpack" + url = "https://jitpack.io" + } + } + dependencies { + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' + } +} + +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: 'forge' + +def projectJavaVersion = JavaLanguageVersion.of(8) + +java { + toolchain { + languageVersion.set(projectJavaVersion) + } +} + +idea { + module { + inheritOutputDirs = true + downloadJavadoc = true + downloadSources = true + } +} + +if(JavaVersion.current() != JavaVersion.VERSION_1_8) { + throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) +} + +checkPropertyExists("modName") +checkPropertyExists("modId") +checkPropertyExists("modGroup") +checkPropertyExists("autoUpdateBuildScript") +checkPropertyExists("minecraftVersion") +checkPropertyExists("forgeVersion") +checkPropertyExists("replaceGradleTokenInFile") +checkPropertyExists("gradleTokenModId") +checkPropertyExists("gradleTokenModName") +checkPropertyExists("gradleTokenVersion") +checkPropertyExists("gradleTokenGroupName") +checkPropertyExists("apiPackage") +checkPropertyExists("accessTransformersFile") +checkPropertyExists("usesMixins") +checkPropertyExists("mixinPlugin") +checkPropertyExists("mixinsPackage") +checkPropertyExists("coreModClass") +checkPropertyExists("containsMixinsAndOrCoreModOnly") +checkPropertyExists("usesShadowedDependencies") +checkPropertyExists("developmentEnvironmentUserName") + +def checkPropertyExists(String propertyName) { + if (project.hasProperty(propertyName) == false) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties") + } +} + + +String javaSourceDir = "src/main/java/" +String scalaSourceDir = "src/main/scala/" + +String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") +String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") +if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +} + +if(apiPackage) { + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } +} + +if(accessTransformersFile) { + String targetFile = "src/main/resources/META-INF/" + accessTransformersFile + if(new File(targetFile).exists() == false) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + } +} + +if(usesMixins.toBoolean()) { + if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { + throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") + } + + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if((new File(targetPackageJava).exists() || new File(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } + + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +if(coreModClass) { + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + if((new File(targetFileJava).exists() || new File(targetFileScala).exists() || new File(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) + + // Make sure GregTech build won't time out + System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) + System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) +} + +// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version +'git config core.fileMode false'.execute() +// Pulls version from git tag +try { + version = minecraftVersion + "-" + gitVersion() +} +catch (Exception e) { + throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!"); +} +group = modGroup +archivesBaseName = modId + +minecraft { + version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion + runDir = "run" + + if (replaceGradleTokenInFile) { + replaceIn replaceGradleTokenInFile + if(gradleTokenModId) { + replace gradleTokenModId, modId + } + if(gradleTokenModName) { + replace gradleTokenModName, modName + } + if(gradleTokenVersion) { + replace gradleTokenVersion, versionDetails().lastTag + } + if(gradleTokenGroupName) { + replace gradleTokenGroupName, modGroup + } + } +} + +if(file("addon.gradle").exists()) { + apply from: "addon.gradle" +} + +apply from: 'repositories.gradle' + +configurations { + implementation.extendsFrom(shadowImplementation) +} + +repositories { + maven { + name = "Overmind forge repo mirror" + url = "https://gregtech.overminddl1.com/" + } + if(usesMixins.toBoolean()) { + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + url = "https://jitpack.io" + } + } +} + +dependencies { + if(usesMixins.toBoolean()) { + annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") + annotationProcessor("com.google.guava:guava:24.1.1-jre") + annotationProcessor("com.google.code.gson:gson:2.8.6") + annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + // using 0.8 to workaround a issue in 0.7 which fails mixin application + compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { + // Mixin includes a lot of dependencies that are too up-to-date + exclude module: "launchwrapper" + exclude module: "guava" + exclude module: "gson" + exclude module: "commons-io" + exclude module: "log4j-core" + } + compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") + } +} + +apply from: 'dependencies.gradle' + +def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" + +task generateAssets { + if(usesMixins.toBoolean()) { + new File(projectDir.toString() + "/src/main/resources/", "mixins." + modId + ".json").text = """{ + "required": true, + "minVersion": "0.7.11", + "package": "${modGroup}.${mixinsPackage}", + "plugin": "${modGroup}.${mixinPlugin}", + "refmap": "${mixingConfigRefMap}", + "target": "@env(DEFAULT)", + "compatibilityLevel": "JAVA_8" +} + +""" + } +} + +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" +} + +shadowJar { + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] + dependsOn(relocateShadowJar) +} + +jar { + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } +} + +reobf { + if(usesMixins.toBoolean()) { + addExtraSrgFile mixinSrg + } +} + +afterEvaluate { + if(usesMixins.toBoolean()) { + tasks.compileJava { + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" + ] + } + } +} + +runClient { + def arguments = [] + + if(usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + if(developmentEnvironmentUserName) { + arguments += [ + "--username", + developmentEnvironmentUserName + ] + } + + args(arguments) +} + +runServer { + def arguments = [] + + if (usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + args(arguments) +} + +tasks.withType(JavaExec).configureEach { + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } + ) +} + +processResources + { + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +def getManifestAttributes() { + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] + } + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + return manifestAttributes +} + +task sourcesJar(type: Jar) { + from (sourceSets.main.allJava) + from (file("$projectDir/LICENSE")) + getArchiveClassifier().set('sources') +} + +task shadowDevJar(type: ShadowJar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] +} + +task relocateShadowDevJar(type: ConfigureShadowRelocation) { + target = tasks.shadowDevJar + prefix = modGroup + ".shadow" +} + +task circularResolverJar(type: Jar) { + dependsOn(relocateShadowDevJar) + dependsOn(shadowDevJar) + enabled = false +} + +task devJar(type: Jar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(circularResolverJar) + enabled = false + } +} + +task apiJar(type: Jar) { + from (sourceSets.main.allJava) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**' + } + + from (sourceSets.main.output) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**' + } + + from (sourceSets.main.resources.srcDirs) { + include("LICENSE") + } + + getArchiveClassifier().set('api') +} + +artifacts { + archives sourcesJar + archives devJar + if(apiPackage) { + archives apiJar + } +} + +// Updating +task updateBuildScript { + doLast { + if (updateBuildScript()) return + + print("Build script already up-to-date!") + } +} + +if (isNewBuildScriptVersionAvailable()) { + if (autoUpdateBuildScript.toBoolean()) { + updateBuildScript() + } else { + println("Build script update available! Run 'gradle updateBuildScript'") + } +} + +static URL availableBuildScriptUrl() { + new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") +} + +static boolean updateBuildScript() { + if (isNewBuildScriptVersionAvailable()) { + def buildscriptFile = new File("build.gradle") + availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + return true + } + return false +} + +static boolean isNewBuildScriptVersionAvailable() { + Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] + + String currentBuildScript = new File("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) + + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate +} + +static String getVersionHash(String buildScriptContent) { + String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") + if(versionLine != null) { + return versionLine.split(": ").last() + } + return "" +} + +configure(updateBuildScript) { + group = 'forgegradle' + description = 'Updates the build script to the latest version' +} diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 4d0258ed0b..0000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import net.minecraftforge.gradle.user.UserExtension - -buildscript { - repositories { - mavenCentral() - maven("https://gregtech.overminddl1.com") - maven("https://jitpack.io") - } - dependencies { - classpath("com.github.GTNewHorizons:ForgeGradle:1.2.4") - } -} - -plugins { - idea - java - id("org.ajoberstar.grgit") version("3.1.1") -} - -apply(plugin = "forge") - -idea { - module { - this.isDownloadJavadoc = true - this.isDownloadSources = true - } -} - -java { - this.sourceCompatibility = JavaVersion.VERSION_1_8 - this.targetCompatibility = JavaVersion.VERSION_1_8 -} - -configurations.all { - resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) - isTransitive = false -} - -tasks.withType { - options.encoding = "UTF-8" -} - -val majorUpdate: String by project -val minorUpdate: String by project -val buildNumber: String by project - -minecraft.version = "1.7.10-10.13.4.1614-1.7.10" -version = "$majorUpdate.$minorUpdate.$buildNumber" -group = "com.github.bartimaeusnek.bartworks" - -//minecraft block -configure { - this.includes.addAll( - arrayOf( - "MainMod.java", - "API_REFERENCE.java" - ) - ) - val apiVersion: String by project - this.replacements.putAll( - mapOf( - Pair("@version@", project.version), - Pair("@apiversion@", apiVersion) - ) - ) - this.runDir = "run" -} - -repositories { - mavenLocal() - maven("https://gregtech.overminddl1.com/") { this.name = "GT6Maven" } - maven("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/") { this.name = "ic2" } - maven("http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/") { this.name = "UsrvDE/GTNH" } - ivy { - this.name = "gtnh_download_source_stupid_underscore_typo" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]") - } - ivy { - this.name = "gtnh_download_source" - this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]") - } - ivy { - this.name = "BuildCraft" - this.artifactPattern("http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision](-[classifier]).[ext]") - } - ivy { - this.name = "vexatos" - this.artifactPattern("https://files.vexatos.com/[organisation]/[module]-[revision]-[classifier].[ext]") - } - maven("http://maven.cil.li/") { this.name = "OpenComputers" } - maven("http://default.mobiusstrip.eu/maven") { this.name = "Jabba" } - maven("http://chickenbones.net/maven/") { this.name = "CodeChicken" } - maven("http://www.ryanliptak.com/maven/") { this.name = "appleCore" } - maven("http://maven.tterrag.com") { this.name = "tterrag Repo" } - maven("https://jitpack.io") -} - -dependencies { - //Needed properties - val ic2Version: String by project - val galacticraftVersion: String by project - val applecoreVersion: String by project - val enderCoreVersion: String by project - val enderioVersion: String by project - - //hard deps - compile("net.industrial-craft:industrialcraft-2:$ic2Version:dev") - //jitpack - compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") { - this.isChanging = true - } - compile ("com.github.GTNewHorizons:StructureLib:1.0.6:deobf") - compile("com.github.GTNewHorizons:TinkersConstruct:master-SNAPSHOT:dev") { - this.isChanging = true - } - compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-1.7.10-SNAPSHOT:dev") { - this.isChanging = true - } - //soft deps - compileOnly("com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf") - compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") - compileOnly("mods.railcraft:Railcraft_1.7.10:9.12.3.0:dev") - compile("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev") - compile("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev") - compile("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev") - compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api") - compileOnly("net.sengir.forestry:forestry_1.7.10:4.4.0.0:dev") - compileOnly("TGregworks:TGregworks:1.7.10-GTNH-1.0.19:deobf") - //jitpack - compileOnly("com.github.GTNewHorizons:GalacticGregGT5:master-SNAPSHOT") { - this.isChanging = true - } - //compileOnly("com.github.Technus:Tectech:master-SNAPSHOT") { - // this.isChanging = true - //} - //Files - compileOnly(fileTree("libs") { this.include("*.jar") }) - - //CoreLibs for compile-age - //compileOnly("com.github.GTNH2:Yamcl:master-SNAPSHOT") //broken jitpack.io dep - compileOnly("applecore:AppleCore:$applecoreVersion:api") - compileOnly("com.enderio.core:EnderCore:$enderCoreVersion:dev") - compileOnly("com.enderio:EnderIO:$enderioVersion:dev") - - //NEI - compile("com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev") - compile("com.github.GTNewHorizons:CodeChickenCore:master-SNAPSHOT:dev") - compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev") -} - -val Project.minecraft: UserExtension - get() = extensions.getByName("minecraft") - -tasks.withType { - // this will ensure that this task is redone when the versions change. - this.inputs.properties += "version" to project.version - this.inputs.properties += "mcversion" to project.minecraft.version - this.archiveBaseName.set("bartworks[${project.minecraft.version}]-[${getVersionAppendage()}]") - - // replace stuff in mcmod.info, nothing else - this.filesMatching("/mcmod.info") { - this.expand( - mapOf( - "version" to project.version, - "mcversion" to project.minecraft.version - ) - ) - } -} - -tasks.jar { - this.exclude( - "assets/gregtech/textures/items/materialicons/copy.bat", - "assets/gregtech/textures/blocks/materialicons/copy.bat" - ) - this.manifest.attributes( - mapOf( - Pair("FMLCorePlugin","com.github.bartimaeusnek.ASM.BWCorePlugin"), - Pair("FMLCorePluginContainsFMLMod","true") - ) - ) -} - -val apiJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().output) { - this.include( - "com/github/bartimaeusnek/bartworks/API/**", - "com/github/bartimaeusnek/bartworks/util/**", - "com/github/bartimaeusnek/bartworks/system/material/Werkstoff.class", - "com/github/bartimaeusnek/crossmod/thaumcraft/util/**" - ) - } - this.archiveClassifier.set("API") -} - -val sourcesJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().allSource) - this.archiveClassifier.set("sources") -} - -val devJar by tasks.creating(Jar::class) { - this.from(sourceSets.main.get().output) - this.archiveClassifier.set("dev") -} - -artifacts { - this.archives(apiJar) - this.archives(sourcesJar) - this.archives(devJar) -} - -fun getVersionAppendage() : String { - return org.ajoberstar.grgit.Grgit.open(mapOf("currentDir" to project.rootDir)).log().last().abbreviatedId -} diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000000..a9bb02f4e8 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,32 @@ +// Add your dependencies here + +dependencies { + compile("com.github.GTNewHorizons:GalacticGregGT5:master-SNAPSHOT:dev") + + compile files("dependencies/TecTech-1.7.10-4.10.4-local-b6491dd.jar") + + compileOnly("com.github.GTNewHorizons:AppleCore:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:TinkersGregworks:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:api") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:Railcraft:master-SNAPSHOT:api") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:api") { + transitive = false + } + + compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.7.5.1356:api") { + transitive = false + } + compileOnly("com.mod-buildcraft:buildcraft:7.1.23:dev") { + transitive = false + } + + runtime("com.github.GTNewHorizons:Yamcl:master-SNAPSHOT:dev") +} diff --git a/dependencies/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id b/dependencies/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id new file mode 100644 index 0000000000..8f77b8280a --- /dev/null +++ b/dependencies/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id @@ -0,0 +1 @@ +dc6e19622ea5e9f310bca2ea25ad5f160dc21591 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 2a69f2e18f..9f5ae76b21 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,32 +1,60 @@ -# -# Copyright (c) 2018-2020 bartimaeusnek -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -systemProp.org.gradle.internal.http.connectionTimeout=120000 -systemProp.org.gradle.internal.http.socketTimeout=120000 -majorUpdate=0 -minorUpdate=5 -buildNumber=25 -apiVersion=11 -ic2Version=2.2.828-experimental -applecoreVersion=1.7.10-3.1.1 -galacticraftVersion=1.7-3.0.12.504 -enderioVersion=1.7.10-2.3.0.429_beta -enderCoreVersion=1.7.10-0.2.0.39_beta \ No newline at end of file +modName = BartWorks + +# This is a case-sensitive string to identify your mod. Convention is to use lower case. +modId = bartworks + +modGroup = com.github.bartimaeusnek.bartworks + +# WHY is there no version field? +# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the +# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ + +# Will update your build.gradle automatically whenever an update is available +autoUpdateBuildScript = false + +minecraftVersion = 1.7.10 +forgeVersion = 10.13.4.1614 + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you +# restart Minecraft in development. Choose this dependent on your mod: +# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name +# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +developmentEnvironmentUserName = "Developer" + +# Define a source file of your project with: +# public static final String VERSION = "GRADLETOKEN_VERSION"; +# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's +# version in @Mod([...], version = VERSION, [...]) +# Leave these properties empty to skip individual token replacements +replaceGradleTokenInFile = MainMod.java +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = GRADLETOKEN_VERSION +gradleTokenGroupName = + +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can +# leave this property empty. +# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +apiPackage = + +# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ +# Example value: mymodid_at.cfg +accessTransformersFile = + +# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! +usesMixins = false +# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. +mixinPlugin = +# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +mixinsPackage = +# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! +# This parameter is for legacy compatability only +# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +coreModClass = +# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class +# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! +containsMixinsAndOrCoreModOnly = false + +# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# responsibility check the licence and request permission for distribution, if required. +usesShadowedDependencies = false diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b761216703..5c2d1cf016 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9cc785acbf..3ab0b725ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Jul 02 15:54:47 CDT 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-all.zip \ No newline at end of file diff --git a/gradlew b/gradlew index 91a7e269e1..83f2acfdc3 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,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +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 ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +75,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=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" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -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 "$@") + +# 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" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282aa6..9618d8d960 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= - 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 diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000000..09bbb514fc --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +before_install: + - ./gradlew setupCIWorkspace \ No newline at end of file diff --git a/libs/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id b/libs/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id deleted file mode 100644 index 8f77b8280a..0000000000 --- a/libs/TecTech-1.7.10-4.10.4-local-b6491dd.jar.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -dc6e19622ea5e9f310bca2ea25ad5f160dc21591 \ No newline at end of file diff --git a/repositories.gradle b/repositories.gradle new file mode 100644 index 0000000000..130197c8aa --- /dev/null +++ b/repositories.gradle @@ -0,0 +1,26 @@ +// Add any additional repositories for your dependencies here + +repositories { + maven { + name "OpenComputers Repo" + url = "http://maven.cil.li/" + } + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url "https://cursemaven.com" + } + maven { + url = "https://jitpack.io" + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 4723d9c6ac..c3cc760025 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -78,9 +78,9 @@ import static gregtech.api.enums.GT_Values.VN; ) public final class MainMod { public static final String NAME = "BartWorks"; - public static final String VERSION = "@version@"; + public static final String VERSION = "GRADLETOKEN_VERSION"; public static final String MOD_ID = "bartworks"; - public static final String APIVERSION = "@apiversion@"; + public static final String APIVERSION = "11"; public static final Logger LOGGER = LogManager.getLogger(MainMod.NAME); public static final CreativeTabs GT2 = new GT2Tab("GT2C"); public static final CreativeTabs BIO_TAB = new BioTab("BioTab"); diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index ce4324d98d..f13aa2a23b 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,10 +1,10 @@ [ { - "modid": "bartworks", - "name": "BartWorks", + "modid": "${modId}", + "name": "${modName}", "description": "A Gregtech Addon.", - "version": "${version}", - "mcversion": "${mcversion}", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", "url": "https://github.com/bartimaeusnek/bartworks", "updateUrl": "", "authorList": ["bartimaeusnek"], -- cgit