Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,38 +119,35 @@ tasks.withType(JavaExec).configureEach { JavaExec runTask ->
if (launchTarget != null) configureForge31Run(runTask, launchTarget)
}

def curseMavenRepository
def orespawnModule = "mmd-orespawn-${project.orespawn_curse_project_id}"
def orespawnVerificationRepository = project.findProperty('orespawnVerificationRepository')
repositories {
minecraft.mavenizer(it)
maven fg.forgeMaven
maven fg.minecraftLibsMaven
mavenCentral()
if (project.hasProperty('orespawnVerificationRepository')) {
maven {
name = 'OreSpawnReleaseVerificationMirror'
url = uri(project.property('orespawnVerificationRepository'))
metadataSources { artifact() }

// The staged CI mirror is the only permitted source for this exact
// OreSpawn module. Without exclusive routing, a transient HTTP error from
// Maven Central aborts resolution before Gradle reaches the verified jar.
exclusiveContent {
forRepository {
maven {
name = orespawnVerificationRepository == null
? 'CurseMaven'
: 'OreSpawnReleaseVerificationMirror'
url = orespawnVerificationRepository == null
? uri('https://www.cursemaven.com')
: uri(orespawnVerificationRepository)
metadataSources { artifact() }
}
}
}
else {
curseMavenRepository = maven {
name = 'CurseMaven'
url = 'https://www.cursemaven.com'
metadataSources { artifact() }
filter {
includeModule('curse.maven', orespawnModule)
}
}
}

// Keep CurseMaven after ForgeGradle's generated repositories. The released
// numeric CurseForge coordinate still resolves normally, while Forge's own
// mapped artifacts remain authoritative for the development environment.
afterEvaluate {
if (curseMavenRepository != null) {
repositories.remove(curseMavenRepository)
repositories.add(curseMavenRepository)
}
}

configurations {
orespawnRelease
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public void buildPublishesOnlyThePreparedRemoteBundle() throws Exception {
assertFalse(build.contains("file:///${project.projectDir}/mcmodsrepo"));
}

@Test
public void stagedOreSpawnDependencyCannotFallThroughToPublicRepositories() throws Exception {
String build = text("build.gradle");
assertTrue(build.contains("exclusiveContent"));
assertTrue(build.contains("forRepository"));
assertTrue(build.contains("includeModule('curse.maven', orespawnModule)"));
assertTrue(build.contains("'OreSpawnReleaseVerificationMirror'"));
}

private static String text(String path) throws Exception {
return new String(Files.readAllBytes(new File(path).toPath()), StandardCharsets.UTF_8)
.replace("\r\n", "\n").replace('\r', '\n');
Expand Down
Loading