From fb1eff6e7c24e064c78c85aaee47103bdc2b1c06 Mon Sep 17 00:00:00 2001
From: Matyrobbrt <65940752+Matyrobbrt@users.noreply.github.com>
Date: Fri, 22 Mar 2024 13:21:47 +0200
Subject: [PATCH] Stuff
---
.github/workflows/build-prs.yml | 11 +
.github/workflows/compat-checks.yml | 35 ++
.github/workflows/publish-prs.yml | 2 +-
projects/neoforge/build.gradle | 596 ++++++++++++++--------------
4 files changed, 356 insertions(+), 288 deletions(-)
create mode 100644 .github/workflows/compat-checks.yml
diff --git a/.github/workflows/build-prs.yml b/.github/workflows/build-prs.yml
index 2f45445e36..794a12a44c 100644
--- a/.github/workflows/build-prs.yml
+++ b/.github/workflows/build-prs.yml
@@ -49,5 +49,16 @@ jobs:
arguments: build
cache-read-only: false
+ - name: Run JCC
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: checkJarCompatibility
+ cache-read-only: false
+
- name: Publish artifacts
uses: neoforged/action-pr-publishing/upload@v1
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: jcc
+ path: jcc.json
\ No newline at end of file
diff --git a/.github/workflows/compat-checks.yml b/.github/workflows/compat-checks.yml
new file mode 100644
index 0000000000..32a3e90295
--- /dev/null
+++ b/.github/workflows/compat-checks.yml
@@ -0,0 +1,35 @@
+name: 'Actually run PR compat checks'
+
+on:
+ workflow_run:
+ workflows: [Build PRs]
+ types:
+ - completed
+
+permissions:
+ packages: write
+ actions: write
+ contents: write
+ issues: write
+ checks: write
+ pull-requests: write
+ statuses: read
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Generate an Application repository access token
+ id: gen_repo_token
+ uses: kattecon/gh-app-access-token-gen@v1
+ with:
+ app_id: 750463
+ private_key: ${{ secrets.PR_PUBLISHING_APP_KEY }}
+ repository: forgeforce/gradle-actions-test
+ - name: Check PR compat
+ uses: ForgeForce/action-jar-compatibility@main
+ with:
+ self-name: 'forgeforce-pr-publishing[bot]'
+ beta-version-pattern: 30.+
+ env:
+ GITHUB_TOKEN: ${{ steps.gen_repo_token.outputs.token }}
\ No newline at end of file
diff --git a/.github/workflows/publish-prs.yml b/.github/workflows/publish-prs.yml
index 6ce4793b95..6444d279ca 100644
--- a/.github/workflows/publish-prs.yml
+++ b/.github/workflows/publish-prs.yml
@@ -20,7 +20,7 @@ permissions:
jobs:
publish-prs:
- if: true
+ if: false
uses: neoforged/actions/.github/workflows/publish-prs.yml@main
with:
artifact_base_path: net/neoforged/neoforge/|net/neoforged/testframework/
diff --git a/projects/neoforge/build.gradle b/projects/neoforge/build.gradle
index 5ce6f2106e..57a8625be9 100644
--- a/projects/neoforge/build.gradle
+++ b/projects/neoforge/build.gradle
@@ -1,287 +1,309 @@
-plugins {
- id 'java-library'
- id 'maven-publish'
-}
-
-rootProject.gradleutils.setupSigning(project: project, signAllPublications: true)
-
-dynamicProject {
- runtime("${project.minecraft_version}-${project.neoform_version}",
- rootProject.layout.projectDirectory.dir('patches'),
- rootProject.layout.projectDirectory.dir('rejects'))
-}
-
-installerProfile {
- profile = 'NeoForge'
-}
-
-minecraft {
- accessTransformers {
- file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
- }
-}
-
-sourceSets {
- main {
- java {
- srcDirs rootProject.file('src/main/java')
- }
- resources {
- srcDirs rootProject.file('src/main/resources'), rootProject.file('src/generated/resources')
- }
- }
-}
-
-dependencies {
- runtimeOnly "cpw.mods:bootstraplauncher:${project.bootstraplauncher_version}"
-
- moduleOnly "cpw.mods:securejarhandler:${project.securejarhandler_version}"
- moduleOnly "org.ow2.asm:asm:${project.asm_version}"
- moduleOnly "org.ow2.asm:asm-commons:${project.asm_version}"
- moduleOnly "org.ow2.asm:asm-tree:${project.asm_version}"
- moduleOnly "org.ow2.asm:asm-util:${project.asm_version}"
- moduleOnly "org.ow2.asm:asm-analysis:${project.asm_version}"
- moduleOnly "cpw.mods:bootstraplauncher:${project.bootstraplauncher_version}"
- moduleOnly "net.neoforged:JarJarFileSystems:${project.jarjar_version}"
-
- installer ("net.neoforged.fancymodloader:loader:${project.fancy_mod_loader_version}") {
- exclude group: 'org.slf4j'
- exclude group: 'net.fabricmc'
- }
- installer ("net.neoforged.fancymodloader:earlydisplay:${project.fancy_mod_loader_version}") {
- exclude group: 'org.lwjgl'
- exclude group: 'org.slf4j'
- exclude group: 'net.fabricmc'
- }
- installer "cpw.mods:securejarhandler:${project.securejarhandler_version}"
- installer "org.ow2.asm:asm:${project.asm_version}"
- installer "org.ow2.asm:asm-commons:${project.asm_version}"
- installer "org.ow2.asm:asm-tree:${project.asm_version}"
- installer "org.ow2.asm:asm-util:${project.asm_version}"
- installer "org.ow2.asm:asm-analysis:${project.asm_version}"
- installer "net.neoforged:accesstransformers:${project.accesstransformers_version}"
- installer "net.neoforged:bus:${project.eventbus_version}"
- installer "net.neoforged.fancymodloader:spi:${project.fancy_mod_loader_version}"
- installer "net.neoforged:coremods:${project.coremods_version}"
- installer "cpw.mods:modlauncher:${project.modlauncher_version}"
- installer "net.minecraftforge:unsafe:${project.unsafe_version}"
- installer "net.neoforged:mergetool:${project.mergetool_version}:api"
- installer "com.electronwill.night-config:core:${project.nightconfig_version}"
- installer "com.electronwill.night-config:toml:${project.nightconfig_version}"
- installer "org.apache.maven:maven-artifact:${project.apache_maven_artifact_version}"
- installer "net.jodah:typetools:${project.typetools_version}"
- installer "net.minecrell:terminalconsoleappender:${project.terminalconsoleappender_version}"
- installer("net.fabricmc:sponge-mixin:${project.mixin_version}") { transitive = false }
- installer "org.openjdk.nashorn:nashorn-core:${project.nashorn_core_version}"
- installer ("net.neoforged:JarJarSelector:${project.jarjar_version}") {
- exclude group: 'org.slf4j'
- }
- // We depend on apache commons directly as there is a difference between the version the server uses and the one the client does
- installer "org.apache.commons:commons-lang3:${project.apache_commons_lang3_version}"
- installer ("net.neoforged:JarJarMetadata:${project.jarjar_version}") {
- exclude group: 'org.slf4j'
- }
-
- compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
-
- userdevCompileOnly jarJar("io.github.llamalad7:mixinextras-neoforge:${project.mixin_extras_version}"), {
- jarJar.ranged(it, "[${project.mixin_extras_version},)")
- }
-}
-
-runTypes {
- client {
- singleInstance false
- client true
-
- arguments.addAll '--fml.neoForgeVersion', project.version
- arguments.addAll '--fml.fmlVersion', project.fancy_mod_loader_version
- arguments.addAll '--fml.mcVersion', project.minecraft_version
- arguments.addAll '--fml.neoFormVersion', project.neoform_version
- }
-
- server {
- server true
-
- arguments.addAll '--fml.neoForgeVersion', project.version
- arguments.addAll '--fml.fmlVersion', project.fancy_mod_loader_version
- arguments.addAll '--fml.mcVersion', project.minecraft_version
- arguments.addAll '--fml.neoFormVersion', project.neoform_version
- }
-
- gameTestServer {
- from project.runTypes.server
-
- gameTest true
- }
-
- gameTestClient {
- from project.runTypes.client
-
- gameTest true
- }
-
- data {
- dataGenerator true
-
- // Don't set modid here so we can reuse this runType for test datagen
- arguments.addAll '--fml.neoForgeVersion', project.version
- arguments.addAll '--fml.fmlVersion', project.fancy_mod_loader_version
- arguments.addAll '--fml.mcVersion', project.minecraft_version
- arguments.addAll '--fml.neoFormVersion', project.neoform_version
- }
-}
-
-runs {
- client { }
- server { }
- gameTestServer { }
- gameTestClient { }
- "Data" {
- configure project.runTypes.data
-
- programArguments.addAll '--mod', 'neoforge'
-
- modSources.add project.sourceSets.main
-
- idea {
- primarySourceSet project.sourceSets.main
- }
- }
-}
-
-runs.configureEach { it ->
- final File gameDir = project.file("run/${it.name}") as File
- gameDir.mkdirs();
-
- it.workingDirectory.set gameDir
- it.programArguments.addAll '--gameDir', gameDir.absolutePath
-}
-
-launcherProfile {
- arguments {
- game '--fml.neoForgeVersion'
- game project.version
- game '--fml.fmlVersion'
- game project.fancy_mod_loader_version
- game '--fml.mcVersion'
- game project.minecraft_version
- game '--fml.neoFormVersion'
- game project.neoform_version
- }
-}
-
-userdevProfile {
- runTypes.configureEach {
- argument '--fml.neoForgeVersion'
- argument project.version
- argument '--fml.fmlVersion'
- argument project.fancy_mod_loader_version
- argument '--fml.mcVersion'
- argument project.minecraft_version
- argument '--fml.neoFormVersion'
- argument project.neoform_version
- }
-}
-
-tasks.withType(Javadoc.class).configureEach {
- options.tags = [
- 'apiNote:a:API Note:',
- 'implSpec:a:Implementation Requirements:',
- 'implNote:a:Implementation Note:'
- ]
- options.addStringOption('Xdoclint:all,-missing', '-public')
-}
-
-tasks.withType(GenerateModuleMetadata).configureEach { enabled = false }
-
-configurations {
- forValidation {
- canBeConsumed = true
- canBeResolved = false
- attributes {
- attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
- attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
- attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
- attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
- }
-
- extendsFrom api, runtimeOnly
- }
-}
-
-artifacts {
- forValidation(jar.archiveFile) {
- builtBy(jar)
- }
-}
-
-minecraft {
- modIdentifier 'minecraft'
-}
-
-publishing {
- publications.create('NeoForge', MavenPublication) {
- groupId = project.group
- artifactId = project.name
- version = project.version
-
- from components.java
-
- artifacts = []
-
- afterEvaluate {
- artifact (signUniversalJar.output) {
- classifier 'universal'
- }
- artifact (signInstallerJar.output) {
- classifier 'installer'
- }
- artifact (userdevJar) {
- classifier 'userdev'
- }
- artifact (sourcesJar) {
- classifier 'sources'
- }
- }
-
- changelog.publish(it)
-
- versionMapping {
- usage('java-api') {
- fromResolutionOf('runtimeClasspath')
- }
- usage('java-runtime') {
- fromResolutionResult()
- }
- }
-
- pom {
- name = project.name
- description = 'Modifactions to Minecraft to enable mod developers.'
- url = 'https://github.com/NeoForged/NeoForge'
-
- scm {
- url = 'https://github.com/NeoForged/NeoForge'
- connection = 'scm:git:git://github.com/NeoForged/NeoForge.git'
- developerConnection = 'scm:git:git@github.com:NeoForged/NeoForge.git'
- }
-
- issueManagement {
- system = 'github'
- url = 'https://github.com/NeoForged/NeoForge/issues'
- }
-
- licenses {
- license {
- name = 'LGPL 2.1'
- url = 'https://github.com/NeoForged/NeoForge/blob/1.13-pre/LICENSE.txt'
- distribution = 'repo'
- }
- }
- }
- }
- repositories {
- maven rootProject.gradleutils.getPublishingMaven()
- }
-}
+import net.neoforged.jarcompatibilitychecker.gradle.JCCPlugin
+
+import java.util.concurrent.Callable
+
+plugins {
+ id 'java-library'
+ id 'maven-publish'
+ id 'net.neoforged.jarcompatibilitychecker' version '0.1.1'
+}
+
+rootProject.gradleutils.setupSigning(project: project, signAllPublications: true)
+
+dynamicProject {
+ runtime("${project.minecraft_version}-${project.neoform_version}",
+ rootProject.layout.projectDirectory.dir('patches'),
+ rootProject.layout.projectDirectory.dir('rejects'))
+}
+
+final checkVersion = JCCPlugin.providePreviousVersion(
+ project.providers, project.providers.provider({['https://maven.neoforged.net/releases']}), project.providers.provider({'net.neoforged:neoforge'} as Callable)
+)
+final createCompatJar = tasks.register('createCompatibilityCheckJar', net.neoforged.jarcompatibilitychecker.gradle.ProvideNeoForgeJarTask) {
+ // Use the same jar that the patches were generated against
+ cleanJar.set(tasks.generateClientBinaryPatches.clean)
+ maven.set('https://maven.neoforged.net/releases')
+ artifact.set('net.neoforged:neoforge')
+ version.set(checkVersion)
+ javaLauncher = javaToolchains.launcherFor {
+ languageVersion = JavaLanguageVersion.of(java_version)
+ }
+}
+checkJarCompatibility {
+ baseJar = createCompatJar.flatMap { it.output }
+}
+
+installerProfile {
+ profile = 'NeoForge'
+}
+
+minecraft {
+ accessTransformers {
+ file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
+ }
+}
+
+sourceSets {
+ main {
+ java {
+ srcDirs rootProject.file('src/main/java')
+ }
+ resources {
+ srcDirs rootProject.file('src/main/resources'), rootProject.file('src/generated/resources')
+ }
+ }
+}
+
+dependencies {
+ runtimeOnly "cpw.mods:bootstraplauncher:${project.bootstraplauncher_version}"
+
+ moduleOnly "cpw.mods:securejarhandler:${project.securejarhandler_version}"
+ moduleOnly "org.ow2.asm:asm:${project.asm_version}"
+ moduleOnly "org.ow2.asm:asm-commons:${project.asm_version}"
+ moduleOnly "org.ow2.asm:asm-tree:${project.asm_version}"
+ moduleOnly "org.ow2.asm:asm-util:${project.asm_version}"
+ moduleOnly "org.ow2.asm:asm-analysis:${project.asm_version}"
+ moduleOnly "cpw.mods:bootstraplauncher:${project.bootstraplauncher_version}"
+ moduleOnly "net.neoforged:JarJarFileSystems:${project.jarjar_version}"
+
+ installer ("net.neoforged.fancymodloader:loader:${project.fancy_mod_loader_version}") {
+ exclude group: 'org.slf4j'
+ exclude group: 'net.fabricmc'
+ }
+ installer ("net.neoforged.fancymodloader:earlydisplay:${project.fancy_mod_loader_version}") {
+ exclude group: 'org.lwjgl'
+ exclude group: 'org.slf4j'
+ exclude group: 'net.fabricmc'
+ }
+ installer "cpw.mods:securejarhandler:${project.securejarhandler_version}"
+ installer "org.ow2.asm:asm:${project.asm_version}"
+ installer "org.ow2.asm:asm-commons:${project.asm_version}"
+ installer "org.ow2.asm:asm-tree:${project.asm_version}"
+ installer "org.ow2.asm:asm-util:${project.asm_version}"
+ installer "org.ow2.asm:asm-analysis:${project.asm_version}"
+ installer "net.neoforged:accesstransformers:${project.accesstransformers_version}"
+ installer "net.neoforged:bus:${project.eventbus_version}"
+ installer "net.neoforged.fancymodloader:spi:${project.fancy_mod_loader_version}"
+ installer "net.neoforged:coremods:${project.coremods_version}"
+ installer "cpw.mods:modlauncher:${project.modlauncher_version}"
+ installer "net.minecraftforge:unsafe:${project.unsafe_version}"
+ installer "net.neoforged:mergetool:${project.mergetool_version}:api"
+ installer "com.electronwill.night-config:core:${project.nightconfig_version}"
+ installer "com.electronwill.night-config:toml:${project.nightconfig_version}"
+ installer "org.apache.maven:maven-artifact:${project.apache_maven_artifact_version}"
+ installer "net.jodah:typetools:${project.typetools_version}"
+ installer "net.minecrell:terminalconsoleappender:${project.terminalconsoleappender_version}"
+ installer("net.fabricmc:sponge-mixin:${project.mixin_version}") { transitive = false }
+ installer "org.openjdk.nashorn:nashorn-core:${project.nashorn_core_version}"
+ installer ("net.neoforged:JarJarSelector:${project.jarjar_version}") {
+ exclude group: 'org.slf4j'
+ }
+ // We depend on apache commons directly as there is a difference between the version the server uses and the one the client does
+ installer "org.apache.commons:commons-lang3:${project.apache_commons_lang3_version}"
+ installer ("net.neoforged:JarJarMetadata:${project.jarjar_version}") {
+ exclude group: 'org.slf4j'
+ }
+
+ compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
+
+ userdevCompileOnly jarJar("io.github.llamalad7:mixinextras-neoforge:${project.mixin_extras_version}"), {
+ jarJar.ranged(it, "[${project.mixin_extras_version},)")
+ }
+}
+
+runTypes {
+ client {
+ singleInstance false
+ client true
+
+ arguments.addAll '--fml.neoForgeVersion', project.version
+ arguments.addAll '--fml.fmlVersion', project.fancy_mod_loader_version
+ arguments.addAll '--fml.mcVersion', project.minecraft_version
+ arguments.addAll '--fml.neoFormVersion', project.neoform_version
+ }
+
+ server {
+ server true
+
+ arguments.addAll '--fml.neoForgeVersion', project.version
+ arguments.addAll '--fml.fmlVersion', project.fancy_mod_loader_version
+ arguments.addAll '--fml.mcVersion', project.minecraft_version
+ arguments.addAll '--fml.neoFormVersion', project.neoform_version
+ }
+
+ gameTestServer {
+ from project.runTypes.server
+
+ gameTest true
+ }
+
+ gameTestClient {
+ from project.runTypes.client
+
+ gameTest true
+ }
+
+ data {
+ dataGenerator true
+
+ // Don't set modid here so we can reuse this runType for test datagen
+ arguments.addAll '--fml.neoForgeVersion', project.version
+ arguments.addAll '--fml.fmlVersion', project.fancy_mod_loader_version
+ arguments.addAll '--fml.mcVersion', project.minecraft_version
+ arguments.addAll '--fml.neoFormVersion', project.neoform_version
+ }
+}
+
+runs {
+ client { }
+ server { }
+ gameTestServer { }
+ gameTestClient { }
+ "Data" {
+ configure project.runTypes.data
+
+ programArguments.addAll '--mod', 'neoforge'
+
+ modSources.add project.sourceSets.main
+
+ idea {
+ primarySourceSet project.sourceSets.main
+ }
+ }
+}
+
+runs.configureEach { it ->
+ final File gameDir = project.file("run/${it.name}") as File
+ gameDir.mkdirs();
+
+ it.workingDirectory.set gameDir
+ it.programArguments.addAll '--gameDir', gameDir.absolutePath
+}
+
+launcherProfile {
+ arguments {
+ game '--fml.neoForgeVersion'
+ game project.version
+ game '--fml.fmlVersion'
+ game project.fancy_mod_loader_version
+ game '--fml.mcVersion'
+ game project.minecraft_version
+ game '--fml.neoFormVersion'
+ game project.neoform_version
+ }
+}
+
+userdevProfile {
+ runTypes.configureEach {
+ argument '--fml.neoForgeVersion'
+ argument project.version
+ argument '--fml.fmlVersion'
+ argument project.fancy_mod_loader_version
+ argument '--fml.mcVersion'
+ argument project.minecraft_version
+ argument '--fml.neoFormVersion'
+ argument project.neoform_version
+ }
+}
+
+tasks.withType(Javadoc.class).configureEach {
+ options.tags = [
+ 'apiNote:a:API Note:',
+ 'implSpec:a:Implementation Requirements:',
+ 'implNote:a:Implementation Note:'
+ ]
+ options.addStringOption('Xdoclint:all,-missing', '-public')
+}
+
+tasks.withType(GenerateModuleMetadata).configureEach { enabled = false }
+
+configurations {
+ forValidation {
+ canBeConsumed = true
+ canBeResolved = false
+ attributes {
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
+ attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
+ attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
+ attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
+ }
+
+ extendsFrom api, runtimeOnly
+ }
+}
+
+artifacts {
+ forValidation(jar.archiveFile) {
+ builtBy(jar)
+ }
+}
+
+minecraft {
+ modIdentifier 'minecraft'
+}
+
+publishing {
+ publications.create('NeoForge', MavenPublication) {
+ groupId = project.group
+ artifactId = project.name
+ version = project.version
+
+ from components.java
+
+ artifacts = []
+
+ afterEvaluate {
+ artifact (signUniversalJar.output) {
+ classifier 'universal'
+ }
+ artifact (signInstallerJar.output) {
+ classifier 'installer'
+ }
+ artifact (userdevJar) {
+ classifier 'userdev'
+ }
+ artifact (sourcesJar) {
+ classifier 'sources'
+ }
+ }
+
+ changelog.publish(it)
+
+ versionMapping {
+ usage('java-api') {
+ fromResolutionOf('runtimeClasspath')
+ }
+ usage('java-runtime') {
+ fromResolutionResult()
+ }
+ }
+
+ pom {
+ name = project.name
+ description = 'Modifactions to Minecraft to enable mod developers.'
+ url = 'https://github.com/NeoForged/NeoForge'
+
+ scm {
+ url = 'https://github.com/NeoForged/NeoForge'
+ connection = 'scm:git:git://github.com/NeoForged/NeoForge.git'
+ developerConnection = 'scm:git:git@github.com:NeoForged/NeoForge.git'
+ }
+
+ issueManagement {
+ system = 'github'
+ url = 'https://github.com/NeoForged/NeoForge/issues'
+ }
+
+ licenses {
+ license {
+ name = 'LGPL 2.1'
+ url = 'https://github.com/NeoForged/NeoForge/blob/1.13-pre/LICENSE.txt'
+ distribution = 'repo'
+ }
+ }
+ }
+ }
+ repositories {
+ maven rootProject.gradleutils.getPublishingMaven()
+ }
+}