Skip to content

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

Merged
khatchad merged 2 commits into
masterfrom
fix-jython3-test-pom-recursive-resource-fork
May 8, 2026
Merged

Scope jython3.test's build resource to stop target/ self-recursing#265
khatchad merged 2 commits into
masterfrom
fix-jython3-test-pom-recursive-resource-fork

Conversation

@khatchad

@khatchad khatchad commented May 7, 2026

Copy link
Copy Markdown
Member

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 under jython/, but the pom is otherwise identical and has the same recursive-resource bug.

Problem

com.ibm.wala.cast.python.jython3.test/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. 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 excluding target/ from the resource scope.

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

Sibling com.ibm.wala.cast.python.test/pom.xml does 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 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)
logging.properties symlink to ../logging.properties, copied into the JAR

All three currently ship in the Maven JAR (verified via jar tf); moving them under a single resources/ subdir would break Eclipse PDE consumers. An <includes> filter is the minimal-diff fix that preserves the JAR shape.

Verification

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

Result:

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

$ du -sh 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.
  • CI confirms.

…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/...` &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.
Copilot AI review requested due to automatic review settings May 7, 2026 20:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 in target/classes and the built JAR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@khatchad khatchad added this pull request to the merge queue May 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks May 8, 2026
@khatchad khatchad enabled auto-merge May 8, 2026 13:35
@khatchad khatchad added this pull request to the merge queue May 8, 2026
@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.02%. Comparing base (3eac854) to head (70bac39).

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.
📢 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.

Merged via the queue into master with commit fee8d48 May 8, 2026
11 checks passed
@khatchad khatchad deleted the fix-jython3-test-pom-recursive-resource-fork branch May 8, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants