Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open container from type & some fixes #4010

Open
wants to merge 10 commits into
base: api-11
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/api-11' into api-11-container
MrHell228 committed Sep 13, 2024
commit 32c79032f8ee199a763dfba0536568bd6e9d8fe2
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4

[*mixins*.json]
indent_size = 4
2 changes: 1 addition & 1 deletion .github/workflows/check-spotless.yaml
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@ jobs:
call-check:
uses: SpongePowered/.github/.github/workflows/shared-check-spotless.yaml@master
with:
runtime_version: 17
runtime_version: 21
extra_gradle_params: "-PenableTestPlugins=true -PenableSpongeForge=true"
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/common-integration-test.yaml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
java: [17, 21]
java: [ 21 ]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository to use the build.gradle.kts as a hash file
2 changes: 1 addition & 1 deletion .github/workflows/common-run-build.yaml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
id: setup
uses: SpongePowered/.github/.github/actions/setup-java-env@master
with:
runtime_version: 17
runtime_version: 21
publishing_branch_regex: 'api-\d+'
- name: setup / cache minecraft dependencies
uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ jobs:
id: setup
uses: SpongePowered/.github/.github/actions/setup-java-env@master
with:
runtime_version: 17
runtime_version: 21
- name: setup / minecraft cache
uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2
with:
@@ -44,8 +44,8 @@ jobs:
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Publish to Sponge Maven & GitHub Packages
# run: ./gradlew -s -PenableSpongeForge=true :publish :SpongeVanilla:publish :SpongeForge:publish
run: ./gradlew -s -PenableSpongeForge=true :publish :SpongeVanilla:publish
run: ./gradlew -s -PenableSpongeForge=true :publish :SpongeVanilla:publish :SpongeForge:publish
# run: ./gradlew -s -PenableSpongeForge=true :publish :SpongeVanilla:publish
env:
CI_SYSTEM: Github Actions
GITHUB_USERNAME: "${{ github.actor }}"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sponge ![Java CI with Gradle](https://github.com/SpongePowered/Sponge/workflows/Java%20CI%20with%20Gradle/badge.svg?branch=api-8&event=push)
Sponge ![Java CI with Gradle](https://github.com/SpongePowered/Sponge/workflows/Java%20CI%20with%20Gradle/badge.svg?branch=api-11&event=push)
=============

The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms. It is licensed under the [MIT License].
@@ -25,7 +25,7 @@ The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms


## Prerequisites
* [Java] 8
* [Java] 21

## Clone
The following steps will ensure your project is cloned properly.
23 changes: 7 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -133,19 +133,6 @@ val mixins by sourceSets.registering {
}
}

sourceSets.configureEach {
val sourceSet = this
val isMain = "main".equals(sourceSet.name)

val sourcesJarName: String = if (isMain) "sourcesJar" else (sourceSet.name + "SourcesJar")
tasks.register(sourcesJarName, Jar::class.java) {
group = "build"
val classifier = if (isMain) "sources" else (sourceSet.name + "-sources")
archiveClassifier.set(classifier)
from(sourceSet.allJava)
}
}

dependencies {
// api
api("org.spongepowered:spongeapi:$apiVersion")
@@ -364,16 +351,20 @@ allprojects {
}
}
}

