116 lines
2.3 KiB
Groovy
116 lines
2.3 KiB
Groovy
import groovy.io.FileType
|
|
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'maven-publish'
|
|
|
|
group = 'com.mojang'
|
|
version = project.hasProperty('buildNumber') ? "${project.majorMinor}.${project.buildNumber}" : "${project.majorMinor}.0-SNAPSHOT"
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url "https://libraries.minecraft.net"
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url "https://libraries.minecraft.net"
|
|
}
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
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'
|
|
}
|
|
|
|
task sourcesJar(type: Jar) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDirs = ['src/main/java']
|
|
}
|
|
resources {
|
|
srcDirs = ['src/main/resources']
|
|
}
|
|
}
|
|
test {
|
|
java {
|
|
srcDirs = ['src/test/java']
|
|
}
|
|
resources {
|
|
srcDirs = ['src/test/resources']
|
|
}
|
|
}
|
|
}
|
|
|
|
artifacts {
|
|
archives jar
|
|
archives sourcesJar
|
|
}
|
|
|
|
test {
|
|
testLogging {
|
|
events "failed", "skipped"
|
|
showStandardStreams = true
|
|
showExceptions true
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
from components.java
|
|
artifact sourcesJar
|
|
}
|
|
}
|
|
}
|
|
|
|
task report {
|
|
doLast {
|
|
println "##vso[build.updatebuildnumber]${project.version}"
|
|
}
|
|
}
|
|
|
|
def publishDir = file("$buildDir/repo")
|
|
|
|
clean.doLast {
|
|
delete publishDir
|
|
}
|
|
|
|
if (version.endsWith("SNAPSHOT")) {
|
|
publishing.repositories {
|
|
mavenLocal()
|
|
}
|
|
} else {
|
|
publishing.repositories {
|
|
maven {
|
|
url "$buildDir/repo"
|
|
}
|
|
}
|
|
|
|
publish.doLast {
|
|
publishDir.eachFileRecurse {
|
|
if (!it.isFile()) {
|
|
return
|
|
}
|
|
// Remove junk files
|
|
if (it.name.contains(".xml") || it.name.contains(".md5")) {
|
|
it.delete()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|