Skip to content

Commit

Permalink
OC-102: fixing package relocations (#263)
Browse files Browse the repository at this point in the history
* OC-102: fixed package relocations and jar minimization as not all necessary classes were present as well as not all class references were relocated; changed inclusion patterns to '**' as single '*' caused only top-level classes to be relocated; removed clover-velocity module from the project; fixed a problem of *.properties files relocation in Velocity by storing shaded versions of these files in src/main/resources in clover-core; updated imports by removing 'clover.' prefix in source files; used repacked 'clover' artifact instead of 'clover-core' in org.openclover.eclipse.core dependencies; hidden VelocityContext behind VelocityContextBuilder as there were problems in clover-eclipse (shaded vs non-shaded VelocityContext); moved PlainTextVelocityResourceLoader to clover-core and used in a factory method HtmlReportUtil#newVelocityEngine; delete jarjar as it's no longer needed; enabled jar minimization, but with fine-tuned configuration - we must keep all velocity classes, also classes referenced by velocity such as commons-lang
  • Loading branch information
marek-parfianowicz authored Jul 5, 2024
1 parent 264e488 commit aca4e55
Show file tree
Hide file tree
Showing 50 changed files with 551 additions and 389 deletions.
1 change: 0 additions & 1 deletion .github/workflows/A-build-and-test-jdk11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:

- name: Prepare third party libraries
run: |
mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/A-build-and-test-jdk17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:

- name: Prepare third party libraries
run: |
mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/A-build-and-test-jdk21.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:

- name: Prepare third party libraries
run: |
mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/A-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:

- name: Prepare third party libraries
run: |
mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/B-combatibility-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:

- name: Prepare third party libraries
run: |
mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/D-release-openclover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:

- name: Prepare third party libraries
run: |
mvn --batch-mode install -f clover-core-libs/jarjar/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-core-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-eclipse-libs/pom.xml
mvn --batch-mode install -Pworkspace-setup -f clover-idea-libs/pom.xml
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ See also:
### Prepare repacked third party libraries

```
mvn install -f clover-core-libs/jarjar/pom.xml
mvn install -Pworkspace-setup -f clover-core-libs/pom.xml
mvn install -Pworkspace-setup -f clover-eclipse-libs/pom.xml
mvn install -Pworkspace-setup -f clover-idea-libs/pom.xml
Expand Down
4 changes: 2 additions & 2 deletions clover-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
<artifactId>jfreechart</artifactId>
</dependency>
<dependency>
<groupId>org.openclover</groupId>
<artifactId>clover-velocity</artifactId>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
</dependencies>
<build>
Expand Down
108 changes: 0 additions & 108 deletions clover-core-libs/clover-velocity/pom.xml

This file was deleted.

72 changes: 0 additions & 72 deletions clover-core-libs/jarjar/pom.xml

This file was deleted.

1 change: 0 additions & 1 deletion clover-core-libs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<modules>
<module>cajo</module>
<module>fastutil</module>
<module>clover-velocity</module>
</modules>
</profile>
</profiles>
Expand Down
45 changes: 41 additions & 4 deletions clover-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
<artifactId>jfreechart</artifactId>
</dependency>
<dependency>
<groupId>org.openclover</groupId>
<artifactId>clover-velocity</artifactId>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
<!-- other libraries -->
<dependency>
Expand Down Expand Up @@ -345,7 +345,7 @@
<include>org.jfree:jcommon</include>
<include>jdom:jdom</include>
<include>org.jfree:jfreechart</include>
<include>org.openclover:clover-velocity</include>
<include>org.apache.velocity:velocity</include>
</includes>
</artifactSet>
<filters>
Expand All @@ -357,6 +357,9 @@
</filter>
<filter>
<artifact>commons-collections:commons-collections</artifact>
<includes>
<include>org/apache/commons/collections/**</include>
</includes>
<excludes>
<exclude>META-INF/LICENSE.txt</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
Expand All @@ -371,6 +374,12 @@
</filter>
<filter>
<artifact>commons-lang:commons-lang</artifact>
<includes>
<!-- used by velocity -->
<include>org/apache/commons/lang/*</include>
<include>org/apache/commons/lang/builder/*</include>
<include>org/apache/commons/lang/text/*</include>
</includes>
<excludes>
<exclude>META-INF/LICENSE.txt</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
Expand Down Expand Up @@ -401,17 +410,27 @@
<artifact>com.lowagie:itext</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>ant/*</exclude>
<exclude>build.xml</exclude>
</excludes>
</filter>
<filter>
<artifact>org.jfree:jcommon</artifact>
<!-- minification removes resource bundle classes, must include everything, unfortunately -->
<includes>
<include>org/jfree/**</include>
</includes>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
<filter>
<artifact>org.jfree:jfreechart</artifact>
<!-- minification removes resource bundle classes, so we must include most packages, unfortunately -->
<includes>
<include>org/jfree/chart/**</include>
<include>org/jfree/data/**</include>
</includes>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
Expand All @@ -420,12 +439,23 @@
<artifact>jdom:jdom</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/LICENSE.txt</exclude>
<exclude>META-INF/info.xml</exclude>
</excludes>
</filter>
<filter>
<artifact>org.openclover:clover-velocity</artifact>
<artifact>org.apache.velocity:velocity</artifact>
<includes>
<!-- keep all classes from velocity -->
<include>org/apache/velocity/**</include>
</includes>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/NOTICE</exclude>
<!-- we have shaded versions of these in src/main/resources -->
<exclude>**/directive.properties</exclude>
<exclude>**/velocity.properties</exclude>
<exclude>**/texen.properties</exclude>
</excludes>
</filter>
</filters>
Expand Down Expand Up @@ -474,6 +504,13 @@
<include>org.apache.commons.lang3.**</include>
</includes>
</relocation>
<relocation>
<pattern>org.apache.velocity</pattern>
<shadedPattern>clover.org.apache.velocity</shadedPattern>
<includes>
<include>org.apache.velocity.**</include>
</includes>
</relocation>
<relocation>
<pattern>org.jdom</pattern>
<shadedPattern>clover.org.jdom</shadedPattern>
Expand Down
Loading

0 comments on commit aca4e55

Please sign in to comment.