Skip to content

Commit

Permalink
Publish version.json (#104)
Browse files Browse the repository at this point in the history
* Update buildscript

* Add publishing for version.json

* Switch remaining maven urls

* Publish to github releases too

---------

Co-authored-by: Raven Szewczyk <[email protected]>
  • Loading branch information
glowredman and eigenraven authored Jan 1, 2024
1 parent b3d9d80 commit a5a3412
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
-f tag_name="${RELEASE_VERSION}" \
--jq ".body" > "${CHANGELOG_FILE}"
cat "${CHANGELOG_FILE}"
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" ./build/libs/*.jar ./build/distributions/*.zip
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" ./build/libs/*.jar ./build/libs/*.json ./build/distributions/*.zip
shell: bash
continue-on-error: true
env:
Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ First, do `./gradlew build` and use the zip in `./build/distributions/lwjgl3ify-

Then, for developing locally, in the `patches/me.eigenraven.lwjgl3ify.forgepatches.json` file replace:
```json
"url": "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
"url": "https://nexus.gtnewhorizons.com/repository/public/"
```
with:
```json
Expand Down
14 changes: 14 additions & 0 deletions addon.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.jvm.toolchain.internal.DefaultToolchainSpec

def newJavaToolchainSpec = new DefaultToolchainSpec(objects)
Expand Down Expand Up @@ -140,9 +141,19 @@ def mmcInstanceFilesZip = tasks.register("mmcInstanceFiles", Zip) {
}
}

def versionJsonFile = tasks.register("versionJson", Copy) {
dependsOn("reobfJar")
from 'launcher-metadata/version.json'
into 'build/libs'
filter(ReplaceTokens, tokens: [version: project.version,
jvmArgs: extraJavaArgs.collect { '"' + it + '"' }.join(", "),
time: new Date().format("yyyy-MM-dd'T'HH:mm:ssXXX")])
}

tasks.named("assemble").configure {
dependsOn(forgePatchesSet.jarTaskName)
dependsOn(mmcInstanceFilesZip)
dependsOn(versionJsonFile)
}

