Re-write reprod to support all versions in one tree
This commit is contained in:
@@ -19,53 +19,81 @@ def convertRepoToHttp = { repo ->
|
||||
}
|
||||
}
|
||||
|
||||
def setupDependencySubstitution = { Configuration configuration ->
|
||||
configuration.resolutionStrategy.eachDependency { dep ->
|
||||
def req = dep.requested
|
||||
if (req.group == 'net.minecraftforge.gradle' && req.name == 'ForgeGradle' && req.version == '2.0-SNAPSHOT') {
|
||||
// FG 2.1 works for MC 1.8 as well, as long as only CI builds are performed (fails when applying source patches)
|
||||
dep.useTarget 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
|
||||
}
|
||||
if (req.group == 'de.oceanlabs.mcp' && req.name == 'mcinjector' && req.version == '3.4-SNAPSHOT') {
|
||||
dep.useTarget 'com.github.ModCoderPack:MCInjector:7258466'
|
||||
}
|
||||
if (req.group == 'net.minecraftforge.srg2source' && req.name == 'Srg2Source') {
|
||||
switch (req.version) {
|
||||
case '3.3-SNAPSHOT':
|
||||
// Note: 3.3-SNAPSHOT is actually 5f11e29 but that doesn't build due to broken javadoc
|
||||
dep.useTarget 'com.github.MinecraftForge:Srg2Source:dcad1a6'
|
||||
break
|
||||
case '4.0-SNAPSHOT':
|
||||
dep.useTarget 'com.github.MinecraftForge:Srg2Source:ea4ea62'
|
||||
break
|
||||
default:
|
||||
throw new IllegalStateException("Don't know how to replace Srg2Source version $req.version")
|
||||
}
|
||||
}
|
||||
if (req.group == 'net.minecraftforge' && req.name == 'fernflower' && req.version == '2.0-SNAPSHOT') {
|
||||
dep.useTarget 'com.github.MinecraftForge:FernFlowerLegacy:114aebe'
|
||||
}
|
||||
/* Could theoretically be built by jitpack but that fails for some reason
|
||||
if (req.group == 'net.minecraftforge' && req.name == 'forgeflower' && req.version == '1.0.342-SNAPSHOT') {
|
||||
dep.useTarget 'com.github.MinecraftForge:ForgeFlower:41d2b9e'
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
buildscript {
|
||||
repositories.all convertRepoToHttp
|
||||
def localRepo = rootProject.file('gradle/reprod/deps/repo')
|
||||
if (localRepo.exists()) repositories.maven { url localRepo.getAbsolutePath() }
|
||||
repositories.all convertRepoToHttp
|
||||
configurations.all setupDependencySubstitution
|
||||
}
|
||||
repositories { mavenCentral() } // for ecj
|
||||
repositories.all convertRepoToHttp
|
||||
apply plugin: de.johni0702.gradle.ReproducibleBuildsPlugin, to: project
|
||||
apply plugin: xink.gradle.ecj.EcjPlugin, to: project
|
||||
apply plugin: 'maven', to: project
|
||||
afterEvaluate {
|
||||
if (project.plugins.hasPlugin('java')) {
|
||||
apply plugin: xink.gradle.ecj.EcjPlugin, to: project
|
||||
|
||||
ecj {
|
||||
warn = ['none']
|
||||
ecj {
|
||||
warn = ['none']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def localRepo = rootProject.file('gradle/reprod/deps/repo')
|
||||
if (!localRepo.exists()) {
|
||||
localRepo = rootProject.file('../repo') // building deps
|
||||
}
|
||||
localRepo = localRepo.getAbsolutePath()
|
||||
repositories {
|
||||
maven {
|
||||
url(project.file('gradle/reprod').exists() ? 'gradle/reprod/deps/repo' : '../repo')
|
||||
}
|
||||
maven { url localRepo }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
task createPom {
|
||||
doLast {
|
||||
pom {
|
||||
project {
|
||||
groupId 'reprod'
|
||||
artifactId project.file('.').name
|
||||
version '0'
|
||||
}
|
||||
whenConfigured {
|
||||
dependencies.removeAll { it.artifactId == 'mixin-asm-debug-all' }
|
||||
}
|
||||
}.writeTo("pom.xml")
|
||||
}
|
||||
}
|
||||
if (!project.file('gradle/reprod').exists()) {
|
||||
build.dependsOn createPom
|
||||
}
|
||||
|
||||
reproducibleBuilds {
|
||||
if (project.file('.').name == 'forgegradle') {
|
||||
project.tasks.all {
|
||||
if (it.name == 'jar') {
|
||||
println 'Manually repacking archive after jar task'
|
||||
repackAfter it
|
||||
afterEvaluate {
|
||||
if (project.plugins.hasPlugin('maven')) {
|
||||
uploadArchives {
|
||||
repositories.mavenDeployer {
|
||||
repository url: 'file://localhost/' + localRepo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all setupDependencySubstitution
|
||||
|
||||
project.tasks.all { task ->
|
||||
if (task.name == 'reobfJar') {
|
||||
task.doLast {
|
||||
|
||||
Reference in New Issue
Block a user