-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
New switches for alr build
to apply profile to all dependencies
#1119
New switches for alr build
to apply profile to all dependencies
#1119
Conversation
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.
I am ok on the feature in principle, I am not sure about switches.
Why not use existing switches with an extra suffix:
--validation-all
--development-all
--release-all
(This one is not so useful as it would be the same as--release
)
I prefer this way because it seems more compact/maintainable than having three varieties per profile (when counting the (Minor aside: |
|
Right. And Also I just saw in the help for alire build that it talks about build modes and not profiles.
I checked Perhaps we could reconsider our |
You can also loose a lot in terms of performances and code size. I think release mode is a safest default for the future of the project as the number of dependencies grows. @onox you are working on a set of crates all at once, and I guess you want them all in debug mode. So a different default would be better for your use case, but I am not convinced that it would be good for everyone. How about a |
But if a user chooses As @mosteo said, it's counterintuitive that the dependencies are always built in release mode, and I think it violates the law of least astonishment. From the output of
This would be cumbersome to a user if the crate has many dependencies that cannot be catched by a glob pattern. It would also create too much flexibility for the problem of whether the build mode applies only to the crate itself or also to its dependencies. Perhaps we should seek the feedback of a number of users? Here, on the Discussions page, or on gitter. |
First of all, I was wrong in assuming that the current
(Related: cargo has a benchmark profile. Perhaps that's the one where such omissions should be introduced.) That said, I'd like simply to have an easy way of having a full build with the same profile everywhere without messing with manifests. I'm okay with keeping the current default. I'm currently leaning to the I've created this poll: #1140 |
c65f0cd
to
bbb37f2
Compare
Okay, so after playing a bit more with the switches I wanted, and some internal changes now needed to ensure consistency of generated files between builds, and remembering that we have the aliases feature, I found the simplest and less confusing change is along the lines of @Fabien-Chouteau suggestion. So after my last push there's a single extra switch `alr build --profiles '*:development,some_crate:validation' Also I have added two aliases, There's a second wildcard, '%', that sets only the crates without an explicit setting in a manifest (the The poll as I write gives a 30/70 split in expectations against the current behavior. If we were to change it, then the current behavior could be obtained with |
That's the best option in my opinion. We can also accept shortcut names like
I think we should keep at least
I don't think that aliases are the way to go here, the switches are short enough.
I am not sure this is worth the extra complexity. In my opinion people will either set profile in the manifest or on the command line, using both seems like a corner case.
Changing the default behavior is a no-go for me. Building everything in dev mode might be ok in some situations but it won't scale up, we have to be future proof. |
We are not equal in the astonishment department :) I would be astonished to see warnings and style checks for dependencies I don't care about. Or not being able to have my embedded code fit in flash memory because dependencies of dependencies of my dependencies are compiled in debug mode.
So what about the latest proposal? |
These switches remain; only
Not a sticking point. One can define their own aliases if it proves too tiresome anyway.
This is eyeing cases in which crates themselves known that some profiles won't work as-is and define their own override in the manifest. If they're deep in your dependencies it can be helpful if you want a "mostly"-homogeneous build. And, for example, our current default behavior couldn't be replicated otherwise in other combos (e.g. root in validation mode plus dependencies in dev mode, but respecting manifests). I'd say it's worthy and not that complex internally, just an extra map.
I'd say the current status gives us all what we want in a clear way, and behavior when not using |
b549dd9
to
ee1968d
Compare
Now we keep track of all dependencies' profiles, so any individual change can be detected and config files regenerated accordingly.
ee1968d
to
c9d220a
Compare
@@ -25,13 +25,18 @@ with TOML; use TOML; | |||
|
|||
package body Alire.Crate_Configuration is | |||
|
|||
Separator : constant Character := ','; | |||
Assign : constant Character := ':'; |
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.
Why not =
for assign?
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.
I was in a mindset of mappings, JSON-style, and it seemed a bit less ugly than --profiles=crate=profile
. I'm trying to remember if we have something similar in another place to follow convention. It's true that TOML uses = for maps...
src/alr/alr-commands-build.adb
Outdated
end if; | ||
end To_Profile; | ||
|
||
Sep : constant Character := ','; |
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.
Duplicates of constants in Alire.Crate_Configuration
.
Thanks @Fabien-Chouteau and everyone for the involvement with this feature. |
Two new switches that allow to apply a profile to the complete solution without having to edit the manifest:
alr build --validation --recurse-all
# Overrides all cratesalr build --validation --recurse-unset
# Overrides only crates without explicit settings in manifestsThese require an explicit profile to apply.
The use case is when you want to e.g. make a one-shot full debug/validation build.