Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only add matching fragments to the classpath #4408

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

laeubi
Copy link
Member

@laeubi laeubi commented Nov 4, 2024

Supersedes #4293

@laeubi laeubi changed the title Pr 4293 Only add matching fragments to the classpath Nov 4, 2024
HeikoKlare and others added 2 commits November 4, 2024 10:20
When compiling a fragment for whose hose a fragment exists in a P2 repo
referenced by the build (even if the platform filter does not match),
the classes from that fragment are put on the classpath, such that code
in the currently compiled fragment is illegally compiled against that
fragment code.

This change adds a test case that demonstrates the behavior via a
fragment that uses code from another fragment, which is must not depend
on.
Currently all discovered fragments are added to the classpath of a
project for all os/ws combinations. But in the case of os-specific
fragments this is actually wrong and can lead to strange results as
classpath order now controls what classes are visible at compile time.

This now determines the configured environments for a project and only
add those fragments that either have no filter or match any of the given
environments.
@HeikoKlare
Copy link
Contributor

Awesome. Thank you, @laeubi! 🥇

I have not taken a look at the change itself, but I have successfully tested whether it fixes the original issue (in the SWT build). To do so, I did the following on a MacOS laptop:

  • Compiled and installed Tycho based on current 4.0.x branch and ran the SWT build with that version. This results in the build failure (during testCompile of the Windows fragments) as reported here: Update to Tycho 4.0.9 eclipse-platform/eclipse.platform.releng.aggregator#2360 (comment)
  • Cherry-picked the fix of this PR to the 4.0.x branch, compiled and installed Tycho version based on that state, and ran the SWT build with that version again. This succeeds without the build failure during testCompile of the Windows fragments.

I ran the builds multiple times to hopefully exclude any potential flaky behavior.

Copy link

github-actions bot commented Nov 4, 2024

Test Results

  603 files    603 suites   4h 20m 28s ⏱️
  431 tests   423 ✅  7 💤 1 ❌
1 293 runs  1 270 ✅ 22 💤 1 ❌

For more details on these failures, see this check.

Results for commit 7ee7426.

@laeubi
Copy link
Member Author

laeubi commented Nov 4, 2024

Thanks for the verification, I also see the test testSWTFragmentsAttached_unmatchingFromP2 passing here now (just Jenkins is slow today...)

Once this is backported we can probably use Tycho 4.0.10-SNAPSHOT for the platform builds.

@laeubi laeubi enabled auto-merge (rebase) November 4, 2024 11:10
@laeubi laeubi added the backport-to-tycho-4.0.x Can be added to a PR to trigger an automatic backport of the change label Nov 4, 2024
@laeubi laeubi merged commit 6ae5ee9 into eclipse-tycho:main Nov 4, 2024
14 of 16 checks passed
@eclipse-tycho-bot
Copy link

💚 All backports created successfully

Status Branch Result
tycho-4.0.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

1 similar comment
@eclipse-tycho-bot
Copy link

💚 All backports created successfully

Status Branch Result
tycho-4.0.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-tycho-4.0.x Can be added to a PR to trigger an automatic backport of the change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants