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

#498: resolve variables on load #691: solve sub-node merging #912

Merged
merged 12 commits into from
Jan 16, 2025

Conversation

hohwille
Copy link
Member

@hohwille hohwille commented Jan 11, 2025

fixes #498 and fixes #691

  • fixed variable resolution bug
  • resolve variables directly after loading XML (Improvement of XML merger: resolve before merge #498)
  • completely refactored XmlMerger (avoid Wrappers for Element and Attr, avoid mutation of template XML)
  • smart fallbacks for merge:id
  • added caching of first merge:id per QName
  • changed fallback for merge:strategy to combine as this is the only default that makes sense
  • fixed several bugs
  • solved sub-node merging issue for Intellij problems (XMLMerger can not handle merge of subnodes properly #691)
  • test enhancements
  • added missing JavaDocs
  • renamed all source.xml to template.xml to avoid confusion
  • renamed local variables to be consistent (template vs. update vs. setup, result vs. target, workspace vs. target vs. update)

Open tasks:

  • CHANGELOG needs to be added
  • we could add more robustness: I had situations where I ended up with an empty XML file in my workspace. The could then not be parsed on the next run and was stuck until manual repair. An empty workspace file should be treated as if it did not exist. Also we could discuss how to deal with corrupted XML files that cannot be parsed. However, the good news is that we (or better saying @salimbouch) already have done a lot: There is robustness so a file causing an error is logged but the process is not blocked but continues. If there have been errors the user gets informed and asked to continue. Also the error logging is very precise including the absolute path of the XML files involved and the XPath within the XML document where the error happened. This is great stuff for analysing the root problem and will help us a lot in support (or prevent us from support requests as the users can help themselves).

@hohwille hohwille added configuration should be configurable or configuration change merger labels Jan 11, 2025
@hohwille hohwille added this to the release:2025.01.001 milestone Jan 11, 2025
@hohwille hohwille self-assigned this Jan 11, 2025
@hohwille
Copy link
Member Author

For the record: I did not change any testdata semantically. I just followed convention-over-configuration and prefer consistent usage of lowercase for merge:strategy enum values. We should strictly and consistently align such things both in testdata and especially in ide-settings (PR not yet created). Our users will take us by example. If even we do not systematically align this then we can expect a lot of mess in the projects we later have to support.

@coveralls
Copy link
Collaborator

coveralls commented Jan 11, 2025

Pull Request Test Coverage Report for Build 12814582559

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 24 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.3%) to 68.152%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/merge/xmlmerger/matcher/IdComputer.java 4 79.03%
com/devonfw/tools/ide/merge/xmlmerger/XmlMerger.java 20 78.54%
Totals Coverage Status
Change from base Build 12814567403: 0.3%
Covered Lines: 7021
Relevant Lines: 9932

💛 - Coveralls

@hohwille
Copy link
Member Author

CHANGELOG needs to be added

@hohwille hohwille added the reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented. label Jan 14, 2025
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@salimbouch salimbouch left a comment

Choose a reason for hiding this comment

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

LGTM

@hohwille hohwille merged commit a3f76b6 into devonfw:main Jan 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration should be configurable or configuration change merger reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

XMLMerger can not handle merge of subnodes properly Improvement of XML merger: resolve before merge
4 participants