From fbc3b3452b9dbbee9955b3ccab03f2c2f667fad3 Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Tue, 11 Apr 2023 06:49:14 +0200 Subject: [PATCH] Fix multiple build failures for different projects (#10055) Fix issues in g-http-java-client, closure-compiler and opencensus-java. --- projects/closure-compiler/build.sh | 5 +++-- .../project-parent/fuzz-targets/pom.xml | 2 +- projects/closure-compiler/project.yaml | 3 +-- projects/g-http-java-client/build.sh | 10 +++++++--- .../project-parent/fuzz-targets/pom.xml | 4 ++-- .../project-parent/fuzz-targets/pom.xml | 12 ++++++------ projects/opencensus-java/project.yaml | 3 +-- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/projects/closure-compiler/build.sh b/projects/closure-compiler/build.sh index 7c4911ee3..b6101c0e0 100644 --- a/projects/closure-compiler/build.sh +++ b/projects/closure-compiler/build.sh @@ -57,7 +57,7 @@ else $MVN -pl fuzz-targets dependency:build-classpath -Dmdep.outputFile=cp.txt -Dmaven.repo.local=$OUT/m2 cp -r $SRC/project-parent/fuzz-targets/target/test-classes/ $OUT/ RUNTIME_CLASSPATH_ABSOLUTE="$(cat fuzz-targets/cp.txt):$OUT/test-classes:$(echo $ALL_JARS | xargs printf -- "$OUT/%s:")." - RUNTIME_CLASSPATH_RELATIVE=$(echo $RUNTIME_CLASSPATH_ABSOLUTE | sed "s|$OUT|.|g") + RUNTIME_CLASSPATH=$(echo $RUNTIME_CLASSPATH_ABSOLUTE | sed "s|$OUT|\$this_dir|g") for fuzzer in $(find $SRC/project-parent/fuzz-targets -name '*Fuzzer.java'); do fuzzer_basename=$(basename -s .java $fuzzer) @@ -65,12 +65,13 @@ else # Create an execution wrapper for every fuzztarget echo "#!/bin/bash # LLVMFuzzerTestOneInput comment for fuzzer detection by infrastructure. + this_dir=\$(dirname \"\$0\") if [[ \"\$@\" =~ (^| )-runs=[0-9]+($| ) ]]; then mem_settings='-Xmx1900m -Xss900k' else mem_settings='-Xmx2048m -Xss1024k' fi - java -cp $RUNTIME_CLASSPATH_RELATIVE \ + java -cp $RUNTIME_CLASSPATH \ \$mem_settings \ com.code_intelligence.jazzer.Jazzer \ --target_class=com.example.$fuzzer_basename \ diff --git a/projects/closure-compiler/project-parent/fuzz-targets/pom.xml b/projects/closure-compiler/project-parent/fuzz-targets/pom.xml index 72b3b7408..c7e552cd6 100644 --- a/projects/closure-compiler/project-parent/fuzz-targets/pom.xml +++ b/projects/closure-compiler/project-parent/fuzz-targets/pom.xml @@ -20,7 +20,7 @@ com.code-intelligence jazzer-junit - 0.16.0 + 0.15.0 diff --git a/projects/closure-compiler/project.yaml b/projects/closure-compiler/project.yaml index f896060d5..1f96cf519 100644 --- a/projects/closure-compiler/project.yaml +++ b/projects/closure-compiler/project.yaml @@ -11,5 +11,4 @@ vendor_ccs: - "glendowne@code-intelligence.com" - "patrice.salathe@code-intelligence.com" - "hlin@code-intelligence.com" - - "bug-disclosure@code-intelligence.com" -run_tests: False \ No newline at end of file + - "bug-disclosure@code-intelligence.com" \ No newline at end of file diff --git a/projects/g-http-java-client/build.sh b/projects/g-http-java-client/build.sh index e032e48a5..087a6d3fd 100755 --- a/projects/g-http-java-client/build.sh +++ b/projects/g-http-java-client/build.sh @@ -24,8 +24,12 @@ MAVEN_ARGS="-Djavac.src.version=15 -Djavac.target.version=15 -Denforcer.skip=tru function set_project_version_in_fuzz_targets_dependency { PROJECT_VERSION=$(cd $PROJECT && $MVN org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) - # set dependency project version in fuzz-targets - (cd fuzz-targets && $MVN versions:use-dep-version -Dincludes=$PROJECT_GROUP_ID:$PROJECT_ARTIFACT_ID -DdepVersion=$PROJECT_VERSION -DforceVersion=true) + FUZZ_TARGET_DEPENDENCIES=":google-http-client :google-http-client-gson" + + for dependency in $FUZZ_TARGET_DEPENDENCIES; do + # set dependency project version in fuzz-targets + (cd fuzz-targets && $MVN versions:use-dep-version -Dincludes=$PROJECT_GROUP_ID$dependency -DdepVersion=$PROJECT_VERSION -DforceVersion=true) + done } cd project-parent @@ -55,7 +59,7 @@ else # build classpath $MVN -pl fuzz-targets dependency:build-classpath -Dmdep.outputFile=cp.txt -Dmaven.repo.local=$OUT/m2 - cp -r $SRC/project-parent/fuzz-targets/target/test-classes/ $OUT/test-classes + cp -r $SRC/project-parent/fuzz-targets/target/test-classes/ $OUT/ RUNTIME_CLASSPATH_ABSOLUTE="$(cat fuzz-targets/cp.txt):$OUT/test-classes" # replace dirname with placeholder $this_dir that will be replaced at runtime RUNTIME_CLASSPATH=$(echo $RUNTIME_CLASSPATH_ABSOLUTE | sed "s|$OUT|\$this_dir|g") diff --git a/projects/g-http-java-client/project-parent/fuzz-targets/pom.xml b/projects/g-http-java-client/project-parent/fuzz-targets/pom.xml index 153d361e2..8d6d8f549 100644 --- a/projects/g-http-java-client/project-parent/fuzz-targets/pom.xml +++ b/projects/g-http-java-client/project-parent/fuzz-targets/pom.xml @@ -39,13 +39,13 @@ com.google.http-client google-http-client - 1.43.2-SNAPSHOT + Fuzzing-SNAPSHOT com.google.http-client google-http-client-gson - 1.43.2-SNAPSHOT + Fuzzing-SNAPSHOT diff --git a/projects/opencensus-java/project-parent/fuzz-targets/pom.xml b/projects/opencensus-java/project-parent/fuzz-targets/pom.xml index e9bb2f6cb..4c89bc977 100644 --- a/projects/opencensus-java/project-parent/fuzz-targets/pom.xml +++ b/projects/opencensus-java/project-parent/fuzz-targets/pom.xml @@ -20,7 +20,7 @@ com.code-intelligence jazzer-junit - 0.16.0 + 0.15.0 @@ -41,7 +41,7 @@ opencensus-api ${env.OPENCENSUS_JAVA_VERSION} system - ${basedir}/../opencensus-java/api/build/libs/opencensus-api-0.32.0-SNAPSHOT.jar + ${basedir}/../opencensus-java/api/build/libs/opencensus-api-${env.OPENCENSUS_JAVA_VERSION}.jar @@ -49,7 +49,7 @@ opencensus-impl ${env.OPENCENSUS_JAVA_VERSION} system - ${basedir}/../opencensus-java/impl/build/libs/opencensus-impl-0.32.0-SNAPSHOT.jar + ${basedir}/../opencensus-java/impl/build/libs/opencensus-impl-${env.OPENCENSUS_JAVA_VERSION}.jar @@ -57,7 +57,7 @@ opencensus-impl-core ${env.OPENCENSUS_JAVA_VERSION} system - ${basedir}/../opencensus-java/impl_core/build/libs/opencensus-impl-core-0.32.0-SNAPSHOT.jar + ${basedir}/../opencensus-java/impl_core/build/libs/opencensus-impl-core-${env.OPENCENSUS_JAVA_VERSION}.jar @@ -65,7 +65,7 @@ opencensus-exporter-trace-util ${env.OPENCENSUS_JAVA_VERSION} system - ${basedir}/../opencensus-java/exporters/trace/util/build/libs/opencensus-exporter-trace-util-0.32.0-SNAPSHOT.jar + ${basedir}/../opencensus-java/exporters/trace/util/build/libs/opencensus-exporter-trace-util-${env.OPENCENSUS_JAVA_VERSION}.jar @@ -73,7 +73,7 @@ opencensus-contrib-resource-util ${env.OPENCENSUS_JAVA_VERSION} system - ${basedir}/../opencensus-java/contrib/resource_util/build/libs/opencensus-contrib-resource-util-0.32.0-SNAPSHOT.jar + ${basedir}/../opencensus-java/contrib/resource_util/build/libs/opencensus-contrib-resource-util-${env.OPENCENSUS_JAVA_VERSION}.jar diff --git a/projects/opencensus-java/project.yaml b/projects/opencensus-java/project.yaml index 92e688776..3d467cd1c 100644 --- a/projects/opencensus-java/project.yaml +++ b/projects/opencensus-java/project.yaml @@ -11,5 +11,4 @@ vendor_ccs: - "glendowne@code-intelligence.com" - "patrice.salathe@code-intelligence.com" - "hlin@code-intelligence.com" - - "bug-disclosure@code-intelligence.com" -run_tests: False \ No newline at end of file + - "bug-disclosure@code-intelligence.com" \ No newline at end of file