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

Alr.Commands.Exec: -P switch to add project file on the command line #956

Merged
merged 2 commits into from
Mar 29, 2022

Conversation

Fabien-Chouteau
Copy link
Member

  • Alr.Commands: Add built-in aliases for gnatcov and gnatprove

@Fabien-Chouteau Fabien-Chouteau requested a review from mosteo March 28, 2022 16:28
Comment on lines +30 to +39
.New_Line
.Append ("The ""-P"" switch can be used to ask Alire to insert a ")
.Append ("""-P <PROJECT_FILE>"" switch to the command arguments.")
.Append ("""-P"" takes an optional position argument to specify where")
.Append ("to insert the extra switch. ""-P1"" means first position, ")
.Append ("""-P2"" second position, etc. ""-P-1"" means last position, ")
.Append ("""-P-2"" penultimate position, etc. ""-P"" equals ""-P1"".")
.Append ("For example ""alr exec -P2 -- python3 main.py arg1"" will")
.Append ("run the following command:")
.Append ("[""python3"", ""main.py"", ""-P"", ""crate.gpr"", ""arg1""]")
Copy link
Member

Choose a reason for hiding this comment

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

I'm not understanding the rationale behind this. What is the problem with placing the -P after the -- wherever you want it, basically.

Copy link
Member Author

Choose a reason for hiding this comment

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

The goal is to be able to provide a cleaner interface for tools that use project file, e.g. the two built-in aliases in the second patch.

At first I was going to create dedicated commands for gnatprove and gnatcov but I quickly realize that those two commands will just be duplicated code compared to the exec command. So I improving exec to be able to run tools that require project file.

Since Alire already knows the project file for the crate, it seems suboptimal to ask the user to provide it.
We don't do alr build -- -P hello.gpr for instance. I want the same for gnatprove, gnatcov and other tools in the future.

Copy link
Member

Choose a reason for hiding this comment

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

All right, so the trick here is that we want to reuse the manifest project list. I think I understand now, thanks!

@mosteo mosteo merged commit 56a9051 into master Mar 29, 2022
@mosteo mosteo deleted the exec_with_project_file branch March 29, 2022 09:58
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.

2 participants