Skip to content

Commit 1990f78

Browse files
committed
wipsplit
1 parent ad6231c commit 1990f78

22 files changed

Lines changed: 348 additions & 91 deletions

File tree

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
on:
2+
push:
3+
branches:
4+
- "**"
5+
tags:
6+
- "v*"
7+
pull_request:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@v6
17+
- uses: actions/setup-java@v6
18+
with:
19+
distribution: adopt
20+
java-version: 11
21+
cache: gradle
22+
23+
- run: ./gradlew build :bundle:tar --no-daemon
24+
- run: zstd --compress -19 bundle/build/distributions/bundle.tar
25+
26+
- uses: actions/upload-artifact@v7
27+
with:
28+
name: bundle.tar.zst
29+
path: bundle/build/distributions/bundle.tar.zst
30+
if-no-files-found: error
31+
archive: false
32+
33+
- name: Release
34+
if: startsWith(github.ref, 'refs/tags/')
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
run: |
38+
gh release create "${GITHUB_REF_NAME}" \
39+
bundle/build/distributions/bundle.tar.zst \
40+
--title "${GITHUB_REF_NAME}" \
41+
--generate-notes \
42+
--latest
43+
- name: Nightly Release
44+
if: !startsWith(github.ref, 'refs/tags/') && github.event_name == "push"
45+
env:
46+
GH_TOKEN: ${{ github.token }}
47+
run: |
48+
gh release delete nightly --cleanup-tag --yes
49+
gh release create nightly \
50+
--target "${GITHUB_REF_NAME}" \
51+
bundle/build/distributions/bundle.tar.zst \
52+
--title nightly \
53+
--latest=false \
54+
--prerelease

apirecorder/build.gradle

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ repositories {
2929
mavenCentral()
3030
}
3131

32-
configurations {
33-
runelite {
34-
resolutionStrategy {
35-
// we don't run any code from this configuration
36-
disableDependencyVerification()
37-
}
38-
}
39-
}
40-
41-
def runeLiteVersion = file("../../runelite.version").text.trim()
42-
4332
dependencies {
4433
implementation "org.slf4j:slf4j-simple:1.7.10"
4534
implementation "com.google.code.findbugs:jsr305:3.0.2"
@@ -52,21 +41,9 @@ dependencies {
5241
annotationProcessor lombok
5342
testCompileOnly lombok
5443
testAnnotationProcessor lombok
55-
56-
runelite group: 'net.runelite', name: 'client', version: runeLiteVersion
57-
runelite group: 'net.runelite', name: 'jshell', version: runeLiteVersion
58-
runelite lombok
5944
}
6045

6146
compileJava.options.compilerArgs += [
6247
"--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
6348
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
64-
]
65-
66-
def apiFilePath = new File(project.buildDir, "api")
67-
68-
task api(type: JavaExec) {
69-
classpath = sourceSets.main.runtimeClasspath
70-
mainClass = "net.runelite.pluginhub.apirecorder.ClassRecorder"
71-
args = [apiFilePath] + configurations.runelite.files
72-
}
49+
]

apirecorder/src/main/java/net/runelite/pluginhub/apirecorder/ClassRecorder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public static void main(String... classes) throws IOException
117117
fi = args.next();
118118
cr.recordClass(new File(fi));
119119
}
120+
out.getParentFile().mkdir();
120121
try (OutputStream os = new FileOutputStream(out))
121122
{
122123
cr.getApi().encode(os);

build.gradle

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,3 @@ subprojects {
4949
with tasks.jar
5050
}
5151
}
52-
53-
// we have this task then java -jar the output rather than using gradle run so
54-
// the daemon used to build this can be reused by a real plugin build
55-
task prep {
56-
dependsOn ":package:shadowJar"
57-
dependsOn ":apirecorder:shadowJar"
58-
doLast {
59-
file("build").mkdirs()
60-
file("build/gradleHome").write(gradle.gradleHomeDir.absolutePath)
61-
}
62-
}

