Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Annotation File Utilities as an included build. #3332

Merged
merged 9 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ ext {

annotationTools = "${parentDir}/annotation-tools"
afu = "${annotationTools}/annotation-file-utilities"
afuJar = "${afu}/annotation-file-utilities-all-but-javac.jar"

stubparser = "${parentDir}/stubparser"
stubparserJar = "${stubparser}/javaparser-core/target/stubparser.jar"
Expand Down Expand Up @@ -238,7 +237,7 @@ task cloneAndBuildDependencies(type: Exec) {
task maybeCloneAndBuildDependencies(type: Exec) {
description 'Clones (or updates) and builds all dependencies if they are not present.'
onlyIf {
!file(afuJar).exists() || !file(stubparserJar).exists()
!file(stubparserJar).exists()
// The jdk repository is cloned via the copyAndMinimizeAnnotatedJdkFiles task that is run if
// the repository does not exist when building checker.jar.
}
Expand Down Expand Up @@ -573,10 +572,6 @@ subprojects {
relocate 'com.github.javaparser', 'org.checkerframework.com.github.javaparser'
}
}
// Don't relocate javac.jar:
// relocate 'com.sun', 'org.checkeframework.com.sun'
// relocate 'javax','org.checkerframework.javax'
// relocate 'jdk', 'org.checkerframework.jdk'

// These appear in annotation-file-utilities-all.jar:
relocate 'org.apache', 'org.checkerframework.org.apache'
Expand Down
24 changes: 14 additions & 10 deletions framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,22 @@ dependencies {
implementation project(':dataflow')
implementation project(':javacutil')
implementation files("${stubparserJar}")
implementation files("${afuJar}")
// AFU is an "includedBuild" imported in checker-framework/settings.gradle, so the version number doesn't matter.
// https://docs.gradle.org/current/userguide/composite_builds.html#settings_defined_composite
implementation('org.checkerframework:annotation-file-utilities:*') {
exclude group: 'com.google', module: 'javac'
}
implementation project(':checker-qual')
// As of 2019/12/16, the version of reflection-util in the Annotation
// File Utilities takes priority over this version, in the fat jar
// file. :-( So update it and re-build it locally when updating this.
implementation 'org.plumelib:reflection-util:0.2.2'
implementation 'org.plumelib:plume-util:1.1.4'

// TODO: org.checkerframework.annotatedlib:guava:28.2-jre requires the below dependency.
implementation 'com.google.errorprone:error_prone_annotations:2.3.4'
implementation ('org.checkerframework.annotatedlib:guava:28.2-jre') {
// So long as Guava only uses annotations from checker-qual, excluding it should not cause problems.
exclude group: 'org.checkerframework'

}

testImplementation group: 'junit', name: 'junit', version: '4.13'
testImplementation project(':framework-test')
Expand All @@ -46,12 +56,6 @@ dependencies {

task checkDependencies(dependsOn: ':maybeCloneAndBuildDependencies') {
doLast {
if (!file(afuJar).exists()) {
if (!file(stubparserJar).exists()) {
throw new GradleException("${afuJar} and ${stubparserJar} do not exist. Try running './gradlew cloneAndBuildDependencies'")
}
throw new GradleException("${afuJar} does not exist. Try running './gradlew cloneAndBuildDependencies'")
}
if (!file(stubparserJar).exists()) {
throw new GradleException("${stubparserJar} does not exist. Try running './gradlew cloneAndBuildDependencies'")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import javax.lang.model.type.ArrayType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.signature.qual.BinaryName;
import org.checkerframework.checker.signature.qual.DotSeparatedIdentifiers;
Expand Down Expand Up @@ -450,8 +449,7 @@ private static boolean isInternalJDKAnnotation(String annotationName) {
*/
private static int printClassDefinitions(
String basename, AClass aClass, PrintWriter printWriter) {

String[] classNames = StringUtils.split(basename, '$');
String[] classNames = basename.split("\\$");

for (int i = 0; i < classNames.length; i++) {
String nameToPrint = classNames[i];
Expand Down
8 changes: 7 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ include 'framework'
include 'checker-qual'
include 'checker-qual-android'
include 'framework-test'

includeBuild ('../annotation-tools/annotation-file-utilities'){
if (!file('../annotation-tools/annotation-file-utilities').exists()) {
exec {
executable 'checker/bin-devel/build.sh'
}
}
}