From 18164f4554ec9705b60181b4052489fc5a6d8eb1 Mon Sep 17 00:00:00 2001 From: Arthur Chan Date: Tue, 22 Nov 2022 13:59:44 +0000 Subject: [PATCH] [Javassist] Fix project directory and maven build script (#9037) The default source and test source directory for maven project are src/main/java and src/test/java respectively. The author of Javassist does specify a non-traditional location for the source and test source and manually set it in the pom.xml. Although it does not affect the normal project build, it does affect jacoco coverage report generator to extract the source code of the project because Jacoco will not read the pom.xml settings and only scan the default source and test source directory for source code file. To remedy, this fix aim to do some folder movement to move the source and test source back to the default directory while pointing the pom.xml settings to the default directory. These changes allow the project compile and execute as normal and also allow jacoco correctly retrieve the source code for coverage report generation. This fix is necessary for fuzz-introspector coverage report to show the code coverage down to the source code line. Signed-off-by: Arthur Chan Signed-off-by: Arthur Chan --- projects/javassist/Dockerfile | 1 + projects/javassist/build.sh | 7 +++++++ projects/javassist/pom.xml.diff | 15 +++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 projects/javassist/pom.xml.diff diff --git a/projects/javassist/Dockerfile b/projects/javassist/Dockerfile index 30741bb18..ca66349ab 100644 --- a/projects/javassist/Dockerfile +++ b/projects/javassist/Dockerfile @@ -26,4 +26,5 @@ RUN git clone --depth 1 https://github.com/jboss-javassist/javassist.git COPY build.sh $SRC/ COPY ClassFuzzer.java $SRC/ +COPY pom.xml.diff $SRC/javassist WORKDIR $SRC/javassist diff --git a/projects/javassist/build.sh b/projects/javassist/build.sh index b7c44e187..b4890d069 100644 --- a/projects/javassist/build.sh +++ b/projects/javassist/build.sh @@ -15,6 +15,13 @@ # ################################################################################ +git apply pom.xml.diff +mv ./src/main ./src/java +mkdir ./src/main +mv ./src/java ./src/main/java +mv ./src/test ./src/java +mkdir ./src/test +mv ./src/java ./src/test/java MAVEN_ARGS="-Djavac.src.version=15 -Djavac.target.version=15 -DskipTests" $MVN package org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade $MAVEN_ARGS diff --git a/projects/javassist/pom.xml.diff b/projects/javassist/pom.xml.diff new file mode 100644 index 000000000..8e3c6c12f --- /dev/null +++ b/projects/javassist/pom.xml.diff @@ -0,0 +1,15 @@ +diff --git a/pom.xml b/pom.xml +index a604e16..52c8a7b 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -138,8 +138,8 @@ + + + +- src/main/ +- src/test/ ++ src/main/java/ ++ src/test/java/ + + + src/test/resources