bundle/build.gradle.kts

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* Copyright (c) 2026 Abex
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation
12+
* and/or other materials provided with the distribution.
13+
*
14+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
import de.undercouch.gradle.tasks.download.Download
26+
import de.undercouch.gradle.tasks.download.Verify
27+
28+
plugins {
29+
id("de.undercouch.download") version "5.7.0"
30+
}
31+
32+
val distURL = "https://services.gradle.org/distributions/gradle-8.10-bin.zip"
33+
val distSHA = "5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a"
34+
35+
val wrapperZip = layout.buildDirectory.file("gradle.zip")
36+
val downloadGradle = tasks.create<Download>("downloadGradle") {
37+
src(distURL)
38+
dest(wrapperZip)
39+
}
40+
val verifyGradle = tasks.create<Verify>("verifyGradle") {
41+
dependsOn(downloadGradle)
42+
src(wrapperZip)
43+
algorithm("SHA-256")
44+
checksum(distSHA)
45+
}
46+
47+
val rtCopy = copySpec {
48+
from(arrayOf(":apirecorder", ":package", ":upload").map {
49+
project(it).tasks.getByName<Jar>("shadowJar").archiveFile
50+
})
51+
from(file("src/main/resources"))
52+
from(zipTree(wrapperZip)) {
53+
eachFile {
54+
relativePath.segments[0] = "gradle"
55+
}
56+
includeEmptyDirs = false
57+
}
58+
}
59+
var rtDeps = arrayOf(verifyGradle)
60+
61+
var tar = tasks.create<Tar>("tar") {
62+
archiveFileName = archiveBaseName.get() + "." + archiveExtension.get()
63+
64+
dependsOn(rtDeps)
65+
with(rtCopy)
66+
}
67+
var rtDir = layout.buildDirectory.dir("test_runtime").get()
68+
var testRTSync = tasks.create<Sync>("testRuntimeSync") {
69+
into(rtDir)
70+
71+
dependsOn(rtDeps)
72+
with(rtCopy)
73+
from(file("src/test/resources"))
74+
}
75+
76+
repositories {
77+
mavenLocal()
78+
maven {
79+
setUrl("https://repo.runelite.net")
80+
content {
81+
includeGroupByRegex("net\\.runelite.*")
82+
}
83+
}
84+
mavenCentral()
85+
}
86+
87+
val runelite = configurations.create("runelite") {
88+
isCanBeConsumed = false
89+
isCanBeResolved = true
90+
isTransitive = false
91+
}
92+
dependencies {
93+
runelite("net.runelite:client:latest.release")
94+
}
95+
96+
var rlVersion = tasks.create("rlVersion") {
97+
dependsOn(testRTSync, runelite)
98+
doLast {
99+
val version = runelite.incoming.resolutionResult.allComponents
100+
.mapNotNull { it.id as? ModuleComponentIdentifier }
101+
.single { it.group == "net.runelite" && it.module == "client" }
102+
.version
103+
104+
rtDir.file("plugin-hub/runelite.version").asFile.writeText("$version\n")
105+
}
106+
}
107+
108+
var testVerificationMetadata = tasks.create<Exec>("testVerificationMetadata") {
109+
val verTmplDir = rtDir.file("plugin-hub/package/verification-template")
110+
dependsOn(testRTSync, rlVersion)
111+
inputs.dir(verTmplDir)
112+
commandLine(
113+
rtDir.file("gradle/bin/gradle"),
114+
"--no-daemon",
115+
"--project-dir",
116+
verTmplDir,
117+
"--write-verification-metadata",
118+
"sha256",
119+
":verifyCore",
120+
)
121+
workingDir(rtDir)
122+
}
123+
124+
var preparer = tasks.create<Exec>("preparer") {
125+
dependsOn(testRTSync, rlVersion)
126+
commandLine(rtDir.file("prepare.sh"))
127+
workingDir(rtDir)
128+
}
129+
130+
val testRuntime = configurations.create("testRuntime") {
131+
isCanBeConsumed = true
132+
isCanBeResolved = false
133+
}
134+
var rtArtifact = artifacts.add("testRuntime", rtDir) {
135+
builtBy(testRTSync, preparer, rlVersion, testVerificationMetadata)
136+
}
137+
138+
tasks.build {
139+
dependsOn(rtArtifact, tar)
140+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec ./gradle/bin/gradle --no-daemon --project-dir ./preparer :api
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2021 Abex
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation
12+
* and/or other materials provided with the distribution.
13+
*
14+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
repositories {
26+
maven {
27+
url = "https://repo.runelite.net"
28+
}
29+
mavenCentral()
30+
}
31+
32+
configurations {
33+
runelite {
34+
resolutionStrategy {
35+
// we don't run any code from this configuration
36+
disableDependencyVerification()
37+
}
38+
}
39+
}
40+
41+
def runeLiteVersion = file("../plugin-hub/runelite.version").text.trim()
42+
43+
dependencies {
44+
runelite group: 'net.runelite', name: 'client', version: runeLiteVersion
45+
runelite group: 'net.runelite', name: 'jshell', version: runeLiteVersion
46+
runelite "org.projectlombok:lombok:1.18.30"
47+
}
48+
49+
def apiFilePath = file("../api/${runeLiteVersion}.api")
50+
51+
task api(type: JavaExec) {
52+
classpath = files("../apirecorder.jar")
53+
mainClass = "net.runelite.pluginhub.apirecorder.ClassRecorder"
54+
args = [apiFilePath] + configurations.runelite.files
55+
}

bundle/src/main/resources/preparer/settings.gradle

Whitespace-only changes.

target_init.gradle renamed to bundle/src/main/resources/target_init.gradle

File renamed without changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
plugins {
2+
id "base"
3+
}
4+
5+
repositories {
6+
maven {
7+
url = "https://repo.runelite.net"
8+
}
9+
mavenCentral()
10+
gradlePluginPortal()
11+
}
12+
13+
configurations {
14+
core
15+
}
16+
17+
dependencies {
18+
core group: "net.runelite", name: "client", version: file("../../runelite.version").text.trim()
19+
core "org.projectlombok:lombok:1.18.30"
20+
core "org.jetbrains:annotations:23.0.0"
21+
}
22+
23+
task verifyCore {
24+
doLast {
25+
// This causes resolution (and therefore verification) of the configuration
26+
configurations.core.asPath
27+
}
28+
}

0 commit comments

Comments
 (0)