This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new aa03c0efebc [fix][ci] Fix jacoco code coverage report aggregation 
(#22964)
aa03c0efebc is described below

commit aa03c0efebc9e0f46c8653629ae92206b47591c6
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)
---
 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 034b2ce60cf..3d63f104cd5 100755
--- a/build/pulsar_ci_tool.sh
+++ b/build/pulsar_ci_tool.sh
@@ -353,6 +353,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" ) \
@@ -494,11 +495,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
@@ -560,7 +561,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 d8819a1148a..de5d654851a 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 c7675ae88fc..1e200d04d68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -309,7 +309,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.11</jacoco-maven-plugin.version>
+    <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
     <spotbugs-maven-plugin.version>4.7.3.6</spotbugs-maven-plugin.version>
     <spotbugs.version>4.7.3</spotbugs.version>
     <errorprone.version>2.24.0</errorprone.version>

Reply via email to