Merge pull request #210 from TerraForged/0.1.x
update script for maven stuff
This commit is contained in:
commit
e5b6153ce7
39
build.gradle
39
build.gradle
@ -14,7 +14,7 @@ apply plugin: "maven-publish"
|
|||||||
apply plugin: "eclipse"
|
apply plugin: "eclipse"
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
group = "com.terraforged"
|
||||||
version = "${mc_version}-${mod_version}${getClassifier()}"
|
version = "${mc_version}-${mod_version}${getClassifier()}"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@ -80,6 +80,7 @@ minecraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
// add resources for the runData task to path
|
||||||
main.resources {
|
main.resources {
|
||||||
srcDirs += "generated/resources/"
|
srcDirs += "generated/resources/"
|
||||||
exclude ".cache"
|
exclude ".cache"
|
||||||
@ -87,34 +88,66 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task collectLibs(type: Copy) {
|
task collectLibs(type: Copy) {
|
||||||
|
// require upstream projects to be jar'd first
|
||||||
dependsOn(dependsOn: subprojects.tasks["jar"])
|
dependsOn(dependsOn: subprojects.tasks["jar"])
|
||||||
|
|
||||||
|
// copy contents to build dir ignoring dupes
|
||||||
from { configurations.lib.collect { it.isDirectory() ? it : zipTree(it) } }
|
from { configurations.lib.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||||
into("build/classes/java/main")
|
into("build/classes/java/main")
|
||||||
duplicatesStrategy = "EXCLUDE"
|
duplicatesStrategy = "EXCLUDE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// runs during publication
|
||||||
task apiJar(type: Jar) {
|
task apiJar(type: Jar) {
|
||||||
|
// make sure jar is reobf'd before creating the api jar
|
||||||
|
// dependents must use fg.deobf("dependency") for their environment
|
||||||
|
dependsOn("reobfJar")
|
||||||
|
|
||||||
|
// copy contents of the main mod jar but only select packages
|
||||||
from { zipTree(tasks.jar.archivePath) }
|
from { zipTree(tasks.jar.archivePath) }
|
||||||
include "com/terraforged/fm/**"
|
include "com/terraforged/fm/**"
|
||||||
include "com/terraforged/api/**"
|
include "com/terraforged/api/**"
|
||||||
include "com/terraforged/core/**"
|
include "com/terraforged/core/**"
|
||||||
include "com/terraforged/n2d/**"
|
include "com/terraforged/n2d/**"
|
||||||
include "com/terraforged/world/**"
|
include "com/terraforged/world/**"
|
||||||
|
|
||||||
|
// self explanatory
|
||||||
classifier "api"
|
classifier "api"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
filesMatching("**/mods.toml") {
|
filesMatching("**/mods.toml") {
|
||||||
|
// replaces the version string in the mods.toml
|
||||||
expand("version": "${mod_version}${getClassifier()}", "mc_version": mc_version)
|
expand("version": "${mod_version}${getClassifier()}", "mc_version": mc_version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
classes {
|
classes {
|
||||||
|
// collect all dependency classes first
|
||||||
dependsOn(collectLibs)
|
dependsOn(collectLibs)
|
||||||
}
|
}
|
||||||
|
|
||||||
build {
|
publishing {
|
||||||
finalizedBy(apiJar)
|
publications {
|
||||||
|
// publish the mod jar & api jar
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
artifact jar
|
||||||
|
artifact apiJar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.getenv("MAVEN_USER") != null && System.getenv("MAVEN_PASS") != null) {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
credentials {
|
||||||
|
username System.getenv("MAVEN_USER")
|
||||||
|
password System.getenv("MAVEN_PASS")
|
||||||
|
}
|
||||||
|
name = "nexus"
|
||||||
|
url = "https://io.terraforged.com/repository/maven/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static def getClassifier() {
|
static def getClassifier() {
|
||||||
|
Loading…
Reference in New Issue
Block a user