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

javac doesn't configure output folders of dependent projects correctly #1017

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

snjeza
Copy link

@snjeza snjeza commented Dec 4, 2024

Fixes #1016

@@ -385,7 +385,7 @@ private static Collection<File> classpathEntriesToFiles(JavaProject project, Pre
for (IClasspathEntry transitiveEntry : resolved ) {
if (transitiveEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
IPath outputLocation = transitiveEntry.getOutputLocation();
if (outputLocation != null && select.test(transitiveEntry)) {
if (outputLocation != null && !transitiveEntry.isTest()) {

Choose a reason for hiding this comment

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

The select condition needs to be a parameter, it may take different values depending on the case. So instead of hardcoding the condition here, I think it should instead be tweaked in the parameter of the callers.
Concretely here, what is missing? Is it an entry in the sourcepath or in the classpath? If the former, tweaking line 268 seems better, if the former then line 303 would be a more accurate location to change,

Copy link
Author

Choose a reason for hiding this comment

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

I have updated line 303.

@mickaelistria mickaelistria force-pushed the dom-with-javac branch 2 times, most recently from 7f5c20a to 87832d6 Compare December 6, 2024 13:52
@snjeza snjeza force-pushed the issue-1016 branch 2 times, most recently from cd777ab to c591429 Compare December 9, 2024 16:01
@mickaelistria
Copy link

Thanks. This patch indeed seems simple.
However, I'm still not clear about the issue it fixes. Can you please try to add a test case that covers this change? Otherwise I'm a bit afraid we regress on that case again later.

@snjeza
Copy link
Author

snjeza commented Dec 9, 2024

However, I'm still not clear about the issue it fixes. Can you please try to add a test case that covers this change? Otherwise I'm a bit afraid we regress on that case again later.

The issue happens when a dependent project has a source folder with an output folder. You can try the project (multimodule.zip) from redhat-developer/vscode-java#3885 (comment)

Can you please try to add a test case that covers this change?

How to create a test case for javac?

@mickaelistria
Copy link

You can try to add a test to org.eclipse.jdt.core.tests.javac/.../RegressionTests.java . testBuildMultipleOutputDirectories should be a good one to mimic.

@mickaelistria
Copy link

Note that the test cannot depend on Gradle. Having a non-Gradle reproducer seems important.

@snjeza snjeza changed the title javac doesn't configure output folders of dependent projects correctly [WIP] javac doesn't configure output folders of dependent projects correctly Dec 9, 2024
@snjeza
Copy link
Author

snjeza commented Dec 12, 2024

@mickaelistria I have updated the PR.

@snjeza snjeza changed the title [WIP] javac doesn't configure output folders of dependent projects correctly javac doesn't configure output folders of dependent projects correctly Dec 12, 2024
Copy link

@mickaelistria mickaelistria left a comment

Choose a reason for hiding this comment

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

This change indeed seems good. Thank you.

I suggest we wait for build results before merging. I won't be available until monday, so here are the things to check before a safe merge:

  • the CI Jenkins build completes
  • its number of failures is not superior to the one of the dom-with-javac branch for its parent commit
  • The number of total tests increased to ensure the newly added tests has run

When all these criteria are verified (build should take ~40 minutes to complete, so not too far from now), then please merge this PR.

@datho7561 datho7561 merged commit 08c4e99 into eclipse-jdtls:dom-with-javac Dec 12, 2024
4 of 5 checks passed
@datho7561 datho7561 mentioned this pull request Dec 12, 2024
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.

javac doesn't configure output folders of dependent projects correctly
3 participants