aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/scripts/test-no-error-reports.sh27
-rw-r--r--.github/workflows/build-and-test.yml (renamed from .github/workflows/gradle.yml)30
-rw-r--r--.github/workflows/release-tags.yml61
-rw-r--r--.gitignore4
-rw-r--r--build.gradle384
-rw-r--r--dependencies.gradle37
-rw-r--r--dependencies/GTNewHorizonsCoreMod-1.7.10-1.9.00-dev.jar (renamed from libs/GTNewHorizonsCoreMod-1.7.10-1.9.00-dev.jar)bin10664734 -> 10664734 bytes
-rw-r--r--gradle.properties11
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--gradlew98
-rw-r--r--gradlew.bat30
-rw-r--r--libs/GT-PlusPlus-1.7.11.GTNH.jarbin6197736 -> 0 bytes
-rw-r--r--libs/bartworks[1.7.10]-[c9836c6]-0.5.24-dev.jarbin1182540 -> 0 bytes
-rw-r--r--repositories.gradle34
-rw-r--r--src/main/java/com/detrav/DetravScannerMod.java2
15 files changed, 514 insertions, 206 deletions
diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh
new file mode 100644
index 0000000000..e3876606d5
--- /dev/null
+++ b/.github/scripts/test-no-error-reports.sh
@@ -0,0 +1,27 @@
+if [[ -d "run/crash-reports" ]]; then
+ echo "Crash reports detected:"
+ cat $directory/*
+ exit 1
+fi
+
+if grep --quiet "Fatal errors were detected" server.log; then
+ echo "Fatal errors detected:"
+ cat server.log
+ exit 1
+fi
+
+if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then
+ echo "Server force stopped:"
+ cat server.log
+ exit 1
+fi
+
+if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then
+ echo "Server didn't finish startup:"
+ cat server.log
+ exit 1
+fi
+
+echo "No crash reports detected"
+exit 0
+
diff --git a/.github/workflows/gradle.yml b/.github/workflows/build-and-test.yml
index 75338898fa..08df9fe89f 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/build-and-test.yml
@@ -1,16 +1,16 @@
# 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: Java CI with Gradle
+name: Build and test
on:
- push:
- branches: [ master, main ]
pull_request:
branches: [ master, main ]
+ push:
+ branches: [ master, main ]
jobs:
- build:
+ build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@@ -29,15 +29,17 @@ jobs:
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
-
+
- name: Build the mod
run: ./gradlew build
-
- - uses: "marvinpinto/action-automatic-releases@latest"
- with:
- repo_token: "${{ secrets.GITHUB_TOKEN }}"
- automatic_release_tag: "latest"
- prerelease: true
- title: "Latest Development Build"
- files: build/libs/*.jar
-
+
+ - name: Run server for 1.5 minutes
+ run: |
+ mkdir run
+ echo "eula=true" > run/eula.txt
+ timeout 90 ./gradlew runServer | tee --append server.log || true
+
+ - name: Test no errors reported during server run
+ run: |
+ chmod +x .github/scripts/test-no-error-reports.sh
+ .github/scripts/test-no-error-reports.sh
diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml
new file mode 100644
index 0000000000..96d37f7d9a
--- /dev/null
+++ b/.github/workflows/release-tags.yml
@@ -0,0 +1,61 @@
+# 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
+
+ - name: Set repository owner and name
+ run: |
+ echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
+ echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
+
+ - name: Publish package
+ run: ./gradlew publish
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ ARTIFACT_GROUP_ID: com.github.${{ env.REPOSITORY_OWNER }}
+ ARTIFACT_ID: "${{ env.REPOSITORY_NAME }}"
+ ARTIFACT_VERSION: "${{ env.RELEASE_VERSION }}"
+ REPOSITORY_NAME: "${{ env.REPOSITORY_NAME }}"
+ REPOSITORY_OWNER: "${{ env.REPOSITORY_OWNER }}"
+
diff --git a/.gitignore b/.gitignore
index 4a0ea1e653..75c41f65d5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,9 +21,11 @@ server.properties
servers.dat
usercache.json
whitelist.json
-world/
/out/
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
+*.bat
+*.DS_Store
+!gradlew.bat
diff --git a/build.gradle b/build.gradle
index 5c3a3f49a5..2ec9a2ebac 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,4 @@
+//version: be36e1399d5622c152db7c530c48e17cde0ce1bb
/*
DO NOT CHANGE THIS FILE!
@@ -7,15 +8,13 @@ Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradl
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 = "jitpack"
- url = "https://jitpack.io"
- }
- maven {
name = "forge"
url = "https://maven.minecraftforge.net"
}
@@ -23,20 +22,38 @@ buildscript {
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.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT'
+ 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")
+ id("maven-publish")
}
apply plugin: 'forge'
-apply plugin: 'idea'
+
+def projectJavaVersion = JavaLanguageVersion.of(8)
+
+java {
+ toolchain {
+ languageVersion.set(projectJavaVersion)
+ }
+}
idea {
module {
@@ -46,6 +63,84 @@ idea {
}
}
+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")
+
+
+String javaSourceDir = "src/main/java/"
+String scalaSourceDir = "src/main/scala/"
+
+String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
+String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
+if((getFile(targetPackageJava).exists() || getFile(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((getFile(targetPackageJava).exists() || getFile(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(getFile(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((getFile(targetPackageJava).exists() || getFile(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((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(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((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(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)
@@ -54,16 +149,25 @@ configurations.all {
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
-version = minecraftVersion + "-" + gitVersion()
+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
+if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
+ archivesBaseName = customArchiveBaseName
+}
+else {
+ archivesBaseName = modId
+}
minecraft {
- if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
- throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
- }
-
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
@@ -75,7 +179,7 @@ minecraft {
if(gradleTokenModName) {
replace gradleTokenModName, modName
}
- if(gradleTokenModName) {
+ if(gradleTokenVersion) {
replace gradleTokenVersion, versionDetails().lastTag
}
if(gradleTokenGroupName) {
@@ -84,6 +188,10 @@ minecraft {
}
}
+if(file("addon.gradle").exists()) {
+ apply from: "addon.gradle"
+}
+
apply from: 'repositories.gradle'
configurations {
@@ -91,6 +199,10 @@ configurations {
}
repositories {
+ maven {
+ name = "Overmind forge repo mirror"
+ url = "https://gregtech.overminddl1.com/"
+ }
if(usesMixins.toBoolean()) {
maven {
name = "sponge"
@@ -123,19 +235,13 @@ dependencies {
apply from: 'dependencies.gradle'
-task relocateShadowJar(type: ConfigureShadowRelocation) {
- target = tasks.shadowJar
- prefix = modGroup + ".shadow"
-}
-
-def mixinConfigJson = "mixins." + modId + ".json"
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/", mixinConfigJson).text = """{
+ getFile("/src/main/resources/mixins." + modId + ".json").text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
@@ -149,61 +255,24 @@ task generateAssets {
}
}
-shadowJar {
- def manifestAttributes = [:]
- if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
- manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
- }
-
- if(accessTransformersFile) {
- manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
- }
-
- if(coreModClass) {
- manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
- }
+task relocateShadowJar(type: ConfigureShadowRelocation) {
+ target = tasks.shadowJar
+ prefix = modGroup + ".shadow"
+}
- if(usesMixins.toBoolean()) {
- from refMap
- manifestAttributes += [
- "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
- "MixinConfigs" : mixinConfigJson,
- "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
- ]
- }
+shadowJar {
manifest {
- attributes(manifestAttributes)
+ attributes(getManifestAttributes())
}
- minimize()
+ minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation]
dependsOn(relocateShadowJar)
}
jar {
- def manifestAttributes = [:]
- if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
- manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
- }
-
- if(accessTransformersFile) {
- manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
- }
-
- if(coreModClass) {
- manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
- }
-
- if(usesMixins.toBoolean()) {
- from refMap
- manifestAttributes += [
- "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
- "MixinConfigs" : mixinConfigJson,
- "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
- ]
- }
manifest {
- attributes(manifestAttributes)
+ attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
@@ -256,7 +325,7 @@ runClient {
runServer {
def arguments = []
- if(usesMixins.toBoolean()) {
+ if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
@@ -266,6 +335,14 @@ runServer {
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.
@@ -283,19 +360,19 @@ processResources
"modName": modName
}
+ if(usesMixins.toBoolean()) {
+ from refMap
+ }
+
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
-task sourcesJar(type: Jar) {
- from (sourceSets.main.allJava)
- from (file("$projectDir/LICENSE"))
- getArchiveClassifier().set('sources')
-
+def getManifestAttributes() {
def manifestAttributes = [:]
- if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
+ if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
@@ -308,55 +385,65 @@ task sourcesJar(type: Jar) {
}
if(usesMixins.toBoolean()) {
- from refMap
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
- "MixinConfigs" : mixinConfigJson,
+ "MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
- manifest {
- attributes(manifestAttributes)
- }
+ return manifestAttributes
}
-task devJar(type: Jar) {
+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")
- def manifestAttributes = [:]
- if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
- manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
+ manifest {
+ attributes(getManifestAttributes())
}
- if(accessTransformersFile) {
- manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
- }
+ minimize() // This will only allow shading for actually used classes
+ configurations = [project.configurations.shadowImplementation]
+}
- if(coreModClass) {
- manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
- }
+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")
- if(usesMixins.toBoolean()) {
- from refMap
- manifestAttributes += [
- "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
- "MixinConfigs" : mixinConfigJson,
- "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
- ]
- }
manifest {
- attributes(manifestAttributes)
+ attributes(getManifestAttributes())
+ }
+
+ if(usesShadowedDependencies.toBoolean()) {
+ dependsOn(circularResolverJar)
+ enabled = false
}
}
task apiJar(type: Jar) {
from (sourceSets.main.allJava) {
- include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**'
+ include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.output) {
- include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString() + '/**'
+ include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.resources.srcDirs) {
@@ -366,7 +453,6 @@ task apiJar(type: Jar) {
getArchiveClassifier().set('api')
}
-
artifacts {
archives sourcesJar
archives devJar
@@ -374,3 +460,103 @@ artifacts {
archives apiJar
}
}
+
+// publishing
+publishing {
+ publications {
+ maven(MavenPublication) {
+ artifact source: jar
+ artifact source: sourcesJar, classifier: "src"
+ artifact source: devJar, classifier: "dev"
+ if (apiPackage) {
+ archives source: apiJar, classifier: "api"
+ }
+
+ groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group
+ artifactId = System.getenv("ARTIFACT_ID") ?: project.name
+ version = System.getenv("ARTIFACT_VERSION") ?: project.version
+ }
+ }
+
+ repositories {
+ maven {
+ String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown"
+ String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown"
+ String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName"
+ name = "GitHubPackages"
+ url = githubRepositoryUrl
+ credentials {
+ username = System.getenv("GITHUB_ACTOR") ?: "NONE"
+ password = System.getenv("GITHUB_TOKEN") ?: "NONE"
+ }
+ }
+ }
+}
+
+// Updating
+task updateBuildScript {
+ doLast {
+ if (performBuildScriptUpdate(projectDir.toString())) return
+
+ print("Build script already up-to-date!")
+ }
+}
+
+if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
+ if (autoUpdateBuildScript.toBoolean()) {
+ performBuildScriptUpdate(projectDir.toString())
+ } 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")
+}
+
+boolean performBuildScriptUpdate(String projectDir) {
+ if (isNewBuildScriptVersionAvailable(projectDir)) {
+ def buildscriptFile = getFile("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
+}
+
+boolean isNewBuildScriptVersionAvailable(String projectDir) {
+ Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
+
+ String currentBuildScript = getFile("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'
+}
+
+// Helper methods
+
+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")
+ }
+}
+
+def getFile(String relativePath) {
+ return new File(projectDir, relativePath)
+}
diff --git a/dependencies.gradle b/dependencies.gradle
index b29b6f20c5..a2c165a664 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -1,28 +1,33 @@
// Add your dependencies here
dependencies {
- compile("com.github.GTNewHorizons:GT5-Unofficial:experimental-SNAPSHOT:dev") {
+ compile("com.github.GTNewHorizons:bartworks:master-SNAPSHOT:dev")
+ compile("com.github.GTNewHorizons:GTplusplus:master-SNAPSHOT:dev")
+ compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev")
+
+ compile files("dependencies/GTNewHorizonsCoreMod-1.7.10-1.9.00-dev.jar") // TODO
+
+ compileOnly("com.github.GTNewHorizons:VisualProspecting:master-SNAPSHOT:dev") {
+ transitive = false
+ }
+ compileOnly("com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:dev") {
+ transitive = false
+ }
+ compileOnly("com.github.GTNewHorizons:Railcraft:master-SNAPSHOT:dev") {
+ transitive = false
+ }
+ compileOnly("com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:dev") {
transitive = false
- setChanging(true)
}
- // GT5U Dependencies
- compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
- compile("com.github.GTNewHorizons:StructureLib:master-SNAPSHOT:deobf")
- compile("codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev")
- compile("codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev")
- compile("codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev")
-
- compile("mods.railcraft:Railcraft_1.7.10:9.12.2.0:dev")
- compile("net.sengir.forestry:forestry_1.7.10:4.2.10.58:dev")
- compile("com.enderio:EnderIO:1.7.10-2.3.0.417_beta:dev") {
+ compileOnly("com.mod-buildcraft:buildcraft:7.1.23:dev") {
transitive = false
}
- compileOnly("com.github.SinTh0r4s:VisualProspecting:1.0.19b") {
+ compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") {
transitive = false
}
- runtime("com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf")
- runtime("eu.usrv:YAMCore:1.7.10-0.5.80:deobf")
- runtime("com.enderio.core:EnderCore:1.7.10-0.1.0.25_beta:dev")
+ runtime("com.github.GTNewHorizons:Baubles:master-SNAPSHOT:dev") // TODO: remove once GTNH CoreMod is migrated
+ /*runtime("eu.usrv:YAMCore:1.7.10-0.5.80:deobf")
+ runtime("com.enderio.core:EnderCore:1.7.10-0.1.0.25_beta:dev")*/
}
diff --git a/libs/GTNewHorizonsCoreMod-1.7.10-1.9.00-dev.jar b/dependencies/GTNewHorizonsCoreMod-1.7.10-1.9.00-dev.jar
index c3dade5c66..c3dade5c66 100644
--- a/libs/GTNewHorizonsCoreMod-1.7.10-1.9.00-dev.jar
+++ b/dependencies/GTNewHorizonsCoreMod-1.7.10-1.9.00-dev.jar
Binary files differ
diff --git a/gradle.properties b/gradle.properties
index aaa3adcf9f..72cff3d7a8 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,12 +3,15 @@ modName = GT Scanner Mod
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = detravscannermod
-modGroup = com.detrav.detravscannermod
+modGroup = com.detrav
# 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
@@ -24,7 +27,7 @@ developmentEnvironmentUserName = "Developer"
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = DetravScannerMod.java
-gradleTokenModId = GRADLETOKEN_MODID
+gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
@@ -55,3 +58,7 @@ 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
+
+# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
+# projects. New projects should not use this parameter.
+customArchiveBaseName = GT Scanner Mod
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 5028f28f8e..3ab0b725ef 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 91a7e269e1..83f2acfdc3 100644
--- 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/libs/GT-PlusPlus-1.7.11.GTNH.jar b/libs/GT-PlusPlus-1.7.11.GTNH.jar
deleted file mode 100644
index ecabfec88c..0000000000
--- a/libs/GT-PlusPlus-1.7.11.GTNH.jar
+++ /dev/null
Binary files differ
diff --git a/libs/bartworks[1.7.10]-[c9836c6]-0.5.24-dev.jar b/libs/bartworks[1.7.10]-[c9836c6]-0.5.24-dev.jar
deleted file mode 100644
index 63af6dbf3f..0000000000
--- a/libs/bartworks[1.7.10]-[c9836c6]-0.5.24-dev.jar
+++ /dev/null
Binary files differ
diff --git a/repositories.gradle b/repositories.gradle
index ea7010b64c..affd587706 100644
--- a/repositories.gradle
+++ b/repositories.gradle
@@ -2,35 +2,19 @@
repositories {
maven {
- name 'Forge'
- url 'https://maven.minecraftforge.net/releases/'
+ name = "sponge"
+ url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
- name = "chickenbones"
- url = "http://chickenbones.net/maven/"
- }
- maven {
- name = "ic2, forestry"
+ name = "ic2"
url = "http://maven.ic2.player.to/"
+ metadataSources {
+ mavenPom()
+ artifact()
+ }
}
- maven { // EnderIO & EnderCore
- name 'tterrag Repo'
- url "http://maven.tterrag.com"
- }
- maven { // AppleCore
- url "http://www.ryanliptak.com/maven/"
- }
- maven { // GalacticGreg, YAMCore,..
- name = 'UsrvDE'
- url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/"
- }
- ivy {
- name = 'gtnh_download_source'
- artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]")
- }
- ivy {
- name = 'gtnh_download_source_stupid_underscore_typo'
- artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]")
+ maven {
+ url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
diff --git a/src/main/java/com/detrav/DetravScannerMod.java b/src/main/java/com/detrav/DetravScannerMod.java
index 87cc573cc7..9df8d230e3 100644
--- a/src/main/java/com/detrav/DetravScannerMod.java
+++ b/src/main/java/com/detrav/DetravScannerMod.java
@@ -23,7 +23,7 @@ import net.minecraftforge.common.config.Configuration;
@Mod(modid = DetravScannerMod.MODID, version = DetravScannerMod.VERSION,dependencies = "required-after:IC2;required-after:gregtech;after:miscutils;after:bartworks")
public class DetravScannerMod
{
- public static final String MODID = "GRADLETOKEN_MODID";
+ public static final String MODID = "detravscannermod";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String DEBUGOVERRIDE = "@false";
public static final boolean DEBUGBUILD = Boolean.parseBoolean(DEBUGOVERRIDE.substring(1));