From f2281c55d79b41aca1434c798076b8cb209331b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=BCtz?= Date: Sat, 12 Sep 2015 13:35:34 +0200 Subject: [PATCH] The default compiler should not depend on DUB's own build environment --- build.cmd | 1 - build.sh | 1 - source/dub/compilers/compiler.d | 11 ++--------- source/dub/version_.d | 1 - 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/build.cmd b/build.cmd index 7f34fbf29..f96519400 100644 --- a/build.cmd +++ b/build.cmd @@ -5,7 +5,6 @@ @for /f %%i in ('git describe') do @set GITVER=%%i @echo module dub.version_; > source\dub\version_.d @echo enum dubVersion = "%GITVER%"; >> source\dub\version_.d -@echo enum initialCompilerBinary = "%DC%"; >> source\dub\version_.d @echo Executing %DC%... @%DC% -ofbin\dub.exe -g -debug -w -version=DubUseCurl -Isource curl.lib %* @build-files.txt diff --git a/build.sh b/build.sh index 3b786e5d7..3ce8c2cbf 100755 --- a/build.sh +++ b/build.sh @@ -37,7 +37,6 @@ echo Generating version file... GITVER=$(git describe) || GITVER=unknown echo "module dub.version_;" > source/dub/version_.d echo "enum dubVersion = \"$GITVER\";" >> source/dub/version_.d -echo "enum initialCompilerBinary = \"$DMD\";" >> source/dub/version_.d echo Running $DMD... diff --git a/source/dub/compilers/compiler.d b/source/dub/compilers/compiler.d index 7eb236bca..3456d68e8 100644 --- a/source/dub/compilers/compiler.d +++ b/source/dub/compilers/compiler.d @@ -55,21 +55,14 @@ string defaultCompiler() private string findCompiler() { import std.process : env=environment; - import dub.version_ : initialCompilerBinary; version (Windows) enum sep = ";", exe = ".exe"; version (Posix) enum sep = ":", exe = ""; - auto def = Path(initialCompilerBinary); - if (def.absolute && existsFile(def)) - return initialCompilerBinary; - auto compilers = ["dmd", "gdc", "gdmd", "ldc2", "ldmd2"]; - if (!def.absolute) - compilers = initialCompilerBinary ~ compilers; auto paths = env.get("PATH", "").splitter(sep).map!Path; auto res = compilers.find!(bin => paths.canFind!(p => existsFile(p ~ (bin~exe)))); - return res.empty ? initialCompilerBinary : res.front; + return res.empty ? compilers[0] : res.front; } void registerCompiler(Compiler c) @@ -312,7 +305,7 @@ struct BuildPlatform { bool matchesSpecification(const(char)[] specification) const { import std.string : format; - + if (specification.empty) return true; if (this == any) return true; diff --git a/source/dub/version_.d b/source/dub/version_.d index 96a0ba08d..947467209 100644 --- a/source/dub/version_.d +++ b/source/dub/version_.d @@ -1,3 +1,2 @@ module dub.version_; enum dubVersion = "v0.9.23"; -enum initialCompilerBinary = "dmd";