Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/api-11' into api-11-cropkey
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHell228 committed Jun 2, 2024
2 parents 8e389dd + 7ee5045 commit 4a0e06b
Show file tree
Hide file tree
Showing 506 changed files with 10,148 additions and 5,694 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-spotless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/common-run-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}"
Expand Down
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].
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ public ConfigurationHolder(final Configuration configuration) {
}

@Input
public Provider<Set<ModuleComponentIdentifier>> getIds() {
public Provider<Set<String>> getIds() {
return this.getArtifacts().map(set -> set.stream()
.map(art -> art.getId().getComponentIdentifier())
.filter(id -> id instanceof ModuleComponentIdentifier)
.map(art -> (ModuleComponentIdentifier) art)
.map(art -> art.getDisplayName())
.collect(Collectors.toSet()));
}

Expand Down
23 changes: 7 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down
123 changes: 51 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"
}
Expand All @@ -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-SNAPSHOT"
}

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

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

Expand Down Expand Up @@ -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")
}
}

Expand All @@ -199,6 +173,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 {
Expand Down Expand Up @@ -256,11 +235,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 {
Expand All @@ -282,9 +258,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")
Expand Down Expand Up @@ -316,7 +289,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 })
Expand All @@ -327,14 +300,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)
}
Expand Down Expand Up @@ -378,13 +367,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(",")
)
Expand All @@ -401,14 +391,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")
Expand All @@ -418,7 +400,7 @@ tasks {
from(forgeServicesShadowJar.archiveFile.map { zipTree(it) })

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

from(forgeLangJar)
Expand Down Expand Up @@ -463,33 +445,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)
Expand All @@ -511,6 +488,7 @@ publishing {
}

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

tasks.register("printConfigsResolution") {
group = "debug"
doLast {
configurations.forEach { conf: Configuration ->
println()
Expand Down
3 changes: 2 additions & 1 deletion forge/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 4a0e06b

Please sign in to comment.