matchesSpecification

Matches a platform specification string against a build platform.

Specifications are build upon the following scheme, where each component is optional (indicated by []), but the order is obligatory: "[-platform][-architecture][-compiler]"

So the following strings are valid specifications: "-windows-x86-dmd", "-dmd", "-arm", "-arm-dmd", "-windows-dmd"

bool
matchesSpecification

Parameters

platform

The build platform to match agains the platform specification

specification
Type: const(char)[]

The specification being matched. It must either be an empty string or start with a dash.

Return Value

Type: bool

true if the given specification matches the build platform, false otherwise. Using an empty string as the platform specification will always result in a match.

Examples

1 auto platform=BuildPlatform(["posix", "linux"], ["x86_64"], "dmd");
2 assert(platform.matchesSpecification(""));
3 assert(platform.matchesSpecification("-posix"));
4 assert(platform.matchesSpecification("-linux"));
5 assert(platform.matchesSpecification("-linux-dmd"));
6 assert(platform.matchesSpecification("-linux-x86_64-dmd"));
7 assert(platform.matchesSpecification("-x86_64"));
8 assert(!platform.matchesSpecification("-windows"));
9 assert(!platform.matchesSpecification("-ldc"));
10 assert(!platform.matchesSpecification("-windows-dmd"));

Meta