Skip to content

Commit

Permalink
apache-poi: Introduce a separate jar-file for libs to reduce classes …
Browse files Browse the repository at this point in the history
…included in coverage report

Introduce two jar-files to separate .class files into two jar files, one
which is included in coverage reporting and one which contains libraries
which should not appear in the coverage report.

Unfortunately this only allows control on "artifact" level, which means single
uninteresting classes/packages cannot be excluded.

Related to google#10826 and google#10860

(cherry picked from commit 2b48e656646d4c3aa61ea44b5b3edef59942f142)
  • Loading branch information
centic9 committed Dec 29, 2023
1 parent 1ac7137 commit a6f2ec0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
6 changes: 4 additions & 2 deletions projects/apache-poi/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ popd

pushd "${SRC}"
${MVN} package -DfuzzedLibaryVersion="${CURRENT_VERSION}" ${MVN_FLAGS}
install -v target/${LIBRARY_NAME}-fuzzer-${CURRENT_VERSION}.jar ${OUT}/${LIBRARY_NAME}-fuzzer-${CURRENT_VERSION}.jar
ALL_JARS="${ALL_JARS} ${LIBRARY_NAME}-fuzzer-${CURRENT_VERSION}.jar"
mkdir -p ${OUT}/dependency
install -v target/assembly/${LIBRARY_NAME}-fuzzer-${CURRENT_VERSION}.jar ${OUT}/${LIBRARY_NAME}-fuzzer-${CURRENT_VERSION}.jar
install -v target/assembly/${LIBRARY_NAME}-fuzzer-libs-${CURRENT_VERSION}.jar ${OUT}/dependency/${LIBRARY_NAME}-fuzzer-libs-${CURRENT_VERSION}.jar
ALL_JARS="${ALL_JARS} ${LIBRARY_NAME}-fuzzer-${CURRENT_VERSION}.jar dependency/${LIBRARY_NAME}-fuzzer-libs-${CURRENT_VERSION}.jar"
popd

# The classpath at build-time includes the project jars in $OUT as well as the
Expand Down
28 changes: 28 additions & 0 deletions projects/apache-poi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,38 @@
</configuration>
<executions>
<execution>
<id>shade-poi</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>target/assembly/${project.artifactId}-${fuzzedLibaryVersion}.jar</outputFile>
<artifactSet>
<includes>
<includes>org.apache.poi:poi</includes>
<includes>org.apache.poi:poi-ooxml</includes>
<includes>org.apache.poi:poi-scratchpad</includes>
</includes>
</artifactSet>
</configuration>
</execution>
<execution>
<id>shade-non-poi</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>target/assembly/${project.artifactId}-libs-${fuzzedLibaryVersion}.jar</outputFile>
<artifactSet>
<excludes>
<excludes>org.apache.poi:poi</excludes>
<excludes>org.apache.poi:poi-ooxml</excludes>
<excludes>org.apache.poi:poi-scratchpad</excludes>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
Expand Down

0 comments on commit a6f2ec0

Please sign in to comment.