This is an automated email from the ASF dual-hosted git repository. lhotari pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new dbb885217ce [fix][ci] Fix jacoco code coverage report aggregation (#22964) dbb885217ce is described below commit dbb885217ce5b09574b546cf4ad8b5ec2ceb3fab Author: Lari Hotari <lhot...@users.noreply.github.com> AuthorDate: Mon Jun 24 21:42:30 2024 +0300 [fix][ci] Fix jacoco code coverage report aggregation (#22964) (cherry picked from commit aa03c0efebc9e0f46c8653629ae92206b47591c6) # Conflicts: # pom.xml --- build/pulsar_ci_tool.sh | 9 +++++---- jetcd-core-shaded/pom.xml | 11 +++++++++++ pom.xml | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/build/pulsar_ci_tool.sh b/build/pulsar_ci_tool.sh index d946edd3957..40b1e5d18c3 100755 --- a/build/pulsar_ci_tool.sh +++ b/build/pulsar_ci_tool.sh @@ -389,6 +389,7 @@ _ci_upload_coverage_files() { --transform="flags=r;s|\\(/jacoco.*\\).exec$|\\1_${testtype}_${testgroup}.exec|" \ --transform="flags=r;s|\\(/tmp/jacocoDir/.*\\).exec$|\\1_${testtype}_${testgroup}.exec|" \ --exclude="*/META-INF/bundled-dependencies/*" \ + --exclude="*/META-INF/versions/*" \ $GITHUB_WORKSPACE/target/classpath_* \ $(find "$GITHUB_WORKSPACE" -path "*/target/jacoco*.exec" -printf "%p\n%h/classes\n" | sort | uniq) \ $([ -d /tmp/jacocoDir ] && echo "/tmp/jacocoDir" ) \ @@ -530,11 +531,11 @@ ci_create_test_coverage_report() { local classfilesArgs="--classfiles $({ { for classpathEntry in $(cat $completeClasspathFile | { grep -v -f $filterArtifactsFile || true; } | sort | uniq | { grep -v -E "$excludeJarsPattern" || true; }); do - if [[ -f $classpathEntry && -n "$(unzip -Z1C $classpathEntry 'META-INF/bundled-dependencies/*' 2>/dev/null)" ]]; then - # file must be processed by removing META-INF/bundled-dependencies + if [[ -f $classpathEntry && -n "$(unzip -Z1C $classpathEntry 'META-INF/bundled-dependencies/*' 'META-INF/versions/*' 2>/dev/null)" ]]; then + # file must be processed by removing META-INF/bundled-dependencies and META-INF/versions local jartempfile=$(mktemp -t jarfile.XXXX --suffix=.jar) cp $classpathEntry $jartempfile - zip -q -d $jartempfile 'META-INF/bundled-dependencies/*' &> /dev/null + zip -q -d $jartempfile 'META-INF/bundled-dependencies/*' 'META-INF/versions/*' &> /dev/null echo $jartempfile else echo $classpathEntry @@ -596,7 +597,7 @@ ci_create_inttest_coverage_report() { # remove jar file that causes duplicate classes issue rm /tmp/jacocoDir/pulsar_lib/org.apache.pulsar-bouncy-castle* || true # remove any bundled dependencies as part of .jar/.nar files - find /tmp/jacocoDir/pulsar_lib '(' -name "*.jar" -or -name "*.nar" ')' -exec echo "Processing {}" \; -exec zip -q -d {} 'META-INF/bundled-dependencies/*' \; |grep -E -v "Nothing to do|^$" || true + find /tmp/jacocoDir/pulsar_lib '(' -name "*.jar" -or -name "*.nar" ')' -exec echo "Processing {}" \; -exec zip -q -d {} 'META-INF/bundled-dependencies/*' 'META-INF/versions/*' \; |grep -E -v "Nothing to do|^$" || true fi # projects that aren't considered as production code and their own src/main/java source code shouldn't be analysed local excludeProjectsPattern="testmocks|testclient|buildtools" diff --git a/jetcd-core-shaded/pom.xml b/jetcd-core-shaded/pom.xml index 18dabf28b87..b68607cb4ef 100644 --- a/jetcd-core-shaded/pom.xml +++ b/jetcd-core-shaded/pom.xml @@ -100,6 +100,12 @@ <pattern>io.vertx</pattern> <shadedPattern>org.apache.pulsar.jetcd.shaded.io.vertx</shadedPattern> </relocation> + <!-- relocate multi-release packages --> + <relocation> + <pattern>META-INF/versions/(\d+)/io/vertx/</pattern> + <shadedPattern>META-INF/versions/$1/org/apache/pulsar/jetcd/shaded/io/vertx/</shadedPattern> + <rawString>true</rawString> + </relocation> <!-- relocate to use grpc-netty-shaded packages --> <relocation> <pattern>io.grpc.netty</pattern> @@ -123,6 +129,11 @@ </filter> </filters> <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <manifestEntries> + <Multi-Release>true</Multi-Release> + </manifestEntries> + </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> <transformer implementation="org.apache.maven.plugins.shade.resource.PluginXmlResourceTransformer"/> <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer"> diff --git a/pom.xml b/pom.xml index 7d811c85f9f..c0414b2be20 100644 --- a/pom.xml +++ b/pom.xml @@ -299,7 +299,7 @@ flexible messaging model and an intuitive client API.</description> <git-commit-id-plugin.version>4.9.10</git-commit-id-plugin.version> <wagon-ssh-external.version>3.5.3</wagon-ssh-external.version> <os-maven-plugin.version>1.7.0</os-maven-plugin.version> - <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version> + <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version> <spotbugs-maven-plugin.version>4.7.3.0</spotbugs-maven-plugin.version> <spotbugs.version>4.7.3</spotbugs.version> <errorprone.version>2.5.1</errorprone.version>