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

[MSHARED-1351] Fix console message when origin is baseDir #93

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

abelsromero
Copy link
Contributor

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    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.
    👉 https://issues.apache.org/jira/browse/MSHARED-1351?jql=component%20%3D%20maven-filtering%20
  • Each commit in the pull request should have a meaningful subject line and body.
    🤞
  • Format the pull request title like [MSHARED-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace MSHARED-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
    👉 [MSHARED-1351] - Fix console message when origin is baseDir
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.

Checks when the path for the message is empty, then replaces that empty with "base dir" to avoid an invalid message.
I considered directly comparing paths

String origin;
if (basedir.equals(resourceDirectory)) {
    origin = "base directory";
} else {
    origin = basedir.relativize( resourceDirectory.getAbsoluteFile().toPath()) .toString();
}

It's more expressive, but that adds extra path processing that are not necessary if we simply check the relativized result.

PS: run

  • Run mvn clean verify -Prun-its to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
    🆗 The profile does not exist btw, simply run mvn clean verify and mvn spotless:apply to fix formatting.

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.

@abelsromero
Copy link
Contributor Author

Sent signed the CLA to the required address.

@abelsromero abelsromero force-pushed the MSHARED-1351 branch 2 times, most recently from c0463c0 to 21c6685 Compare January 13, 2024 13:33
@abelsromero
Copy link
Contributor Author

I see Windows failures for path format, I'll see to it later.

@abelsromero
Copy link
Contributor Author

Run a customized pipeline on a fork and now Windows passes https://github.com/abelsromero/maven-filtering/actions/runs/7590061551

@abelsromero
Copy link
Contributor Author

Anything else I should be checking? I don't any have anything identified.

Print alternative message replacing the relative origin path
by the literal 'base directory'.
@abelsromero
Copy link
Contributor Author

Fixed the formatting, is there a way to run the pipeline without manual intervention?

@abelsromero abelsromero requested a review from hboutemy February 1, 2024 14:58
@abelsromero
Copy link
Contributor Author

Hi, all seems green in CI, except for 1 job that was mysteriously canceled. 🤷 Is there anything else that needs my attention in the PR? Thanks

@slachiewicz
Copy link
Member

recently I've fixed similar code here codehaus-plexus/plexus-compiler#364

@abelsromero
Copy link
Contributor Author

recently I've fixed similar code here codehaus-plexus/plexus-compiler#364

Not sure is the same thing. I don't have context on the other project, but the issue is that relativize will return an empty string in some cases, not an exception. Seems to me that the issue could still happen in plexus-compiler .

@gnodet gnodet merged commit 1a51fee into apache:master Feb 26, 2024
19 checks passed
@gnodet gnodet added this to the 3.3.2 milestone Feb 26, 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.

4 participants