Skip to content

Commit e54c11d

Browse files
committed
Merge branch 'version/7.3.x'
2 parents 2e0b521 + 7a04939 commit e54c11d

File tree

12 files changed

+257
-96
lines changed

12 files changed

+257
-96
lines changed

build-logic/build.gradle.kts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@ plugins {
33
}
44

55
repositories {
6-
gradlePluginPortal()
76
maven {
8-
name = "EngineHub Repository"
9-
url = uri("https://maven.enginehub.org/repo/")
7+
name = "SpongePowered Snapshots"
8+
url = uri("https://repo.spongepowered.org/repository/maven-snapshots/")
9+
}
10+
maven {
11+
name = "NeoForged"
12+
url = uri("https://maven.neoforged.net/releases/")
1013
}
14+
maven {
15+
name = "MinecraftForge"
16+
url = uri("https://maven.minecraftforge.net/")
17+
}
18+
mavenCentral()
19+
gradlePluginPortal()
1120
}
1221

1322
dependencies {

build-logic/settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
apply(from = "../gradle/shared-scripts/repo-reconfiguration.settings.gradle.kts")
2+
13
dependencyResolutionManagement {
24
versionCatalogs {
35
create("libs") {

build-logic/src/main/kotlin/buildlogic.adapter.gradle.kts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import buildlogic.addEngineHubRepository
12
import buildlogic.stringyLibs
23
import buildlogic.getVersion
34

@@ -8,19 +9,28 @@ plugins {
89
id("io.papermc.paperweight.userdev")
910
}
1011

11-
paperweight {
12-
injectPaperRepository = false
13-
}
14-
1512
repositories {
1613
maven {
17-
name = "EngineHub"
18-
url = uri("https://maven.enginehub.org/repo/")
14+
name = "Minecraft Libraries"
15+
url = uri("https://libraries.minecraft.net/")
1916
}
20-
mavenCentral()
21-
afterEvaluate {
22-
killNonEngineHubRepositories()
17+
maven {
18+
name = "FabricMC"
19+
url = uri("https://maven.fabricmc.net/")
20+
}
21+
maven {
22+
name = "FabricMC (Yarn)"
23+
url = uri("https://maven.fabricmc.net/#yarn-only")
24+
}
25+
maven {
26+
name = "SpongePowered Releases"
27+
url = uri("https://repo.spongepowered.org/repository/maven-releases/")
28+
}
29+
maven {
30+
name = "SpongePowered Snapshots"
31+
url = uri("https://repo.spongepowered.org/repository/maven-snapshots/")
2332
}
33+
addEngineHubRepository()
2434
}
2535

2636
dependencies {

build-logic/src/main/kotlin/buildlogic/GradleExtras.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import org.gradle.api.artifacts.MinimalExternalModuleDependency
55
import org.gradle.api.artifacts.VersionCatalog
66
import org.gradle.api.artifacts.VersionCatalogsExtension
77
import org.gradle.api.artifacts.VersionConstraint
8+
import org.gradle.api.artifacts.dsl.RepositoryHandler
89
import org.gradle.api.plugins.ExtraPropertiesExtension
910
import org.gradle.api.provider.Provider
1011
import org.gradle.kotlin.dsl.getByType
1112
import org.gradle.kotlin.dsl.registerIfAbsent
13+
import java.net.URI
1214

1315
val Project.ext: ExtraPropertiesExtension
1416
get() = extensions.getByType()
@@ -27,3 +29,14 @@ fun VersionCatalog.getLibrary(name: String): Provider<MinimalExternalModuleDepen
2729
fun VersionCatalog.getVersion(name: String): VersionConstraint = findVersion(name).orElseThrow {
2830
error("Version $name not found in version catalog")
2931
}
32+
33+
fun RepositoryHandler.addEngineHubRepository() {
34+
maven {
35+
name = "EngineHub (Non-Mirrored)"
36+
url = URI.create("https://repo.enginehub.org/libs-release/")
37+
metadataSources {
38+
mavenPom()
39+
artifact()
40+
}
41+
}
42+
}

build-logic/src/main/kotlin/repositoriesHelper.kt

Lines changed: 0 additions & 37 deletions
This file was deleted.

gradle.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ org.gradle.jvmargs=-Xmx2000M
55
org.gradle.parallel=true
66
org.gradle.configuration-cache=true
77
org.gradle.configuration-cache.parallel=true
8-
9-
loom_fabric_repository=https://maven.enginehub.org/artifactory/fabricmc/
10-
loom_libraries_base=https://maven.enginehub.org/artifactory/minecraft/
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
// This file is responsible for reconfiguring repositories to use EngineHub's mirrors
2+
// In addition, it configures content filtering to speed up dependency resolution
3+
4+
import org.gradle.api.artifacts.dsl.RepositoryHandler
5+
import org.gradle.api.artifacts.repositories.UrlArtifactRepository
6+
import org.gradle.api.logging.Logging
7+
import java.net.URI
8+
9+
data class RepositoryReconfiguration(
10+
val newUri: URI,
11+
val contentConfiguration: (MavenRepositoryContentDescriptor.() -> Unit)? = null,
12+
) {
13+
constructor(newUri: String, contentConfiguration: (MavenRepositoryContentDescriptor.() -> Unit)? = null) :
14+
this(URI.create(newUri), contentConfiguration)
15+
}
16+
17+
data class ModuleDeclaration(
18+
val group: String,
19+
val name: String,
20+
val version: String? = null,
21+
)
22+
23+
// Isolate everything from the buildscript so it's serializable
24+
object Isolated {
25+
private val ALLOWED_PREFIXES = listOf(
26+
"https://repo.enginehub.org",
27+
"file:",
28+
)
29+
30+
// Until https://github.com/gradle/gradle/issues/31888 is fixed in 9.4.0
31+
// we need to explicitly exclude unique snapshots
32+
private val UNIQUE_SNAPSHOT_MODULES = listOf(
33+
ModuleDeclaration("org.spongepowered", "spongeapi"),
34+
ModuleDeclaration("org.spongepowered", "vanillagradle"),
35+
ModuleDeclaration("me.lucko", "spark-api"),
36+
)
37+
38+
private fun MavenRepositoryContentDescriptor.enhancedReleasesOnly() {
39+
releasesOnly()
40+
UNIQUE_SNAPSHOT_MODULES.forEach {
41+
if (it.version != null) {
42+
excludeVersion(it.group, it.name, it.version)
43+
} else {
44+
excludeModule(it.group, it.name)
45+
}
46+
}
47+
}
48+
49+
private val REPO_RECONFIGURATIONS = listOf(
50+
"https://repo.maven.apache.org/maven2/" to
51+
RepositoryReconfiguration("https://repo.enginehub.org/internal/maven-central-proxy/") {
52+
enhancedReleasesOnly()
53+
},
54+
"https://plugins.gradle.org/m2" to
55+
RepositoryReconfiguration("https://repo.enginehub.org/internal/plugin-portal-proxy/") {
56+
enhancedReleasesOnly()
57+
},
58+
"https://libraries.minecraft.net/" to
59+
RepositoryReconfiguration("https://repo.enginehub.org/internal/minecraft/") {
60+
enhancedReleasesOnly()
61+
},
62+
"https://maven.neoforged.net/releases/" to
63+
RepositoryReconfiguration("https://repo.enginehub.org/internal/neoforged/") {
64+
enhancedReleasesOnly()
65+
includeGroupAndSubgroups("net.minecraftforge")
66+
includeGroupAndSubgroups("net.neoforged")
67+
},
68+
"https://maven.minecraftforge.net/" to
69+
RepositoryReconfiguration("https://repo.enginehub.org/internal/forge/") {
70+
enhancedReleasesOnly()
71+
includeGroupAndSubgroups("net.minecraftforge")
72+
},
73+
"https://maven.parchmentmc.org/" to
74+
RepositoryReconfiguration("https://repo.enginehub.org/internal/parchment/") {
75+
enhancedReleasesOnly()
76+
includeGroup("org.parchmentmc.data")
77+
},
78+
"https://repo.papermc.io/repository/maven-public/" to
79+
RepositoryReconfiguration("https://repo.enginehub.org/internal/papermc-proxy/") {
80+
includeGroupAndSubgroups("io.papermc")
81+
includeGroupAndSubgroups("com.velocitypowered")
82+
includeGroupAndSubgroups("ca.spottedleaf")
83+
includeGroupAndSubgroups("me.lucko")
84+
includeModule("net.md-5", "bungeecord-chat")
85+
},
86+
"https://maven.fabricmc.net/" to
87+
RepositoryReconfiguration("https://repo.enginehub.org/internal/fabricmc/") {
88+
enhancedReleasesOnly()
89+
includeGroupAndSubgroups("fabric-loom")
90+
includeGroupAndSubgroups("net.fabricmc")
91+
excludeModule("net.fabricmc", "yarn")
92+
},
93+
"https://maven.fabricmc.net/#yarn-only" to
94+
RepositoryReconfiguration("https://repo.enginehub.org/internal/fabricmc-yarn/") {
95+
enhancedReleasesOnly()
96+
includeModule("net.fabricmc", "yarn")
97+
},
98+
"https://repo.spongepowered.org/repository/maven-releases/" to
99+
RepositoryReconfiguration("https://repo.enginehub.org/internal/spongepowered-releases/") {
100+
enhancedReleasesOnly()
101+
includeGroupAndSubgroups("org.spongepowered")
102+
},
103+
"https://repo.spongepowered.org/repository/maven-snapshots/" to
104+
RepositoryReconfiguration("https://repo.enginehub.org/internal/spongepowered-snapshots/") {
105+
// Cannot actually call snapshotsOnly() because it excludes unique snapshots right now
106+
includeGroupAndSubgroups("org.spongepowered")
107+
},
108+
"https://repo.enginehub.org/libs-release/" to
109+
RepositoryReconfiguration("https://repo.enginehub.org/libs-release/") {
110+
enhancedReleasesOnly()
111+
includeGroupAndSubgroups("com.sk89q")
112+
includeGroupAndSubgroups("org.enginehub")
113+
},
114+
).associate { (k, v) -> URI.create(k) to v }
115+
private val LOGGER = Logging.getLogger("enginehub-reconfiguring-repositories")
116+
117+
fun RepositoryHandler.mirrorNonEngineHubRepositories() {
118+
configureEach {
119+
val repo = this
120+
if (!(repo is UrlArtifactRepository)) {
121+
return@configureEach
122+
}
123+
val reconfiguration = REPO_RECONFIGURATIONS[repo.url]
124+
val mustReplaceUrl = !ALLOWED_PREFIXES.any { repo.url.toString().startsWith(it) }
125+
if (mustReplaceUrl) {
126+
check(reconfiguration != null) {
127+
"No replacement found for non-EngineHub repository: ${repo.name} ${repo.url}"
128+
}
129+
LOGGER.info(
130+
"Replacing non-EngineHub repository: {} {} -> {}",
131+
repo.name,
132+
repo.url,
133+
reconfiguration.newUri
134+
)
135+
repo.url = reconfiguration.newUri
136+
}
137+
if (reconfiguration?.contentConfiguration != null) {
138+
if (!(repo is MavenArtifactRepository)) {
139+
error("Cannot configure content on non-Maven repository: ${repo.name} ${repo.url}")
140+
}
141+
repo.mavenContent {
142+
reconfiguration.contentConfiguration.invoke(this)
143+
}
144+
}
145+
}
146+
}
147+
}
148+
149+
with(Isolated) {
150+
gradle.lifecycle.beforeProject {
151+
buildscript.repositories.mirrorNonEngineHubRepositories()
152+
repositories.mirrorNonEngineHubRepositories()
153+
}
154+
155+
settings.buildscript.repositories.mirrorNonEngineHubRepositories()
156+
settings.pluginManagement.repositories.mirrorNonEngineHubRepositories()
157+
settings.dependencyResolutionManagement.repositories.mirrorNonEngineHubRepositories()
158+
}

settings.gradle.kts

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
import java.net.URI
2+
3+
apply(from = "gradle/shared-scripts/repo-reconfiguration.settings.gradle.kts")
14
pluginManagement {
25
repositories {
3-
gradlePluginPortal()
46
maven {
5-
name = "EngineHub"
6-
url = uri("https://maven.enginehub.org/repo/")
7+
name = "FabricMC"
8+
url = uri("https://maven.fabricmc.net/")
9+
}
10+
maven {
11+
name = "SpongePowered Snapshots"
12+
url = uri("https://repo.spongepowered.org/repository/maven-snapshots/")
13+
}
14+
maven {
15+
name = "NeoForged"
16+
url = uri("https://maven.neoforged.net/releases/")
17+
}
18+
maven {
19+
name = "MinecraftForge"
20+
url = uri("https://maven.minecraftforge.net/")
721
}
22+
mavenCentral()
23+
gradlePluginPortal()
824
}
925
}
1026
plugins {
@@ -14,8 +30,20 @@ plugins {
1430
dependencyResolutionManagement {
1531
repositories {
1632
maven {
17-
name = "EngineHub"
18-
url = uri("https://maven.enginehub.org/repo/")
33+
name = "ParchmentMC"
34+
url = uri("https://maven.parchmentmc.org/")
35+
}
36+
maven {
37+
name = "PaperMC"
38+
url = uri("https://repo.papermc.io/repository/maven-public/")
39+
}
40+
maven {
41+
name = "EngineHub (Non-Mirrored)"
42+
url = URI.create("https://repo.enginehub.org/libs-release/")
43+
metadataSources {
44+
mavenPom()
45+
artifact()
46+
}
1947
}
2048
ivy {
2149
url = uri("https://repo.enginehub.org/language-files/")
@@ -31,23 +59,6 @@ dependencyResolutionManagement {
3159
includeModuleByRegex(".*", "worldedit-lang")
3260
}
3361
}
34-
gradle.settingsEvaluated {
35-
// Duplicates repositoriesHelper.kt, since we can't import it
36-
val allowedPrefixes = listOf(
37-
"https://maven.enginehub.org",
38-
"https://repo.maven.apache.org/maven2/",
39-
"file:"
40-
)
41-
42-
for (repo in this@repositories) {
43-
if (repo is MavenArtifactRepository) {
44-
val urlString = repo.url.toString()
45-
check(allowedPrefixes.any { urlString.startsWith(it) }) {
46-
"Only EngineHub/Central repositories are allowed: ${repo.url} found"
47-
}
48-
}
49-
}
50-
}
5162
}
5263
}
5364

worldedit-bukkit/adapters/adapter-1.21.4/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ plugins {
55
}
66

77
dependencies {
8-
// https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
9-
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.21.4-R0.1-20250519.180216-226")
8+
// https://artifactory.papermc.io/ui/native/universe/io/papermc/paper/dev-bundle/
9+
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.21.4-R0.1-20250925.065901-228")
1010
}

0 commit comments

Comments
 (0)