From 79de928a1d04c932b8c0329eeb01bc22f9e7236f Mon Sep 17 00:00:00 2001 From: zcai Date: Wed, 1 Sep 2021 09:58:28 -0400 Subject: [PATCH 1/5] gradle 7.2 upgrade --- build.gradle | 35 ++++++++++++------------ gradle/wrapper/gradle-wrapper.properties | 5 ++-- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/build.gradle b/build.gradle index 35ff0f24a..55885b756 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.github.johnrengelman.shadow' version '6.1.0' + id 'com.github.johnrengelman.shadow' version '7.0.0' } apply plugin: 'java' @@ -34,7 +34,6 @@ println '-------------------------------' println 'CHECKERFRAMEWORK: ' + checkerFrameworkPath repositories { - jcenter() mavenCentral() } @@ -47,27 +46,27 @@ dependencies { javacJar group: 'com.google.errorprone', name: 'javac', version: "$errorproneJavacVersion" } - compile files("${checkerJar}") - compile group: 'com.google.errorprone', name: 'javac', version: "$errorproneJavacVersion" + implementation files("${checkerJar}") + implementation group: 'com.google.errorprone', name: 'javac', version: "$errorproneJavacVersion" - compile 'org.plumelib:options:1.0.5' - compile 'org.plumelib:plume-util:1.5.8' + implementation 'org.plumelib:options:1.0.5' + implementation 'org.plumelib:plume-util:1.5.8' implementation 'com.google.guava:guava:30.1.1-jre' // Serialize constraints - compile 'com.googlecode.json-simple:json-simple:1.1.1' + implementation 'com.googlecode.json-simple:json-simple:1.1.1' // Pretty print serialized constraints - compile 'com.google.code.gson:gson:2.8.7' + implementation 'com.google.code.gson:gson:2.8.7' - compile 'org.ow2.sat4j:org.ow2.sat4j.core:2.3.6' - compile 'org.ow2.sat4j:org.ow2.sat4j.maxsat:2.3.6' - compile files(z3Jar) + implementation 'org.ow2.sat4j:org.ow2.sat4j.core:2.3.6' + implementation 'org.ow2.sat4j:org.ow2.sat4j.maxsat:2.3.6' + implementation files(z3Jar) - testCompile fileTree(dir: "${checkerFrameworkPath}/framework-test/build/libs", include: "framework-test-*.jar") + testImplementation fileTree(dir: "${checkerFrameworkPath}/framework-test/build/libs", include: "framework-test-*.jar") // Mocking library. Used in a couple tests - testCompile 'org.mockito:mockito-all:2.0.2-beta' - testCompile 'junit:junit:4.13.2' + testImplementation 'org.mockito:mockito-all:2.0.2-beta' + testImplementation 'junit:junit:4.13.2' } sourceSets { @@ -179,7 +178,7 @@ compileJava { jar { description = 'Makes a jar with ONLY the classes compiled for checker ' + 'framework inference and NONE of its dependencies' - archiveName = "checker-framework-inference.jar" + archiveFileName = "checker-framework-inference.jar" manifest.attributes("Main-Class": "checkers.inference.InferenceLauncher") exclude("dependency-cache", "libs", "tmp") } @@ -189,8 +188,8 @@ shadowJar { exclude(dependency("junit:.*:.*")) } description 'Creates the "fat" checker.jar in dist' - destinationDir = file("${projectDir}/dist") - archiveName = "checker-framework-inference.jar" + destinationDirectory = file("${projectDir}/dist") + archiveFileName = "checker-framework-inference.jar" } task dist(dependsOn: shadowJar, type: Copy) { @@ -248,7 +247,7 @@ task release(type: Zip) { include '*.py' } - baseName = 'release' + archiveBaseName = 'release' } task cloneAndBuildDependencies(type: Exec) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index eb2d87749..a0f7639f7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Thu Apr 23 12:40:58 EDT 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists From 3008f3016634de5a48887e39c66cfd7e19612595 Mon Sep 17 00:00:00 2001 From: zcai Date: Wed, 1 Sep 2021 11:00:33 -0400 Subject: [PATCH 2/5] deprecate compile and testCompile --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 55885b756..f2049ca11 100644 --- a/build.gradle +++ b/build.gradle @@ -208,9 +208,9 @@ task dist(dependsOn: shadowJar, type: Copy) { task dependenciesJar(dependsOn: dist, type: Jar) { description 'Create a jar file with all the dependencies.' + duplicatesStrategy DuplicatesStrategy.EXCLUDE from { - configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } - configurations.testCompile.collect { it.isDirectory() ? it : zipTree(it) } + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } archiveName 'dependencies.jar' destinationDir file("${projectDir}/dist/") From c0632c4ab2d1e0efdfaf8c9d41e5d667e6ceda73 Mon Sep 17 00:00:00 2001 From: zcai Date: Wed, 15 Sep 2021 00:14:06 -0400 Subject: [PATCH 3/5] add AFU dependency --- .ci-build-without-test.sh | 15 ++++++++++++++- build.gradle | 6 ++++++ settings.gradle | 7 +++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 settings.gradle diff --git a/.ci-build-without-test.sh b/.ci-build-without-test.sh index 825ad3898..4fd75d5be 100755 --- a/.ci-build-without-test.sh +++ b/.ci-build-without-test.sh @@ -13,8 +13,21 @@ else export JAVA_HOME=${JAVA_HOME:-$(dirname $(dirname $(readlink -f $(which javac))))} fi +export AFU="${AFU:-../annotation-tools/annotation-file-utilities}" +# Don't use `AT=${AFU}/..` which causes a git failure. +AT=$(dirname "${AFU}") + +## Build annotation-tools (Annotation File Utilities) +/tmp/plume-scripts/git-clone-related opprop annotation-tools "${AT}" +if [ ! -d ../annotation-tools ] ; then + ln -s "${AT}" ../annotation-tools +fi + +echo "Running: (cd ${AT} && ./.build-without-test.sh)" +(cd "${AT}" && ./.build-without-test.sh) +echo "... done: (cd ${AT} && ./.build-without-test.sh)" + export JSR308="${JSR308:-$(cd .. && pwd -P)}" -export AFU="${AFU:-$(pwd -P)/../annotation-tools/annotation-file-utilities}" export CHECKERFRAMEWORK="${CHECKERFRAMEWORK:-$(pwd -P)/../checker-framework}" export PATH=$AFU/scripts:$JAVA_HOME/bin:$PATH diff --git a/build.gradle b/build.gradle index f2049ca11..075ca232e 100644 --- a/build.gradle +++ b/build.gradle @@ -54,6 +54,12 @@ dependencies { implementation 'com.google.guava:guava:30.1.1-jre' + // AFU is an "includedBuild" imported in 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.errorprone', module: 'javac' + } + // Serialize constraints implementation 'com.googlecode.json-simple:json-simple:1.1.1' // Pretty print serialized constraints diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..054e3af53 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,7 @@ +includeBuild ('../annotation-tools/annotation-file-utilities') { + if (!file('../annotation-tools/annotation-file-utilities').exists()) { + exec { + executable '.ci-build-without-test.sh' + } + } +} From 2da580f06b227bcbe6488680e9cff3b4a44c6c10 Mon Sep 17 00:00:00 2001 From: zcai Date: Wed, 15 Sep 2021 00:14:55 -0400 Subject: [PATCH 4/5] change clearPrimaryAnnotations() to clearAnnotations() --- src/checkers/inference/InferenceAnnotatedTypeFactory.java | 2 +- src/checkers/inference/VariableAnnotator.java | 8 ++++---- src/checkers/inference/util/CopyUtil.java | 4 ++-- src/checkers/inference/util/InferenceUtil.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/checkers/inference/InferenceAnnotatedTypeFactory.java b/src/checkers/inference/InferenceAnnotatedTypeFactory.java index c069ef687..d7e30a84e 100644 --- a/src/checkers/inference/InferenceAnnotatedTypeFactory.java +++ b/src/checkers/inference/InferenceAnnotatedTypeFactory.java @@ -273,7 +273,7 @@ protected void postDirectSuperTypes(AnnotatedTypeMirror type, List annotations = type.getEffectiveAnnotations(); for (AnnotatedTypeMirror supertype : supertypes) { if (!annotations.equals(supertype.getEffectiveAnnotations())) { - supertype.clearPrimaryAnnotations(); + supertype.clearAnnotations(); supertype.addAnnotations(annotations); } } diff --git a/src/checkers/inference/VariableAnnotator.java b/src/checkers/inference/VariableAnnotator.java index b73f39ced..445225f74 100644 --- a/src/checkers/inference/VariableAnnotator.java +++ b/src/checkers/inference/VariableAnnotator.java @@ -410,7 +410,7 @@ private void addExistentialVariable(final AnnotatedTypeVariable typeVar, final T if (elementToAtm.containsKey(varElem) && !isUpperBoundOfTypeParam && !isReturn) { - typeVar.clearPrimaryAnnotations(); + typeVar.clearAnnotations(); annotateElementFromStore(varElem, typeVar); return; } @@ -420,7 +420,7 @@ private void addExistentialVariable(final AnnotatedTypeVariable typeVar, final T potentialVariable = treeToVarAnnoPair.get(typeTree).first; // might have a primary annotation lingering around // (that would removed in the else clause) - typeVar.clearPrimaryAnnotations(); + typeVar.clearAnnotations(); } else { // element from use and see if we already have this as a local var or field? @@ -431,7 +431,7 @@ private void addExistentialVariable(final AnnotatedTypeVariable typeVar, final T + "typeVar=" + typeVar + "\n" + "tree=" + tree + "\n"); } - typeVar.clearPrimaryAnnotations(); + typeVar.clearAnnotations(); } potentialVariable = createVariable(typeTree); @@ -1546,7 +1546,7 @@ public void handleBinaryTree(AnnotatedTypeMirror atm, BinaryTree binaryTree) { Set lubs = inferenceTypeFactory .getQualifierHierarchy().leastUpperBounds(a.getEffectiveAnnotations(), b.getEffectiveAnnotations()); - atm.clearPrimaryAnnotations(); + atm.clearAnnotations(); atm.addAnnotations(lubs); if (slotManager.getSlot(atm) instanceof VariableSlot) { final Pair> varATMPair = Pair.>of( diff --git a/src/checkers/inference/util/CopyUtil.java b/src/checkers/inference/util/CopyUtil.java index 6efc0370a..5f30844ac 100644 --- a/src/checkers/inference/util/CopyUtil.java +++ b/src/checkers/inference/util/CopyUtil.java @@ -50,7 +50,7 @@ public static class ClearAndCopy implements CopyMethod { */ @Override public void copy(AnnotatedTypeMirror from, AnnotatedTypeMirror to) { - to.clearPrimaryAnnotations(); + to.clearAnnotations(); to.addAnnotations(from.getAnnotations()); } } @@ -80,7 +80,7 @@ public static void copyParameterReceiverAndReturnTypes(final AnnotatedExecutable // TODO: Constructor receivers might be null? if (from.getReceiverType() != null && to.getReceiverType() != null) { // Only the primary does anything at the moment, so no deep copy. - to.getReceiverType().clearPrimaryAnnotations(); + to.getReceiverType().clearAnnotations(); to.getReceiverType().addAnnotations(from.getReceiverType().getAnnotations()); } diff --git a/src/checkers/inference/util/InferenceUtil.java b/src/checkers/inference/util/InferenceUtil.java index 6d5b5102d..a985ce676 100644 --- a/src/checkers/inference/util/InferenceUtil.java +++ b/src/checkers/inference/util/InferenceUtil.java @@ -40,7 +40,7 @@ public static Set clearAnnos(final AnnotatedTypeMirror atm) { final Set oldAnnos = AnnotationUtils.createAnnotationSet(); oldAnnos.addAll(atm.getAnnotations()); - atm.clearPrimaryAnnotations(); + atm.clearAnnotations(); return oldAnnos; } From 579a3a7c063d842cf70733e01473a887f4798e5c Mon Sep 17 00:00:00 2001 From: zcai Date: Wed, 15 Sep 2021 00:41:58 -0400 Subject: [PATCH 5/5] install plume-scripts before using it --- .ci-build-without-test.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.ci-build-without-test.sh b/.ci-build-without-test.sh index 4fd75d5be..3aa0f97f6 100755 --- a/.ci-build-without-test.sh +++ b/.ci-build-without-test.sh @@ -13,6 +13,12 @@ else export JAVA_HOME=${JAVA_HOME:-$(dirname $(dirname $(readlink -f $(which javac))))} fi +if [ -d "/tmp/plume-scripts" ] ; then + git -C /tmp/plume-scripts pull -q +else + git -C /tmp clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git +fi + export AFU="${AFU:-../annotation-tools/annotation-file-utilities}" # Don't use `AT=${AFU}/..` which causes a git failure. AT=$(dirname "${AFU}") @@ -32,12 +38,6 @@ export CHECKERFRAMEWORK="${CHECKERFRAMEWORK:-$(pwd -P)/../checker-framework}" export PATH=$AFU/scripts:$JAVA_HOME/bin:$PATH -if [ -d "/tmp/plume-scripts" ] ; then - git -C /tmp/plume-scripts pull -q -else - git -C /tmp clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git -fi - ## Build Checker Framework /tmp/plume-scripts/git-clone-related opprop checker-framework ${CHECKERFRAMEWORK}