2017-06-21 08:29:26 -04:00
|
|
|
import groovy.io.FileType
|
|
|
|
|
2017-06-21 08:11:41 -04:00
|
|
|
apply plugin: 'java-library'
|
2018-06-29 06:40:22 -04:00
|
|
|
apply plugin: 'maven-publish'
|
2014-09-15 06:03:39 -04:00
|
|
|
|
|
|
|
group = 'com.mojang'
|
2018-06-29 06:40:22 -04:00
|
|
|
version = project.hasProperty('buildNumber') ? "${project.majorMinor}.${project.buildNumber}" : "${project.majorMinor}.0-SNAPSHOT"
|
2014-09-15 06:03:39 -04:00
|
|
|
|
2018-07-02 06:35:33 -04:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven {
|
|
|
|
url "https://libraries.minecraft.net"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-15 06:03:39 -04:00
|
|
|
repositories {
|
|
|
|
maven {
|
2017-06-21 08:11:41 -04:00
|
|
|
url "https://libraries.minecraft.net"
|
2014-09-15 06:03:39 -04:00
|
|
|
}
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2018-10-06 09:20:28 -04:00
|
|
|
testCompile 'com.google.guava:guava:26.0-jre'
|
|
|
|
testCompile 'junit:junit-dep:4.11'
|
|
|
|
testCompile 'org.hamcrest:hamcrest-library:1.3'
|
|
|
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
|
|
|
testCompile 'com.google.guava:guava-testlib:26.0-jre'
|
|
|
|
testCompile 'org.openjdk.jmh:jmh-core:1.21'
|
|
|
|
annotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.21'
|
2014-09-15 06:03:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task sourcesJar(type: Jar) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
|
|
|
|
2017-06-21 08:11:41 -04:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
|
|
|
srcDirs = ['src/main/java']
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
srcDirs = ['src/main/resources']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
test {
|
|
|
|
java {
|
|
|
|
srcDirs = ['src/test/java']
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
srcDirs = ['src/test/resources']
|
|
|
|
}
|
2014-09-25 07:18:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-15 06:03:39 -04:00
|
|
|
artifacts {
|
|
|
|
archives jar
|
|
|
|
archives sourcesJar
|
|
|
|
}
|
|
|
|
|
2017-06-21 08:11:41 -04:00
|
|
|
test {
|
|
|
|
testLogging {
|
|
|
|
events "failed", "skipped"
|
2017-06-21 08:36:17 -04:00
|
|
|
showStandardStreams = true
|
2017-06-21 08:11:41 -04:00
|
|
|
showExceptions true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-29 06:40:22 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
from components.java
|
|
|
|
artifact sourcesJar
|
2014-09-15 06:03:39 -04:00
|
|
|
}
|
|
|
|
}
|
2018-06-29 06:40:22 -04:00
|
|
|
}
|
2014-09-15 06:03:39 -04:00
|
|
|
|
2018-06-29 06:40:22 -04:00
|
|
|
task report {
|
2014-09-15 06:03:39 -04:00
|
|
|
doLast {
|
2022-10-18 08:18:33 -04:00
|
|
|
println "##vso[build.updatebuildnumber]${project.version}"
|
2018-06-29 06:40:22 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-02 06:35:33 -04:00
|
|
|
def publishDir = file("$buildDir/repo")
|
|
|
|
|
|
|
|
clean.doLast {
|
|
|
|
delete publishDir
|
|
|
|
}
|
|
|
|
|
2018-06-29 06:40:22 -04:00
|
|
|
if (version.endsWith("SNAPSHOT")) {
|
|
|
|
publishing.repositories {
|
|
|
|
mavenLocal()
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
publishing.repositories {
|
|
|
|
maven {
|
2018-07-02 06:35:33 -04:00
|
|
|
url "$buildDir/repo"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
publish.doLast {
|
|
|
|
publishDir.eachFileRecurse {
|
2022-10-18 08:18:33 -04:00
|
|
|
if (!it.isFile()) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
// Remove junk files
|
|
|
|
if (it.name.contains(".xml") || it.name.contains(".md5")) {
|
|
|
|
it.delete()
|
2018-06-29 06:40:22 -04:00
|
|
|
}
|
2014-09-15 06:03:39 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|