I’m writing a custom (software model) plugin that generates distributions for every combination of platform, build type and flavor using all available components in the project. The problem is that the
PlatformContainer instance is empty. In the Gradle User Guide, it says that
If no platforms are defined in a project, then a single, default platform ‘current’ is added.
I couldn’t find where a ‘current’ platform is added, the closest I got to was NativeComponentRules.resolvePlatforms which resolves the platforms for a given binary, and if none are found, a default one is returned.
If the empty platform container is the expected behavior, I think the user guide should probably be updated (maybe just change
used?). Either way, how can I obtain the Platform representing the current platform? Should I do the same as in
NativeComponentRules (using internal API, such as
DefaultPlatformRequirement)? Or is there an easier or more future-proof way?