Merge pull request #1656 from MartinNowak/merge_stable
Merge remote-tracking branch 'upstream/stable' into merge_stable
commit c707c032591d4506d7087bc160819bd8f7ee0bb9
2 parents e52567a + 1e83b3e
@Petar Kirov Petar Kirov authored on 24 Feb 2019
GitHub committed on 24 Feb 2019
Showing 14 changed files
View
12
changelog/toolchain_requirements.dd
---
{
"toolchainRequirements": {
"dub": "~>1.10",
"frontend": ">=2.068|<2.083"
"frontend": ">=2.068 <2.083"
}
}
---
 
$(LI ldc)
$(LI gdc)
)
 
Each can be assigned to one or more version specifications, separated by `|`.
For compilers, instead of a version specification, the keyword `no` can also be
used to indicate that the compiler should not be used for this package.
Each can contain a
$(LINK2 https://dub.pm/package-format-sdl.html#version-specs, version specification),
where DMD-like versions are supported in addition to SemVer versions. For
compilers, instead of a version specification, the keyword `no` can also be used
to indicate that the compiler should not be used for this package.
 
Example scenario:$(BR)
Package that needs DUB>=1.12, and that will only build with LDC>=1.10:
 
View
41
source/dub/compilers/compiler.d
*/
module dub.compilers.compiler;
 
public import dub.compilers.buildsettings;
public import dub.dependency : Dependency;
public import dub.platform : BuildPlatform, matchesSpecification;
 
import dub.internal.vibecompat.core.file;
import dub.internal.vibecompat.core.log;
void invokeLinker(in BuildSettings settings, in BuildPlatform platform, string[] objects, void delegate(int, string) output_callback);
 
/// Convert linker flags to compiler format
string[] lflagsToDFlags(in string[] lflags) const;
 
/// Get the dependency requirement string for this compiler
string toolchainRequirementString(const ref ToolchainRequirements tr);
 
/// Check whether the compiler meet the compiler requirement specified
/// in the recipe.
bool checkCompilerRequirement(const ref BuildPlatform platform, const ref ToolchainRequirements tr);
 
/// Check if the compiler is supported by the recipe
final bool checkCompilerSupported(const ref ToolchainRequirements tr)
{
const str = toolchainRequirementString(tr);
return str != ToolchainRequirements.noKwd;
}
 
/// Check whether the compiler meet the frontend requirement specified
/// in the recipe.
final bool checkFrontendRequirement(const ref BuildPlatform platform, const ref ToolchainRequirements tr)
{
import std.typecons : Yes;
 
return checkRequirement(tr.frontend, platform.frontendVersionString, Yes.dmdVer);
}
 
/// Check that a particular tool version matches with a given requirement
final bool checkRequirement(const string requirement, const string toolVer, const Flag!"dmdVer" dmdVer)
{
import dub.compilers.utils : dmdLikeVersionToSemverLike;
import dub.dependency : Dependency, Version;
import std.algorithm : all, map, splitter;
 
if (!requirement.length) return true; // no requirement
 
const ver = Version(dmdVer ? dmdLikeVersionToSemverLike(toolVer) : toolVer);
 
return requirement
.splitter('|')
.map!(r => Dependency(dmdVer ? dmdLikeVersionToSemverLike(r) : r))
.all!(r => r.matches(ver));
}
 
/** Runs a tool and provides common boilerplate code.
 
This method should be used by `Compiler` implementations to invoke the
View
source/dub/compilers/dmd.d
View
source/dub/compilers/gdc.d
View
source/dub/compilers/ldc.d
View
source/dub/compilers/utils.d
View
source/dub/dependency.d
View
source/dub/generators/build.d
View
source/dub/package_.d
View
source/dub/recipe/json.d
View
source/dub/recipe/packagerecipe.d
View
source/dub/recipe/sdl.d
View
source/dub/version_.d
View
test/issue1531-toolchain-requirements.sh