Skip to content

Make the xaml formatting script work outside the root directory#10268

Merged
DHowett merged 1 commit intomicrosoft:mainfrom
j4james:fix-runformat
Jun 2, 2021
Merged

Make the xaml formatting script work outside the root directory#10268
DHowett merged 1 commit intomicrosoft:mainfrom
j4james:fix-runformat

Conversation

@j4james
Copy link
Collaborator

@j4james j4james commented May 29, 2021

Summary of the Pull Request

When the runformat script was updated to include xaml formatting, the new code failed to work if run from anywhere other than the project root. This PR updates the script so it can be run from anywhere.

PR Checklist

  • Closes runxamlformat doesn't work in the tools directory #9768
  • CLA signed.
  • Tests added/passed
  • Documentation updated.
  • Schema updated.
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

There were a couple of places in the script where it was collecting the list of xaml files by doing git ls-files **/*.xaml. That obviously relies on the code being executed from within the root of the project. I've now updated those queries to prefix the path with the $root variable, which points to the project root.

Validation Steps Performed

I've run the runformat script from within the tools directory and confirmed that it now works correctly from there. I've tested by changing some formatting in both .cpp and .xaml files, and also saved some .xaml files with a BOM to make sure those were appropriately stripped.

@ghost ghost added Area-Build Issues pertaining to the build system, CI, infrastructure, meta Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Meta The product is the management of the products. labels May 29, 2021
Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

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

Great, thank you!

Copy link
Contributor

@PankajBhojwani PankajBhojwani left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

Thanks for this! I recently learned that :(top)**/*.xaml is valid as well and doesn't require propagating the path. Not a concern/complaint of course, just a cool thing. 😄

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jun 1, 2021
@ghost
Copy link

ghost commented Jun 1, 2021

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett DHowett merged commit 147cde2 into microsoft:main Jun 2, 2021
@miniksa miniksa mentioned this pull request Jun 18, 2021
6 tasks
@j4james j4james deleted the fix-runformat branch September 26, 2021 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Build Issues pertaining to the build system, CI, infrastructure, meta AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Meta The product is the management of the products.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runxamlformat doesn't work in the tools directory

6 participants