sourceSets.configureEach {
val sourceSet = this
val sourceJarName: String = if ("main" == this.name) "sourceJar" else "${this.name}SourceJar"
tasks.register(sourceJarName, Jar::class.java) {
val isMain = "main" == sourceSet.name

val sourcesJarName: String = if (isMain) "sourcesJar" else (sourceSet.name + "SourcesJar")
tasks.register(sourcesJarName, Jar::class.java) {
group = "build"
val classifier = if ("main" == sourceSet.name) "sources" else "${sourceSet.name}sources"
val classifier = if (isMain) "sources" else (sourceSet.name + "-sources")
archiveClassifier.set(classifier)
from(sourceSet.allJava)
}
}

afterEvaluate {
publishing {
repositories {
127 changes: 55 additions & 72 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.api.LoomGradleExtensionAPI
import net.fabricmc.loom.task.RemapJarTask
import org.gradle.configurationcache.extensions.capitalized

buildscript {
repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://repo.spongepowered.org/repository/maven-public") {
name = "sponge"
}
@@ -17,7 +14,7 @@ plugins {
alias(libs.plugins.shadow)
id("implementation-structure")
alias(libs.plugins.blossom)
id("net.smoofyuniverse.loom") version "1.1-SNAPSHOT"
id("dev.architectury.loom") version "1.6.411"
}

val commonProject = parent!!
@@ -69,7 +66,7 @@ val gameLayerConfig: NamedDomainObjectProvider<Configuration> = configurations.r
extendsFrom(gameLibrariesConfig.get())

afterEvaluate {
extendsFrom(configurations.getByName("minecraftNamed"))
extendsFrom(configurations.getByName("minecraftNamedCompile"))
}
}

@@ -146,33 +143,10 @@ configurations.configureEach {
if (name != "minecraft") { // awful terrible hack sssh
exclude(group = "com.mojang", module = "minecraft")
}
}

sourceSets.configureEach {
val sourceSet = this
val isMain = "main".equals(sourceSet.name)
val classifier = if (isMain) "sources" else (sourceSet.name + "-sources")

val sourcesJarName: String = if (isMain) "sourcesJar" else (sourceSet.name + "SourcesJar")
val sourcesJarTask = tasks.register(sourcesJarName, Jar::class) {
group = "build"
archiveClassifier.set(classifier + "-dev")
from(sourceSet.allJava)
}

val remapSourcesJarName = "remap" + sourcesJarName.capitalized()

// remapSourcesJar is already registered (but disabled) by Loom
if (!isMain) {
tasks.register(remapSourcesJarName, net.fabricmc.loom.task.RemapSourcesJarTask::class)
}

tasks.named(remapSourcesJarName, net.fabricmc.loom.task.RemapSourcesJarTask::class) {
group = "loom"
archiveClassifier.set(classifier)
inputFile.set(sourcesJarTask.flatMap { it.archiveFile })
dependsOn(sourcesJarTask)
enabled = true
// Fix that can be found in Forge MDK too
resolutionStrategy {
force("net.sf.jopt-simple:jopt-simple:5.0.4")
}
}

@@ -184,6 +158,10 @@ extensions.configure(LoomGradleExtensionAPI::class) {
useLegacyMixinAp.set(false)
}

forge {
useCustomMixin.set(false)
}

mods {
named("main") {
sourceSet(forgeMixins)
@@ -199,6 +177,11 @@ extensions.configure(LoomGradleExtensionAPI::class) {
configuration(gameShadedLibrariesConfig.get())
}
}

// Arch-loom bug, skip broken union-relauncher
runs.forEach {
it.mainClass.set("net.minecraftforge.bootstrap.ForgeBootstrap")
}
}

dependencies {
@@ -256,11 +239,8 @@ dependencies {
}

val runTaskOnly = runTaskOnlyConfig.name
testPluginsProject?.also {
runTaskOnly(project(it.path)) {
exclude(group = "org.spongepowered")
}
}
// Arch-loom bug, fix support of MOD_CLASSES
runTaskOnly("net.minecraftforge:bootstrap-dev:2.1.1")
}

val forgeManifest = java.manifest {
@@ -282,9 +262,6 @@ val mixinConfigs: MutableSet<String> = spongeImpl.mixinConfigurations
tasks {
jar {
manifest.from(forgeManifest)

// Undo Loom devlibs dir
destinationDirectory.set(project.buildDir.resolve("libs"))
}
val forgeAppLaunchJar by registering(Jar::class) {
archiveClassifier.set("applaunch")
@@ -316,7 +293,7 @@ tasks {
}

val forgeServicesDevJar by registering(Jar::class) {
archiveClassifier.set("services-dev")
archiveClassifier.set("services")
manifest.from(forgeManifest)

from(commonProject.sourceSets.named("applaunch").map { it.output })
@@ -327,14 +304,30 @@ tasks {

afterEvaluate {
withType(net.fabricmc.loom.task.AbstractRunTask::class) {
classpath += files(forgeServicesDevJar, forgeLangJar, runTaskOnlyConfig)
// Default classpath is a mess, we better start a new one from scratch
classpath = files(
configurations.getByName("forgeRuntimeLibrary"),
forgeServicesDevJar, forgeLangJar, runTaskOnlyConfig
)

testPluginsProject?.also {
val testPluginsOutput = it.sourceSets.getByName("main").output
val dirs: MutableList<File> = mutableListOf()
dirs.add(testPluginsOutput.resourcesDir!!)
dirs.addAll(testPluginsOutput.classesDirs)
environment["SPONGE_PLUGINS"] = dirs.joinToString("&")

dependsOn(it.tasks.classes)
}

argumentProviders += CommandLineArgumentProvider {
mixinConfigs.asSequence()
.flatMap { sequenceOf("--mixin.config", it) }
.toList()
}

// jvmArguments.add("-Dbsl.debug=true") // Uncomment to debug bootstrap classpath

sourceSets.forEach {
dependsOn(it.classesTaskName)
}
@@ -378,13 +371,14 @@ tasks {

shadowJar {
group = "shadow"
archiveClassifier.set("mod-dev")
archiveClassifier.set("mod")

mergeServiceFiles()
configurations = listOf(gameShadedLibrariesConfig.get())

manifest {
attributes(
"Access-Widener" to "common.accesswidener",
"Superclass-Transformer" to "common.superclasschange,forge.superclasschange",
"MixinConfigs" to mixinConfigs.joinToString(",")
)
@@ -401,14 +395,6 @@ tasks {
from(forgeMixins.output)
}

val remapShadowJar = register("remapShadowJar", RemapJarTask::class) {
group = "loom"
archiveClassifier.set("mod")

inputFile.set(shadowJar.flatMap { it.archiveFile })
atAccessWideners.add("common.accesswidener")
}

val universalJar = register("universalJar", Jar::class) {
group = "build"
archiveClassifier.set("universal")
@@ -418,7 +404,7 @@ tasks {
from(forgeServicesShadowJar.archiveFile.map { zipTree(it) })

into("jars") {
from(remapShadowJar)
from(shadowJar)
rename("spongeforge-(.*)-mod.jar", "spongeforge-mod.jar")

from(forgeLangJar)
@@ -463,33 +449,28 @@ indraSpotlessLicenser {
property("url", projectUrl)
}

val sourcesJar by tasks.existing
val forgeAppLaunchJar by tasks.existing
val forgeLaunchJar by tasks.existing
val forgeMixinsJar by tasks.existing

publishing {
publications {
register("sponge", MavenPublication::class) {
artifact(tasks.named("remapJar")) {
builtBy(tasks.named("remapJar"))
}
artifact(sourcesJar) {
builtBy(tasks.named("remapSourcesJar"))
}
artifact(tasks.named("remapShadowJar")) {
builtBy(tasks.named("remapShadowJar"))
}
artifact(forgeAppLaunchJar.get())
artifact(forgeLaunchJar.get())
artifact(forgeMixinsJar.get())
artifact(tasks["applaunchSourcesJar"])
artifact(tasks["launchSourcesJar"])
artifact(tasks["mixinsSourcesJar"])
artifact(tasks["universalJar"])

artifact(tasks["jar"])
artifact(tasks["sourcesJar"])

artifact(tasks["forgeMixinsJar"])
artifact(tasks["mixinsSourcesJar"])

artifact(tasks["forgeAccessorsJar"])
artifact(tasks["accessorsSourcesJar"])

artifact(tasks["forgeLaunchJar"])
artifact(tasks["launchSourcesJar"])

artifact(tasks["forgeAppLaunchJar"])
artifact(tasks["applaunchSourcesJar"])

pom {
artifactId = project.name.toLowerCase()
artifactId = project.name.lowercase()
this.name.set(project.name)
this.description.set(project.description)
this.url.set(projectUrl)
@@ -511,6 +492,7 @@ publishing {
}

tasks.register("printConfigsHierarchy") {
group = "debug"
doLast {
configurations.forEach { conf: Configuration ->
val seen = mutableSetOf<Configuration>()
@@ -532,6 +514,7 @@ fun printParents(conf: Configuration, indent: String, seen: MutableSet<Configura
}

tasks.register("printConfigsResolution") {
group = "debug"
doLast {
configurations.forEach { conf: Configuration ->
println()
3 changes: 2 additions & 1 deletion forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ name=SpongeForge
implementation=Forge
description=The SpongeAPI implementation for MinecraftForge

forgeVersion=45.1.19
forgeVersion=50.0.22
loom.platform=forge
fabric.loom.dontRemap=true
mixinConfigs=mixins.spongeforge.accessors.json,mixins.spongeforge.api.json,mixins.spongeforge.inventory.json,mixins.spongeforge.core.json,mixins.spongeforge.tracker.json
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public static IModFileInfo parsePluginMetadata(final IModFile iModFile) {
}

final PluginFileConfigurable config = new PluginFileConfigurable(container);
return new ModFileInfo(modFile, config, List.of());
return new ModFileInfo(modFile, config, (info) -> {}, List.of());
} catch (final Exception e) {
AppLaunch.logger().warn("Could not read metadata for plugin file '{}'", modFile, e);
return null;
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.