gradle / gradle/gradle-native

Remove mutable state from NativePlatform

Open
#596 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
94
Forks
7
PR merge metrics
No merged PRs in 30d

Description

In the new plugin binary types, we expose `NativePlatform` via `CppPlatform` and `SwiftPlatform`. These are intended to be immutable.

All of the existing native compilation/linking tasks use `NativePlatform` to identify the target machine's architecture and operating system. Internally, this type (or `NativePlatformInternal`) is used all over to select tool chains/tools. Effectively, the native platform needs to be immutable for this to all line up properly.

Because `NativePlatform` is also used in the software model for creating new target `Platform`s, it's mutable. We expose this mutability by reusing this type/interface.

We introduced a `OperatingSystemFamily` in 4.7 that carries some of the same information as `OperatingSystem` (a property of `NativePlatform`) and is used as an attribute in dependency management. This is an immutable property of `NativePlatform`.

Users should prefer the immutable `operatingSystemFamily` over `operatingSystem`, but we should also try to remove the mutability that exists.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.