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 BuildPlatform

The build platform to match agains the platform specification

specification 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

auto platform=BuildPlatform(["posix", "linux"], ["x86_64"], "dmd");
assert(platform.matchesSpecification(""));
assert(platform.matchesSpecification("-posix"));
assert(platform.matchesSpecification("-linux"));
assert(platform.matchesSpecification("-linux-dmd"));
assert(platform.matchesSpecification("-linux-x86_64-dmd"));
assert(platform.matchesSpecification("-x86_64"));
assert(!platform.matchesSpecification("-windows"));
assert(!platform.matchesSpecification("-ldc"));
assert(!platform.matchesSpecification("-windows-dmd"));

Meta