From 089520068191a5cca7cec59ba2440095d73d469e Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Wed, 26 Jun 2024 18:07:56 +0100 Subject: [PATCH] Small bits of cleanup Build system: - Switch to our new maven server. This has a cleaner separation between published packages and mirrored packages, to avoid leaking those into other people's builds. - Update Gradle and Loom versions. Code: - Link to definitions instead in the breaking changes page. - Fix several unused variable warnings. Other: - Remove unsupported Minecraft versions from the issue template. --- .github/ISSUE_TEMPLATE/bug_report.yaml | 5 +---- README.md | 2 +- buildSrc/build.gradle.kts | 2 +- .../kotlin/cc-tweaked.java-convention.gradle.kts | 6 +++--- .../main/kotlin/cc-tweaked.publishing.gradle.kts | 2 +- doc/reference/breaking_changes.md | 16 ++++++++-------- gradle/libs.versions.toml | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 2 +- .../computer/computerthread/ComputerThread.java | 3 +++ .../main/java/cc/tweaked/standalone/Main.java | 12 ++++++------ settings.gradle.kts | 2 +- 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 5e8163931..4e02c95c3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -8,10 +8,7 @@ body: label: Minecraft Version description: What version of Minecraft are you using? options: - - 1.16.x - - 1.18.x - - 1.19.x - - 1.20.x + - 1.20.1 - 1.21.x validations: required: true diff --git a/README.md b/README.md index bebcba142..df34d9280 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ on is present. ```groovy repositories { maven { - url "https://squiddev.cc/maven/" + url "https://maven.squiddev.cc" content { includeGroup("cc.tweaked") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index fc045e0db..f95a9c1d5 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -36,7 +36,7 @@ repositories { } } - maven("https://squiddev.cc/maven") { + maven("https://maven.squiddev.cc") { name = "SquidDev" content { includeGroup("cc.tweaked.vanilla-extract") diff --git a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts index e5c26619d..4eddc8da1 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts @@ -38,7 +38,7 @@ java { repositories { mavenCentral() - val mainMaven = maven("https://squiddev.cc/maven") { + val mainMaven = maven("https://maven.squiddev.cc/mirror") { name = "SquidDev" } @@ -133,8 +133,8 @@ tasks.processResources { tasks.withType(AbstractArchiveTask::class.java).configureEach { isPreserveFileTimestamps = false isReproducibleFileOrder = true - dirMode = Integer.valueOf("755", 8) - fileMode = Integer.valueOf("664", 8) + filePermissions {} + dirPermissions {} } tasks.jar { diff --git a/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts b/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts index 08cec53e8..95c5baff6 100644 --- a/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/cc-tweaked.publishing.gradle.kts @@ -38,7 +38,7 @@ publishing { } repositories { - maven("https://squiddev.cc/maven") { + maven("https://maven.squiddev.cc") { name = "SquidDev" credentials(PasswordCredentials::class) diff --git a/doc/reference/breaking_changes.md b/doc/reference/breaking_changes.md index 4d3ef6cbc..5bca4f760 100644 --- a/doc/reference/breaking_changes.md +++ b/doc/reference/breaking_changes.md @@ -25,13 +25,13 @@ as documentation for breaking changes and "gotchas" one should look out for betw - Update to Lua 5.2: - Support for Lua 5.0's pseudo-argument `arg` has been removed. You should always use `...` for varargs. - - Environments are no longer baked into the runtime, and instead use the `_ENV` local or upvalue. `getfenv`/`setfenv` - now only work on Lua functions with an `_ENV` upvalue. `getfenv` will return the global environment when called - with other functions, and `setfenv` will have no effect. - - `load`/`loadstring` defaults to using the global environment (`_G`) rather than the current coroutine's + - Environments are no longer baked into the runtime, and instead use the `_ENV` local or upvalue. [`getfenv`]/[`setfenv`] + now only work on Lua functions with an `_ENV` upvalue. [`getfenv`] will return the global environment when called + with other functions, and [`setfenv`] will have no effect. + - [`load`]/[`loadstring`] defaults to using the global environment (`_G`) rather than the current coroutine's environment. - - Support for dumping functions (`string.dump`) and loading binary chunks has been removed. - - `math.random` now uses Lua 5.4's random number generator. + - Support for dumping functions ([`string.dump`]) and loading binary chunks has been removed. + - [`math.random`] now uses Lua 5.4's random number generator. - File handles, HTTP requests and websockets now always use the original bytes rather than encoding/decoding to UTF-8. @@ -44,7 +44,7 @@ as documentation for breaking changes and "gotchas" one should look out for betw `keys.enter` constant was queued when the key was pressed) - Minecraft 1.13 removed the concept of item damage and block metadata (see ["The Flattening"][flattening]). As a - result `turtle.inspect` no longer provides block metadata, and `turtle.getItemDetail` no longer provides damage. + result [`turtle.inspect`] no longer provides block metadata, and [`turtle.getItemDetail`] no longer provides damage. - Block states (`turtle.inspect().state`) should provide all the same information as block metadata, but in a much more understandable format. @@ -70,7 +70,7 @@ as documentation for breaking changes and "gotchas" one should look out for betw - Unlabelled computers and turtles now keep their ID when broken, meaning that unlabelled computers/items do not stack. ## ComputerCraft 1.80pr1 {#cc-1.80} - - Programs run via `shell.run` are now started in their own isolated environment. This means globals set by programs + - Programs run via [`shell.run`] are now started in their own isolated environment. This means globals set by programs will not be accessible outside of this program. - Programs containing `/` are looked up in the current directory and are no longer looked up on the path. For instance, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 91546e46f..3ab4b08f0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -59,7 +59,7 @@ checkstyle = "10.14.1" curseForgeGradle = "1.0.14" errorProne-core = "2.27.0" errorProne-plugin = "3.1.0" -fabric-loom = "1.6.7" +fabric-loom = "1.7.1" forgeGradle = "6.0.21" githubRelease = "2.5.2" gradleVersions = "0.50.0" @@ -71,7 +71,7 @@ minotaur = "2.+" nullAway = "0.10.25" spotless = "6.23.3" taskTree = "2.1.1" -teavm = "0.10.0-SQUID.4" +teavm = "0.11.0-SQUID.1" vanillaExtract = "0.1.3" versionCatalogUpdate = "0.8.1" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4..a4413138c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a426..b740cf133 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/projects/core/src/main/java/dan200/computercraft/core/computer/computerthread/ComputerThread.java b/projects/core/src/main/java/dan200/computercraft/core/computer/computerthread/ComputerThread.java index 6b109d7be..c35dbf7df 100644 --- a/projects/core/src/main/java/dan200/computercraft/core/computer/computerthread/ComputerThread.java +++ b/projects/core/src/main/java/dan200/computercraft/core/computer/computerthread/ComputerThread.java @@ -5,6 +5,7 @@ package dan200.computercraft.core.computer.computerthread; import com.google.common.annotations.VisibleForTesting; +import com.google.errorprone.annotations.Keep; import dan200.computercraft.core.ComputerContext; import dan200.computercraft.core.Logging; import dan200.computercraft.core.computer.TimeoutState; @@ -774,6 +775,7 @@ public final class ComputerThread implements ComputerScheduler { /** * The current state of this worker. */ + @Keep private volatile ExecutorState $state = ExecutorState.IDLE; /** @@ -784,6 +786,7 @@ public final class ComputerThread implements ComputerScheduler { * {@linkplain #afterWork()} finishes executing, we set this back to null and compute the difference between the * two, updating the {@link Metrics#JAVA_ALLOCATION} metric. */ + @Keep private volatile @Nullable ThreadAllocation $threadAllocation = null; /** diff --git a/projects/standalone/src/main/java/cc/tweaked/standalone/Main.java b/projects/standalone/src/main/java/cc/tweaked/standalone/Main.java index 157ef7e24..35411959f 100644 --- a/projects/standalone/src/main/java/cc/tweaked/standalone/Main.java +++ b/projects/standalone/src/main/java/cc/tweaked/standalone/Main.java @@ -360,13 +360,13 @@ public class Main { // And our VBA var termVertexArray = gl.createVertexArray("Terminal VAO"); - glEnableVertexArrayAttrib(termVertexArray, 0); - glVertexArrayAttribFormat(termVertexArray, 0, 2, GL_FLOAT, false, 0); // Position - glEnableVertexArrayAttrib(termVertexArray, 1); - glVertexArrayAttribFormat(termVertexArray, 1, 2, GL_FLOAT, false, 8); // UV + glEnableVertexArrayAttrib(termVertexArray, ATTRIBUTE_POSITION); + glVertexArrayAttribFormat(termVertexArray, ATTRIBUTE_POSITION, 2, GL_FLOAT, false, 0); // Position + glEnableVertexArrayAttrib(termVertexArray, ATTRIBUTE_UV); + glVertexArrayAttribFormat(termVertexArray, ATTRIBUTE_UV, 2, GL_FLOAT, false, 8); // UV // FIXME: Can we merge this into one call? - glVertexArrayVertexBuffer(termVertexArray, 0, termVertices, 0, 16); - glVertexArrayVertexBuffer(termVertexArray, 1, termVertices, 0, 16); + glVertexArrayVertexBuffer(termVertexArray, ATTRIBUTE_POSITION, termVertices, 0, 16); + glVertexArrayVertexBuffer(termVertexArray, ATTRIBUTE_UV, termVertices, 0, 16); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/settings.gradle.kts b/settings.gradle.kts index 2b5807cc8..cee5ae6c8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -38,7 +38,7 @@ pluginManagement { } } - maven("https://squiddev.cc/maven") { + maven("https://maven.squiddev.cc") { name = "SquidDev" content { includeGroup("cc.tweaked.vanilla-extract")