Upload to S3 if -PbuildNumber
is set, otherwise version is foo.0-SNAPSHOT
published to local maven repo
This commit is contained in:
parent
805c001658
commit
1ecf0558a0
2 changed files with 29 additions and 24 deletions
52
build.gradle
52
build.gradle
|
@ -1,10 +1,10 @@
|
||||||
import groovy.io.FileType
|
import groovy.io.FileType
|
||||||
|
|
||||||
apply plugin: 'java-library'
|
apply plugin: 'java-library'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
version = '0.1.27'
|
|
||||||
group = 'com.mojang'
|
group = 'com.mojang'
|
||||||
|
version = project.hasProperty('buildNumber') ? "${project.majorMinor}.${project.buildNumber}" : "${project.majorMinor}.0-SNAPSHOT"
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
gradleVersion = '4.0'
|
gradleVersion = '4.0'
|
||||||
|
@ -64,29 +64,33 @@ test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def repoDir = new File(projectDir, "repo")
|
publishing {
|
||||||
repoDir.mkdirs()
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
uploadArchives {
|
from components.java
|
||||||
repositories {
|
artifact sourcesJar
|
||||||
mavenDeployer {
|
}
|
||||||
repository(url: "file://" + repoDir.absolutePath)
|
}
|
||||||
|
}
|
||||||
pom.project {
|
|
||||||
description 'Command Registration & Dispatch System'
|
task report {
|
||||||
url 'http://github.com/Mojang/brigadier'
|
doLast {
|
||||||
}
|
println "##teamcity[buildNumber '${project.version}']"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doLast {
|
if (version.endsWith("SNAPSHOT")) {
|
||||||
// Purge all annoying files that arent needed
|
publishing.repositories {
|
||||||
repoDir.traverse(type: FileType.FILES, nameFilter: ~/.*\.(xml|xml\.sha1|md5)$/) {
|
mavenLocal()
|
||||||
it.delete()
|
}
|
||||||
|
} else {
|
||||||
|
publishing.repositories {
|
||||||
|
maven {
|
||||||
|
url "s3://minecraft-libraries/"
|
||||||
|
authentication {
|
||||||
|
awsIm(AwsImAuthentication)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clean.doLast {
|
|
||||||
repoDir.deleteDir()
|
|
||||||
}
|
|
1
gradle.properties
Normal file
1
gradle.properties
Normal file
|
@ -0,0 +1 @@
|
||||||
|
majorMinor: 1.0
|
Loading…
Reference in a new issue