Files
UniMixins/build.gradle
T
2024-02-14 20:19:18 +01:00

149 lines
3.8 KiB
Groovy

/** The root of the build. Exposed for flexibility, but you shouldn't edit it
unless you have to. Edit project.gradle instead. */
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11'
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0' apply false
}
allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven-publish'
// For some reason this is needed when using Gradle 6.9 (but not if using 4.4.1)
repositories {
mavenCentral()
mavenLocal()
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven/'
}
maven {
url = "https://mvn.falsepattern.com/releases"
}
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
maven {
url 'https://jitpack.io'
}
}
apply from: "${project.rootDir}/buildscript/forge-1.7.gradle"
def projectVersion = version
dependencies {
// TODO only include IFMLLoadingPlugin, Mod and ComparableVersion
compileOnly "net.minecraftforge:forge:1.12.2-14.23.5.2860:universal"
}
// When publishing locally, publish every module and use the -1.7.10 suffix.
// Otherwise (for GTNH maven) only publish the -all module and don't use the suffix or the -all name or the unimixins group.
ext.localPublish = System.getenv("MAVEN_USER") == null;
ext.publishModuleToMaven = project.name == "module-all" || localPublish
ext.mavenIdSuffix = localPublish ? "-1.7.10" : ""
ext.mavenGroupId = localPublish ? project.group : project.group.replace(".unimixins", "")
if(project.name.startsWith("module-") && project.name != "module-mixin" && project.name != "module-common") {
if(project.name != "module-all") {
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
}
afterEvaluate {
if(project.name != "module-all") {
task devJar(type: Jar) {
classifier = 'dev'
def jarTask = (jar.enabled ? jar : shadowJar)
from zipTree(jarTask.getOutputs().getFiles().getSingleFile())
manifest = jarTask.manifest
dependsOn jarTask
}
}
reobf.dependsOn devJar
artifacts {
archives tasks."sourcesJar"
archives tasks."devJar"
}
if(publishModuleToMaven) {
publishing {
publications {
create("maven", MavenPublication) {
artifact jar.enabled ? jar : shadowJar
artifact source: tasks."sourcesJar", classifier: 'sources'
artifact source: tasks."devJar", classifier: 'dev'
artifactId = archivesBaseName.substring(1).replace("-1.7.10", mavenIdSuffix).replace("-all", localPublish ? "-all" : "")
version = projectVersion
groupId = mavenGroupId
}
}
}
}
project.tasks.forEach {
if(it.name.startsWith("publish") && it.name.contains("PublicationTo")) {
it.dependsOn reobf
}
}
}
}
publishing {
repositories {
if (System.getenv("MAVEN_USER") != null) {
maven {
url = System.getenv("MAVEN_URL")
allowInsecureProtocol = System.getenv("MAVEN_URL").startsWith("http://") // Mostly for the GTNH maven
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
}
}
// Put license, credits and readme in jar
delete "$projectDir/build/tmp/license"
copy {
from "$projectDir"
into "$projectDir/build/tmp/license"
include "CREDITS", "LICENSE*", "README*"
}
sourceSets.main.resources.srcDir("build/tmp/license")
}