tasks.register("runComparisonTool", JavaExec) {
Expand All @@ -157,6 +168,9 @@ afterEvaluate {
publishing.publications.named("maven", MavenPublication) {
artifact forgePatchesJar
artifact mmcInstanceFilesZip
artifact("build/libs/version.json") {
builtBy versionJson
}
}

def lwjgl2Zips = configurations.named("lwjgl2Classpath").get().resolve().findAll {!it.name.contains("natives") && !it.path.contains("net.java.j")}
Expand Down
60 changes: 21 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1699290261
//version: 1704135167
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -28,27 +28,11 @@ import java.util.concurrent.TimeUnit

buildscript {
repositories {
mavenCentral()

maven {
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven {
// GTNH RetroFuturaGradle and ASM Fork
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
url "https://nexus.gtnewhorizons.com/repository/public/"
}
maven {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}

mavenLocal()
}
}
Expand All @@ -64,12 +48,12 @@ plugins {
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id 'com.palantir.git-version' version '3.0.0' apply false
id 'de.undercouch.download' version '5.4.0'
id 'de.undercouch.download' version '5.5.0'
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.26'
}

print("You might want to check out './gradlew :faq' if your build fails.\n")
Expand Down Expand Up @@ -133,7 +117,7 @@ propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("usesMavenPublishing", true)
propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
propertyDefaultIfUnset("mavenPublishUrl", "https://nexus.gtnewhorizons.com/repository/releases/")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
Expand Down Expand Up @@ -302,7 +286,7 @@ if (apiPackage) {
}

if (accessTransformersFile) {
for (atFile in accessTransformersFile.split(",")) {
for (atFile in accessTransformersFile.split(" ")) {
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
if (!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
Expand Down Expand Up @@ -588,13 +572,15 @@ afterEvaluate {

repositories {
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
name = "GTNH Maven"
url = "https://nexus.gtnewhorizons.com/repository/public/"
// Links for convenience:
// Simple HTML browsing: https://nexus.gtnewhorizons.com/service/rest/repository/browse/releases/
// Rich web UI browsing: https://nexus.gtnewhorizons.com/#browse/browse:releases
}
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
maven {
name 'sonatype'
Expand Down Expand Up @@ -628,7 +614,7 @@ repositories {
}
maven {
name = "ic2"
url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/")
url = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/")
content {
includeGroup "net.industrial-craft"
}
Expand Down Expand Up @@ -687,6 +673,8 @@ configurations.all {
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")

substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets')
}
}

Expand Down Expand Up @@ -793,12 +781,12 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}

dependencies {
def lwjgl3ifyVersion = '1.5.1'
def lwjgl3ifyVersion = '1.5.7'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
}

java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
Expand Down Expand Up @@ -973,8 +961,7 @@ if (usesShadowedDependencies.toBoolean()) {
configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
tasks.named("jar", Jar) {
enabled = false
finalizedBy(tasks.shadowJar)
archiveClassifier.set('dev-preshadow')
}
tasks.named("reobfJar", ReobfuscatedJar) {
inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile}))
Expand All @@ -983,11 +970,6 @@ if (usesShadowedDependencies.toBoolean()) {
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
skip()
}
for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
tasks.named(runTask).configure {
dependsOn("shadowJar")
}
}
}
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
ext.publishableObfJar = tasks.reobfJar
Expand Down Expand Up @@ -1191,7 +1173,7 @@ publishing {
if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
allowInsecureProtocol = mavenPublishUrl.startsWith("http://")
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
Expand Down Expand Up @@ -1310,7 +1292,7 @@ def addCurseForgeRelation(String type, String name) {

// Updating

def buildscriptGradleVersion = "8.2.1"
def buildscriptGradleVersion = "8.5"

tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down
49 changes: 5 additions & 44 deletions launcher-metadata/version.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,46 +85,7 @@
],
"value": "-Xss1M"
},
"-Djava.library.path=${natives_directory}",
"-cp",
"${classpath}",
"--illegal-access=warn",
"-Djava.security.manager=allow",
"-Dfile.encoding=UTF-8",
"--add-opens",
"java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens",
"java.base/java.net=ALL-UNNAMED",
"--add-opens",
"java.base/java.nio=ALL-UNNAMED",
"--add-opens",
"java.base/java.io=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens",
"java.base/java.text=ALL-UNNAMED",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/jdk.internal.reflect=ALL-UNNAMED",
"--add-opens",
"java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens",
"jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
"--add-opens",
"java.desktop/sun.awt.image=ALL-UNNAMED",
"--add-opens",
"java.desktop/com.sun.imageio.plugins.png=ALL-UNNAMED",
"--add-modules",
"jdk.dynalink",
"--add-opens",
"jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
"--add-modules",
"java.sql.rowset",
"--add-opens",
"java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
"-Djava.library.path=${natives_directory}", "-cp", "${classpath}", @jvmArgs@
]
},
"assetIndex": {
Expand Down Expand Up @@ -1702,8 +1663,8 @@
]
},
{
"name": "com.github.GTNewHorizons:lwjgl3ify:1.5.6:forgePatches",
"url": "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
"name": "com.github.GTNewHorizons:lwjgl3ify:@version@:forgePatches",
"url": "https://nexus.gtnewhorizons.com/repository/public/"
},
{
"name": "net.minecraftforge:forge:1.7.10-10.13.4.1614-1.7.10:universal",
Expand Down Expand Up @@ -1774,7 +1735,7 @@
},
"mainClass": "net.minecraft.launchwrapper.Launch",
"minimumLauncherVersion": 21,
"releaseTime": "2023-11-29T22:06:00+01:00",
"time": "2023-11-29T22:06:00+01:00",
"releaseTime": "@time@",
"time": "@time@",
"type": "release"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"libraries": [
{
"name": "com.github.GTNewHorizons:lwjgl3ify:${version}:forgePatches",
"url": "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
"url": "https://nexus.gtnewhorizons.com/repository/public/"
}
]
}
10 changes: 4 additions & 6 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
Expand All @@ -17,8 +16,8 @@ pluginManagement {
}

plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
id 'com.diffplug.blowdryerSetup' version '1.7.1'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
}

blowdryerSetup {
Expand All @@ -28,4 +27,3 @@ blowdryerSetup {
}

rootProject.name = "lwjgl3ify"

0 comments on commit a5a3412

Please sign in to comment.