Scope jython3.test's build resource to stop target/ self-recursing#265
Merged
Conversation
…sively into itself. Fork-side companion to wala#493 (which fixes the same bug at upstream's `jython/com.ibm.wala.cast.python.jython3.test/pom.xml`). On the fork the module sits at the repo root (`com.ibm.wala.cast.python.jython3.test/`) rather than under `jython/`, but the pom is otherwise identical and has the same recursive-resource bug: ```xml <resources> <resource> <directory>.</directory> </resource> </resources> ``` Maven copies the resource directory into `target/classes/` on every build. Since `target/` is itself at the module root, repeated rebuilds nest `target/classes/target/classes/target/...` — a local checkout hit 99 GB before being noticed. Sibling `com.ibm.wala.cast.python.test/pom.xml` does it correctly with `<directory>data</directory>`. That sibling has no Eclipse PDE bundle metadata at the module root, so the single-subdir pattern works there. This module ships Eclipse PDE metadata (`META-INF/MANIFEST.MF`, `build.properties`, `logging.properties`) that downstream OSGi consumers expect at the bundle root, so a direct port of the sibling pattern would either drop those resources or break Eclipse PDE. Scoping via an explicit `<includes>` filter listing the three resource entries preserves the JAR contents while excluding `target/` from the resource scope. Verified locally: two consecutive `mvn clean install` + `mvn install` cycles produce a flat `target/classes/` (`META-INF/`, `build.properties`, `logging.properties`, compiled `com/`); no `target/classes/target/` recursion; total `target/` size 184 KB.
There was a problem hiding this comment.
Pull request overview
This PR fixes a Maven build-resource configuration issue in com.ibm.wala.cast.python.jython3.test where declaring the module root (.) as a resource can cause target/ to be copied into itself across successive builds, leading to explosive disk growth.
Changes:
- Restricts the module’s build resources to an explicit allowlist (
META-INF/**,build.properties,logging.properties). - Prevents
target/(and other unintended module-root contents) from being recursively included intarget/classesand the built JAR.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #265 +/- ##
=========================================
Coverage 69.02% 69.02%
Complexity 2277 2277
=========================================
Files 223 223
Lines 18029 18029
Branches 2966 2966
=========================================
Hits 12444 12444
Misses 4419 4419
Partials 1166 1166 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fork-side companion to wala/ML#493 (which fixes the same bug at upstream's
jython/com.ibm.wala.cast.python.jython3.test/pom.xml). On the fork the module sits at the repo root rather than underjython/, but the pom is otherwise identical and has the same recursive-resource bug.Problem
com.ibm.wala.cast.python.jython3.test/pom.xmldeclares its build resource as the module root:Maven copies that into
target/classes/on every build. Sincetarget/is itself at the module root, the second build copies the previous build'starget/intotarget/classes/target/; the third copies that intotarget/classes/target/classes/target/; and so on. Each level contains the module's own*-SNAPSHOT.jar, so disk usage grows exponentially — on a local checkout this had reached 99 GB after a handful ofmvn installcycles. Full diagnosis at wala/ML#494 (the upstream bug-tracking issue; ponder-lab has issues disabled, so it lives on wala).Fix
Scope the resource via an explicit
<includes>filter listing the three entries that need to be on the classpath (META-INF/**,build.properties,logging.properties). Preserves the JAR contents while excludingtarget/from the resource scope.Why an
<includes>filter rather than a different<directory>Sibling
com.ibm.wala.cast.python.test/pom.xmldoes it correctly with<directory>data</directory>— the cleanest pattern. It doesn't directly apply here because that sibling has no Eclipse PDE bundle metadata at the module root (its only resource is thedata/subdir). This module ships Eclipse PDE metadata that needs to live at the bundle root:META-INF/MANIFEST.MFBundle-SymbolicName,Export-Package,Require-Bundle); Eclipse PDE looks for it at the bundle rootbuild.propertiessource../bin.includes)logging.properties../logging.properties, copied into the JARAll three currently ship in the Maven JAR (verified via
jar tf); moving them under a singleresources/subdir would break Eclipse PDE consumers. An<includes>filter is the minimal-diff fix that preserves the JAR shape.Verification
Result:
No self-referential
target/classes/target/, no jar-of-jars-of-jars. Total moduletarget/size 184 KB (vs. 99 GB pre-fix on multi-build accumulations).Test plan
target/classes/(above).