Closed big-guy closed 5 years ago
Another alternative:
Change windows()
and x86()
helpers on TargetMachineFactory
and TargetMachine
into getWindows()
and getx86()
, so in Groovy (and Kotlin?) we can write:
targetMachines = [ machines.windows.x86 ]
Let's go with the getter-approach
After using it and converting our samples.
A simple cross-platform app might look like:
If you were building only for Windows, but for multiple architectures, you could do something like:
On the downsides, you can do something weird (this is very 32-bit):
And the factory-ish parts of TargetMachine seem out of place or maybe hard to find.
In the review, I also raised a couple of other alternatives:
TargetMachine target(Map osAndArch)
I don't like this because it's pretty stringy and not friendly for Kotlin.
TargetMachine target(Action<ConfigurableTargetMachine> action)
This is still pretty stringy, but discoverable.
I'm including this here just so we have it in one place, we don't need to act on this immediately.