Fix Gradle Spigot fallback resolution
This commit is contained in:
1 parent
596f3d5650
commit
673acf2ed6
3 files changed
+77
-19
No files matched your search
@@ -41,8 +41,7 @@ public class PTranslations {
|
||||
if (unformatted == null) {
|
||||
return "unknown translation: " + key;
|
||||
}
|
||||
String formatted = String.format(translations.get(key), replacements);
|
||||
return formatted;
|
||||
return String.format(unformatted, (Object[]) replacements);
|
||||
}
|
||||
|
||||
}
|
||||
+30
-1
@@ -1,7 +1,21 @@
|
||||
import org.gradle.api.artifacts.component.ModuleComponentSelector
|
||||
|
||||
plugins {
|
||||
id("eclipse")
|
||||
}
|
||||
|
||||
val hasBootstrapRepo = System.getProperty("SELF_MAVEN_LOCAL_REPO")
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { custom ->
|
||||
val resolvedPath = if (custom.startsWith("~")) {
|
||||
custom.replaceFirst("^~".toRegex(), System.getProperty("user.home"))
|
||||
} else {
|
||||
custom
|
||||
}
|
||||
file(resolvedPath).isDirectory
|
||||
}
|
||||
?: false
|
||||
|
||||
allprojects {
|
||||
group = "com.ruinscraft"
|
||||
version = "1.9.0"
|
||||
@@ -14,10 +28,25 @@ subprojects {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
if (!hasBootstrapRepo) {
|
||||
configurations.configureEach {
|
||||
resolutionStrategy.dependencySubstitution {
|
||||
all {
|
||||
val requestedModule = requested as? ModuleComponentSelector ?: return@all
|
||||
if (requestedModule.group == "org.spigotmc" && requestedModule.module == "spigot") {
|
||||
useTarget(
|
||||
"org.bukkit:craftbukkit:${requestedModule.version}",
|
||||
"TrueOG Bootstrap is unavailable, so fall back to mirrored CraftBukkit artifacts for server internals."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(layout.buildDirectory)
|
||||
delete("target")
|
||||
}
|
||||
|
||||
+46
-16
@@ -1,25 +1,55 @@
|
||||
val homeMavenRepo = uri("file://${System.getProperty("user.home")}/.m2/repository")
|
||||
val configuredLocalRepo = System.getProperty("SELF_MAVEN_LOCAL_REPO")
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { custom ->
|
||||
val resolvedPath = if (custom.startsWith("~")) {
|
||||
custom.replaceFirst("^~".toRegex(), System.getProperty("user.home"))
|
||||
} else {
|
||||
custom
|
||||
}
|
||||
file(resolvedPath).takeIf { it.isDirectory }
|
||||
}
|
||||
|
||||
fun orgSpigotContentFilter(repository: org.gradle.api.artifacts.repositories.MavenArtifactRepository) {
|
||||
repository.content {
|
||||
includeGroup("org.spigotmc")
|
||||
includeGroup("org.bukkit")
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||
repositories {
|
||||
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
|
||||
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let { custom ->
|
||||
val dir = file(
|
||||
if (custom.startsWith("~")) {
|
||||
custom.replaceFirst("^~".toRegex(), System.getProperty("user.home"))
|
||||
} else {
|
||||
custom
|
||||
}
|
||||
)
|
||||
if (dir.isDirectory) {
|
||||
println("Using SELF_MAVEN_LOCAL_REPO at: $custom")
|
||||
maven { url = uri("file://${dir.absolutePath}") }
|
||||
} else {
|
||||
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "UserLocalMaven"
|
||||
url = homeMavenRepo
|
||||
}
|
||||
|
||||
configuredLocalRepo?.let { dir ->
|
||||
println("Using SELF_MAVEN_LOCAL_REPO at: ${dir.absolutePath}")
|
||||
maven {
|
||||
name = "SelfLocalMaven"
|
||||
url = uri(dir)
|
||||
}
|
||||
} ?: logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
} ?: run {
|
||||
println("TrueOG Bootstrap not found; using public Spigot mirrors alongside ~/.m2 for dependencies.")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
mavenCentral()
|
||||
maven { url = uri("https://mvn.lumine.io/repository/maven-public/") }
|
||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") {
|
||||
name = "SpigotSnapshots"
|
||||
orgSpigotContentFilter(this)
|
||||
}
|
||||
maven("https://repo.loohpjames.com/repository/") {
|
||||
name = "LoohpMirror"
|
||||
orgSpigotContentFilter(this)
|
||||
}
|
||||
maven("https://maven.elmakers.com/repository/") {
|
||||
name = "ElMakersMirror"
|
||||
orgSpigotContentFilter(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user