Open michaeleisel opened 4 years ago
You should pass --feature=swift.opt_uses_osize
in your .bazelrc
or something instead of adding them in the features = [],
array
this would apply globally though, no? which would include apps that we want to use -O
for
If you had 2 apps, one that wanted this and one that didn't, and they shared dependencies, and you built both at the same time, what flags would the shared dependencies get? or would you build them twice?
they would be built twice
I don't think bazel has the ability to do this kinda thing 🤔 without maybe creating a macro that created 2 underlying rules, one for each config
For us passing the top level feature works because we never build multiple prod versions of the app in the same invocation
i see, yeah i guess invocation level will do what i want. i just didn't want .bazelrc since then it would apply across multiple invocations. i think it's an adequate solution
Yea makes sense. I do think there's room for a bazel improvement here
I don't think bazel has the ability to do this kinda thing 🤔 without maybe creating a macro that created 2 underlying rules, one for each config
This is exactly what configuration transitions are for
how would that setup look?
It doesn't work with features (they don't propagate down), but you could define a starlark build flag that's used in a transition and then read in a rule implementation
I wonder if any other languages solve this in bazel?
It's how things like CPU and deployment target are propagated for C++/Swift.
Sorry I meant more for optimization stuff
Typically when my co-workers and I are picking between
-O
and-Osize
, we think about it at the app level and not the module level. If one wants to use-Osize
, they would generally want to use it everywhere and not just for specific modules. However, it seems like when this feature is applied to a swift rule, it only affects that rule, and not its recursive dependencies. It would be nice to have some way for the feature to propagate to them.