Hello again! I would like to push on this a liittle more with the collected wisdom of this group please.
After some amateur perusal of the bazel codebase, I think the right place to end up here would be a Skylark-driven API around a derivation of (or delegating implementation of) SpawnStrategy, which would allow us to generate a commandline prefix per target based on the transitive closure of values of some set of providers across the dependencies of the target. This would then provide us with finegrained control of the execution environment, with whatever setup/teardown code the build platform requires.
I am not sure what that api would look like, as it's a completely cross cutting concern which we would want to apply across all kind of rules (i.e. in-workspace rules, thirdparty skylark-native rules, and java-native rules (such as JavaCompileAction). Perhaps adding a new Provider class, with an instance per toolchain would be a good start. Then perhaps an aspect for the collection and merge into a PrefixProvider? And then when you configure the new SpawnStrategy, you point it at that aspect.
Thoughts? In fact perhaps the only thing we need is the last thing, as everything else can be totally user-defined...
Thanks for your time!