-
Notifications
You must be signed in to change notification settings - Fork 28
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
[MSHARED-1285] use an up-to-date scanner instead the newscanner #77
Conversation
Any chances to get some progress into this PR? From an Eclipse user perspective this issue is really annoying as some resources are not copied to the target/classes folder. //cc @khmarbaise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are failing.
Is there any way to do this that doesn't use plexus at all? E.g. something in commons-io instead?
obviously not... |
FWIW, the (single) test failure I get with this PR is this one:
I don't know anything about this project/codebase, but as an Eclipse user impacted by this I was curious, and the last PR build is too old and the failure logs are not available anymore. |
@laeubi would it be possible to add a unit test that showcases the issue and the proposed fix? |
It should be possible to reproduce the problem a testcase should be setup like this:
Result is only Another case is that you modify the target file (but not the source) then the mojo will never update that file as long as one do not modify the source file. |
I dig into the test issue. Test verifies the following behavior:
I think there is an issue with the test implementation. Not sure why, but the original code does not trigger So the issue for this test failure is in TestIncrementalBuildContext (org.sonatype.plexus:plexus-build-api:tests). Not sure how to handle this.
|
@lalmeras many many thanks for looking into the test!
This is actually deprecated/removed in later versions exactly because no one can know what the test wants to assert... so the best would be to simply copy it in the plugin here and adjust as needed, or even better using a mock. |
Already done it (copy/fix TestIncrementalBuildContext). It doesn't work out of the box as there is other tests that rely on this bug to work. And another bug in getRelpath. But I agree the best option is to retrieve/fix/adapt TestIncrementalBuildContext so that the 4 tests that use it work and actually test the effective filtering behavior. Just not as simple as it seems. I plan to work on it. I'll keep this issue updated about my work on it. Once the tests fixed, I think it'll be easier to write a test exposing the current issue. |
Here is a branch with my proposal : https://github.com/lalmeras/maven-filtering/commits/MSHARED-1285
Both commits built with success with java 8 / java 17 / mvn 3.8. I finally understand why old tests work. It is because they relied only on Scanner behavior, and not isUptodate / hasDelta methods. So they accommodate nicely with the buggy TestIncrementalBuildContext. No work done on this issue's testcase. I can work on it if this first proposal seems OK. I do not open another PR; feel free to integrate my proposal in this PR. |
@lalmeras just open a PR for the testcases I think that can be easier to manage also we then have direct PR validation! |
Done ! #82 |
I update my branch https://github.com/lalmeras/maven-filtering/commits/MSHARED-1285 with the following change :
@laeubi I'm not sure to understand what is the current / expected behavior for this use-case. Can you give a more precise description ? |
@lalmeras great to see you make progress on this 👍 For the second case assume the following:
What happens now is that |
@laeubi Can you check lalmeras@dbe1367#diff-a52a7b8a0ff570c181fe18ab238b693c21243d40870dd2d8178340247755bba5R152 ? Pay attention that my test assumes that BuildContext can reply appropriately Am I missing something ? |
@lalmeras I think you are right that m2e assumes that if the target is newer than the source it is up-todate... but I think that can be ignored for now as this is an implementation detail of the context, the important part is that if |
Thank you for your feedback. @laeubi Do you want to update your PR with my proposal so we now both have unit test demonstrating your use case (and failing with the current codebase) and your fix. |
@lalmeras can you open a PR here so we see the test is currently failing? I'll then fetch the PR and add my one on top of it to prove it fixes the failing test! |
Current incremental build does not honor isUptodate(), so changed or removed target resources are not refreshed until sources are modified or a full build is performed. 2 new testcases exhibits this issue (one for missing target resource, one for modified target resource). As stub BuildContext provides appropriate isUptodate results, build should refresh this resources. Current implementation prevents BuildContext implementors to trigger appropriate resource refresh by tweaking isUptodate implementation. See javadoc in BuildContext#newScanner javadoc that advices that incremental build may be performed with a full resource scanning and a isUptodate call to refresh only needed resources.
It currently fails on test-time will need to investigate what it wants here... |
They are test-cases that handle filter modification. Expected behavior (checked by these tests) is to perform a full-build (this is the case where ignoreDelta := true is delta is found on filters). I address this issue in my previous work by adapting your original fix (restoring ignoreDelta behavior, using ignoreDelta to adapt file scan) : see this commit lalmeras@2525912 (I previously posted this comment on #83 :-( ) |
@lalmeras thanks for clarification, thinking more about it I wonder if |
I think ignoreDelta for this case is a well-founded behavior. It checks specifically filter files (not filtered files). If source for filters values is changed, I think it is expected that all resources are refreshed, hence the ignoreDelta. isUptodate usage will not allow you to to reproduce this behavior during the scanning time. |
@lalmeras sounds reasonable, I have now adjust the code accordingly (and slightly restructured the flow), now my local build shows all test passing! |
All checks have passed! |
src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
Outdated
Show resolved
Hide resolved
Currently it could happen that the scanner misses changed files (because they are not part of the delta) or copies files even if they have not changed (e.g. because the output has changes). This uses now a different approach, instead of only handling the delta files, we scan all inputs and compare if they are up-to-date with the output.
Can this be merged? |
Do you have any approx. arrival date for a release including this fix? |
We do not plan releases. Someone has to stand up as RM for this. |
Then the question is maybe is there someone who can drive the release and is willing to do so ... |
I'm doing a review of maven shared projects now and will do a release for this project also. |
Any progress, @slachiewicz? There is a 3.3.2 tag, but the release did not find its way to Maven Central. Do you know why @gnodet? |
The release is still under vote. |
Thanks for the feedback... this is not a publicly visible process, right? |
@OLibutzki the development process of Apache projects generally is public - you can help by testing and casting your vote as well - just reply to the voting mail. However, unless you are part of the project management committee, you vote will not count as binding. A release vote is successful with at least 3 +1 votes after at least 72h and no -1 vote. See https://www.apache.org/foundation/voting.html |
@gnodet Thanks for pushing that release ahead! |
Currently it could happen that the scanner misses changed files (because they are not part of the delta) or copies files even if they have not changed (e.g. because the output has changes).
This uses now a different approach, instead of only handling the delta files, we scan all inputs and compare if they are up-to-date with the output.
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MSHARED-XXX] - Fixes bug in ApproximateQuantiles
,where you replace
MSHARED-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean verify -Prun-its
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.