Completely eliminate usage of other repos

Probably, I'm not firewalling it to make sure
This commit is contained in:
Octavia Togami 2024-07-17 22:00:26 -07:00 committed by Maddy Miller
parent 9fae6771fd
commit da223671a5
15 changed files with 118 additions and 74 deletions

View File

@ -12,6 +12,21 @@
banSlf4j = false
}
paperweight {
injectPaperRepository = false
}
repositories {
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
}
mavenCentral()
afterEvaluate {
replaceNonEngineHubRepositoriesUrl()
}
}
dependencies {
"implementation"(project(":worldedit-bukkit"))
constraints {

View File

@ -9,14 +9,6 @@
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
}
}
configurations.all {
resolutionStrategy {
cacheChangingModulesFor(1, TimeUnit.DAYS)

View File

@ -0,0 +1,36 @@
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
import org.gradle.api.logging.Logging
import java.net.URI
// The primary point of this is repository up-time. We replace most other repositories with EngineHub's repository.
// This is because we have stronger up-time guarantees for our repository. However, Maven Central and Sonatype are
// clearly even better, so we allow those as well. We also allow Gradle's plugin repository.
private val ALLOWED_PREFIXES = listOf(
"https://maven.enginehub.org",
"https://repo.maven.apache.org/maven2/",
"https://s01.oss.sonatype.org/content/repositories/snapshots/",
"https://plugins.gradle.org",
"file:"
)
private val LOGGER = Logging.getLogger("repositoriesHelper")
fun RepositoryHandler.replaceNonEngineHubRepositoriesUrl() {
for (repo in this) {
if (repo is MavenArtifactRepository && !ALLOWED_PREFIXES.any { repo.url.toString().startsWith(it) }) {
LOGGER.info("Replacing non-EngineHub repository: {}", repo.url)
repo.url = URI.create("https://maven.enginehub.org/repo/")
}
}
}
fun RepositoryHandler.verifyEngineHubRepositories() {
for (repo in this) {
if (repo is MavenArtifactRepository) {
val urlString = repo.url.toString()
check(ALLOWED_PREFIXES.any { urlString.startsWith(it) }) {
"Only EngineHub/Central repositories are allowed: ${repo.url} found"
}
}
}
}

View File

@ -3,3 +3,6 @@ version=7.3.5-SNAPSHOT
org.gradle.jvmargs=-Xmx1500M
org.gradle.parallel=true
loom_fabric_repository=https://maven.enginehub.org/artifactory/fabricmc/
loom_libraries_base=https://maven.enginehub.org/artifactory/minecraft/

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

5
gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

2
gradlew.bat vendored
View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################

View File

@ -5,17 +5,54 @@
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
}
maven {
name = "SpongePowered"
url = uri("https://repo.spongepowered.org/repository/maven-public/")
}
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
id("fabric-loom") version "1.6.12"
}
dependencyResolutionManagement {
repositories {
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
}
ivy {
url = uri("https://repo.enginehub.org/language-files/")
name = "EngineHub Language Files"
patternLayout {
artifact("[organisation]/[module]/[revision]/[artifact]-[revision](+[classifier])(.[ext])")
setM2compatible(true)
}
metadataSources {
artifact()
}
content {
includeModuleByRegex(".*", "worldedit-lang")
}
}
gradle.settingsEvaluated {
// Duplicates repositoriesHelper.kt, since we can't import it
val allowedPrefixes = listOf(
"https://maven.enginehub.org",
"https://repo.maven.apache.org/maven2/",
"file:"
)
for (repo in this@repositories) {
if (repo is MavenArtifactRepository) {
val urlString = repo.url.toString()
check(allowedPrefixes.any { urlString.startsWith(it) }) {
"Only EngineHub/Central repositories are allowed: ${repo.url} found"
}
}
}
}
}
}
logger.lifecycle("""
logger.lifecycle(
"""
*******************************************
You are building WorldEdit!
@ -27,7 +64,8 @@
Output files will be in [subproject]/build/libs
*******************************************
""")
"""
)
rootProject.name = "worldedit"

View File

@ -11,21 +11,6 @@
id("me.champeau.gradle.japicmp")
}
repositories {
maven {
name = "EngineHub Repository (Releases Only)"
url = uri("https://maven.enginehub.org/artifactory/libs-release-local/")
}
maven {
name = "EngineHub Repository (Snapshots Only)"
url = uri("https://maven.enginehub.org/artifactory/libs-snapshot-local/")
content {
excludeGroup("com.sk89q.worldedit")
}
}
mavenCentral()
}
val resetAcceptedApiChangesFiles by tasks.registering {
group = "API Compatibility"
description = "Resets ALL the accepted API changes files"

View File

@ -11,13 +11,6 @@
includeClasspath = true
}
repositories {
maven {
name = "Spigot"
url = uri("https://hub.spigotmc.org/nexus/content/groups/public")
}
}
val localImplementation = configurations.create("localImplementation") {
description = "Dependencies used locally, but provided by the runtime Bukkit implementation"
isCanBeConsumed = false

View File

@ -7,20 +7,6 @@
id("buildlogic.core-and-platform")
}
repositories {
ivy {
url = uri("https://repo.enginehub.org/language-files/")
name = "EngineHub Language Files"
patternLayout {
artifact("[organisation]/[module]/[revision]/[artifact]-[revision](+[classifier])(.[ext])")
setM2compatible(true)
}
metadataSources {
artifact()
}
}
}
configurations {
register("languageFiles")
}

View File

@ -31,14 +31,8 @@
}
repositories {
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
}
getByName("Mojang") {
content {
includeGroupAndSubgroups("com.mojang")
}
afterEvaluate {
verifyEngineHubRepositories()
}
}

View File

@ -27,16 +27,9 @@
}
repositories {
val toRemove = mutableListOf<MavenArtifactRepository>()
for (repo in project.repositories) {
if (repo is MavenArtifactRepository && repo.url.toString() == "https://maven.neoforged.net/releases/") {
toRemove.add(repo)
}
}
toRemove.forEach { remove(it) }
maven {
name = "EngineHub"
url = uri("https://maven.enginehub.org/repo/")
mavenCentral()
afterEvaluate {
replaceNonEngineHubRepositoriesUrl()
}
}
@ -72,6 +65,7 @@
parchment {
minecraftVersion = libs.versions.parchment.minecraft.get()
mappingsVersion = libs.versions.parchment.mappings.get()
addRepository = false
}
decompiler {
maxMemory("3G")

View File

@ -18,14 +18,17 @@
banSlf4j = false
}
repositories {
mavenCentral()
}
minecraft {
version(libs.versions.sponge.minecraft.get())
}
repositories {
mavenCentral()
afterEvaluate {
replaceNonEngineHubRepositoriesUrl()
}
}
sponge {
apiVersion(libs.versions.sponge.api.asProvider().get())
license("GPL-3.0-or-later")