Skip to content

Scope jython3.test's build resource to stop target/ self-recursing#493

Merged
khatchad merged 1 commit into
wala:masterfrom
ponder-lab:fix-jython3-test-pom-recursive-resource
May 7, 2026
Merged

Scope jython3.test's build resource to stop target/ self-recursing#493
khatchad merged 1 commit into
wala:masterfrom
ponder-lab:fix-jython3-test-pom-recursive-resource

Conversation

@khatchad
Copy link
Copy Markdown
Collaborator

@khatchad khatchad commented May 7, 2026

Fixes wala/ML#494.

Problem

jython/com.ibm.wala.cast.python.jython3.test's pom.xml declares its build resource as the module root:

<resources>
  <resource>
    <directory>.</directory>
  </resource>
</resources>

Maven copies that into target/classes/ on every build. Since target/ is itself at the module root, the second build copies the previous build's target/ into target/classes/target/; the third copies that into target/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 of mvn install cycles. See #494 for the full diagnosis.

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). This preserves the JAR contents while excluding target/ from the resource scope.

Why an <includes> filter rather than a different <directory>

Looked at the sibling com.ibm.wala.cast.python.test/pom.xml, which scopes its resource as <directory>data</directory> — the cleanest pattern. It doesn't directly apply here because that sibling has no META-INF/ or build.properties at the module root (its only resource is the data/ subdir). This module ships Eclipse PDE metadata that needs to live at the bundle root:

File Why it needs to be at the bundle root
META-INF/MANIFEST.MF OSGi bundle manifest (Bundle-SymbolicName, Export-Package, Require-Bundle); Eclipse PDE looks for it at the bundle root
build.properties Eclipse PDE source/binary mapping (source.. / bin.includes)

Both currently ship in the Maven JAR (verified via jar tf); moving them under a single resources/ subdir would break Eclipse PDE consumers. So the minimal fix that preserves current JAR contents is an explicit <includes> filter.

(The logging.properties entry preserves the current intent — it's a symlink to ../logging.properties, which is broken in master today and silently skipped by Maven; keeping the include is harmless and avoids a behavior delta if the symlink target ever returns.)

Verification

Two consecutive build cycles on the patched module:

mvn -pl jython/com.ibm.wala.cast.python.jython3.test clean install -DskipTests
mvn -pl jython/com.ibm.wala.cast.python.jython3.test install -DskipTests

Result:

$ ls jython/com.ibm.wala.cast.python.jython3.test/target/classes/
META-INF
build.properties
com

$ du -sh jython/com.ibm.wala.cast.python.jython3.test/target
184K

No self-referential target/classes/target/, no jar-of-jars-of-jars. Total module target/ size 184 KB (vs. 99 GB pre-fix on multi-build accumulations).

Test plan

  • Two-cycle local rebuild produces a flat target/classes/ (above).
  • Built JAR contains the same set of resources as before (META-INF/MANIFEST.MF, build.properties, META-INF/maven/...).
  • CI confirms.

…sively into itself.

`com.ibm.wala.cast.python.jython3.test/pom.xml` declares its build resource
as the module root:

```xml
<resources>
  <resource>
    <directory>.</directory>
  </resource>
</resources>
```

Maven copies that into `target/classes/` on every build. Since `target/`
is at the module root, the second build copies the previous build's
`target/` into `target/classes/target/`; the third copies that into
`target/classes/target/classes/target/`; and so on. Each level includes
the module's own `*-SNAPSHOT.jar`, so disk usage grows exponentially
&mdash; on a local checkout this had reached 99 GB after a handful of
`mvn install` cycles.

Sibling `com.ibm.wala.cast.python.test/pom.xml` does it correctly with
`<directory>data</directory>` (scoped to a specific source directory).
This PR scopes the jython3.test resource to just the three entries that
need to be on the classpath (`META-INF/`, `build.properties`,
`logging.properties`) via an `<includes>` filter, so `target/` is never
captured.

Verified locally: two consecutive `mvn clean install` + `mvn install`
cycles produce a `target/classes/` containing only the expected
resources (`META-INF/`, `build.properties`, compiled `com/`); no
self-referential `target/` directory; total `target/` size 184 KB.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.91%. Comparing base (2238db3) to head (5aa2133).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #493      +/-   ##
============================================
- Coverage     57.93%   57.91%   -0.02%     
+ Complexity      625      624       -1     
============================================
  Files           111      111              
  Lines          7671     7671              
  Branches        856      856              
============================================
- Hits           4444     4443       -1     
- Misses         3049     3050       +1     
  Partials        178      178              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@khatchad khatchad added the bug Something isn't working label May 7, 2026
@khatchad khatchad marked this pull request as ready for review May 7, 2026 20:40
Copilot AI review requested due to automatic review settings May 7, 2026 20:40
@khatchad khatchad enabled auto-merge (squash) May 7, 2026 20:42
@khatchad khatchad requested a review from msridhar May 7, 2026 20:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the Maven resource configuration for jython/com.ibm.wala.cast.python.jython3.test to prevent target/ from being recursively copied into build outputs across repeated builds, addressing the exponential disk growth reported in #494.

Changes:

  • Scopes the module’s build resources (still rooted at .) using an explicit <includes> list.
  • Limits copied resources to META-INF/**, build.properties, and logging.properties to avoid pulling in target/ on subsequent builds.

Comment thread jython/com.ibm.wala.cast.python.jython3.test/pom.xml
@khatchad khatchad merged commit ad96543 into wala:master May 7, 2026
6 of 7 checks passed
@khatchad khatchad deleted the fix-jython3-test-pom-recursive-resource branch May 7, 2026 23:22
github-merge-queue Bot pushed a commit to ponder-lab/ML that referenced this pull request May 8, 2026
…sively into itself. (#265)

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/...` &mdash; 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jython3.test's build resource recursively copies target/ into itself, causing exponential disk usage

3 participants