110 lines
3.7 KiB
Groovy
110 lines
3.7 KiB
Groovy
plugins {
|
|
id "java-library"
|
|
id "com.vanniktech.maven.publish"
|
|
id "com.github.johnrengelman.shadow"
|
|
}
|
|
|
|
sourceCompatibility = "1.8"
|
|
targetCompatibility = "1.8"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation deps.build.commonscli
|
|
implementation deps.build.guava
|
|
compileOnly deps.build.errorProneCheckApi
|
|
|
|
implementation project(":jar-infer:jar-infer-lib")
|
|
|
|
testImplementation deps.test.junit4
|
|
testImplementation(deps.build.errorProneTestHelpers) {
|
|
exclude group: "junit", module: "junit"
|
|
}
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes(
|
|
'Main-Class': 'com.uber.nullaway.jarinfer.JarInfer'
|
|
)
|
|
}
|
|
// add this classifier so that the output file for the jar task differs from
|
|
// the output file for the shadowJar task (otherwise they overwrite each other's
|
|
// outputs, forcing the tasks to always re-run)
|
|
archiveClassifier = "nonshadow"
|
|
}
|
|
|
|
shadowJar {
|
|
mergeServiceFiles()
|
|
configurations = [project.configurations.runtimeClasspath]
|
|
classifier = null
|
|
}
|
|
shadowJar.dependsOn jar
|
|
assemble.dependsOn shadowJar
|
|
|
|
// We disable the default maven publications to make sure only
|
|
// our custom shadow publication is used. Since we use the empty
|
|
// classifier for our fat jar, it would otherwise clash with the
|
|
// default maven publication (Also, this seems to be the only way
|
|
// to get a pom.xml with no dependencies for our fat jar, as using
|
|
// a classifier would result on both fat and thin jar sharing the
|
|
// same pom.xml. Instead, we skip publishing the thin jar
|
|
// altogether)
|
|
tasks.withType(PublishToMavenRepository) {
|
|
onlyIf {
|
|
publication == publishing.publications.shadow
|
|
}
|
|
}
|
|
tasks.withType(PublishToMavenLocal) {
|
|
onlyIf {
|
|
publication == publishing.publications.shadow
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
shadow(MavenPublication) { publication ->
|
|
project.shadow.component(publication)
|
|
// Since we are skipping the default maven publication, we append the `:sources` and
|
|
// `:javadoc` artifacts here. They are also required for Maven Central validation.
|
|
afterEvaluate {
|
|
artifact project.sourcesJar {
|
|
classifier "sources"
|
|
}
|
|
artifact project.javadocsJar {
|
|
classifier "javadoc"
|
|
}
|
|
}
|
|
// The shadow publication does not auto-configure the pom.xml file for us, so we need to
|
|
// set it up manually. We use the opportunity to change the name and description from
|
|
// the generic NullAway values to ones specific for the JarInfer tool.
|
|
pom {
|
|
name = 'JarInfer'
|
|
description = 'A JVM bytecode null auto-annotation tool for use with NullAway'
|
|
url = project.property('POM_URL')
|
|
licenses {
|
|
license {
|
|
name = project.property('POM_LICENCE_NAME')
|
|
url = project.property('POM_LICENCE_URL')
|
|
distribution = project.property('POM_LICENCE_DIST')
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = project.property('POM_DEVELOPER_ID')
|
|
name = project.property('POM_DEVELOPER_NAME')
|
|
url = project.property('POM_DEVELOPER_URL')
|
|
}
|
|
}
|
|
scm {
|
|
connection = project.property('POM_SCM_CONNECTION')
|
|
developerConnection = project.property('POM_SCM_DEV_CONNECTION')
|
|
url = project.property('POM_SCM_URL')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|