blob: 9ce17da6dc4e40187ecdf59072adcbd61cfdc9f1 [file] [log] [blame]
evaluationDependsOn(":checker-qual")
task copySources(type: Copy) {
description 'Copy checker-qual source to checker-qual-android'
includeEmptyDirs = false
doFirst {
// Delete the directory in case a previously copied file should no longer be in checker-qual
delete file('src')
}
from files('../checker-qual/src/main')
include "**/*.java"
exclude "**/SignednessUtilExtra.java"
into file('src/main')
// Not read only because "replaceAnnotations" tasks writes to the files.
fileMode(0666)
dirMode(0777)
}
/**
* Types annotated with runtime annotations are always kept in the main dex by the default Android Gradle plugin.
* Using the standard Checker Framework annotations can lead to main dex overflows;
* users of the Checker framework may find themselves unable to build their Android apps.
* By contrast, class-retention annotations are stripped out before packaging by all build systems as a convention.
*/
task replaceAnnotations {
doLast {
fileTree(dir: 'src', include: "**/*.java").each {
it.text = it.text.replaceAll("RetentionPolicy.RUNTIME", "RetentionPolicy.CLASS")
}
}
}
replaceAnnotations.dependsOn copySources
compileJava.dependsOn replaceAnnotations
clean {
delete file('src')
}
apply from: rootProject.file("gradle-mvn-push.gradle")
/** Adds information to the publication for uploading to Maven repositories. */
final checkerQualAndroidPom(publication) {
sharedPublicationConfiguration(publication)
publication.from components.java
publication.pom {
name = 'Checker Qual Android'
description = 'checker-qual-android contains annotations (type qualifiers) that a programmer\n' +
'writes to specify Java code for type-checking by the Checker Framework.\n' +
'\n' +
'The checker-qual-android artifact is identical to the checker-qual\n' +
'artifact, except that in checker-qual-android annotations have classfile\n' +
'retention. The default Android Gradle plugin retains types annotated with\n' +
'runtime annotations in the main dex, but strips out class-retention\n' +
'annotations.\n'
licenses {
license {
name = 'The MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
}
publishing {
publications {
checkerQualAndroid(MavenPublication) {
checkerQualAndroidPom it
}
}
}
signing {
sign publishing.publications.checkerQualAndroid
}