diff --git a/build.cmd b/build.cmd index 60538b6..7f34fbf 100644 --- a/build.cmd +++ b/build.cmd @@ -3,7 +3,9 @@ @echo Generating version file... @set GITVER=unknown @for /f %%i in ('git describe') do @set GITVER=%%i -@echo module dub.version_; enum dubVersion = "%GITVER%"; > source\dub\version_.d +@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 6f98537..1c2243f 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,9 @@ echo Generating version file... GITVER=$(git describe) || GITVER=unknown -echo "module dub.version_; enum dubVersion = \"$GITVER\";" > source/dub/version_.d +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 Running $DC... diff --git a/source/dub/commandline.d b/source/dub/commandline.d index 84e28d3..4d1b44e 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -20,6 +20,7 @@ import dub.platform : determineCompiler; import dub.project; import dub.internal.utils : getDUBVersion, getClosestMatch; +import dub.version_; import std.algorithm; import std.array; @@ -337,7 +338,7 @@ string m_buildType; BuildMode m_buildMode; string m_buildConfig; - string m_compilerName = .determineCompiler(); + string m_compilerName = initialCompilerBinary; string m_arch; string[] m_debugVersions; Compiler m_compiler; @@ -362,8 +363,10 @@ "Builds the specified configuration. Configurations can be defined in dub.json" ]); args.getopt("compiler", &m_compilerName, [ - "Specifies the compiler binary to use. Arbitrary pre- and suffixes to the identifiers below are recognized (e.g. ldc2 or dmd-2.063) and matched to the proper compiler type:", - " "~m_compilerName~" (default)"~["dmd", "gdc", "ldc", "gdmd", "ldmd"].filter!(c => c != m_compilerName).map!(c => ", "~c).join() + "Specifies the compiler binary to use (can be a path).", + "Arbitrary pre- and suffixes to the identifiers below are recognized (e.g. ldc2 or dmd-2.063) and matched to the proper compiler type:", + " "~["dmd", "gdc", "ldc", "gdmd", "ldmd"].join(", "), + "Default value: "~initialCompilerBinary, ]); args.getopt("a|arch", &m_arch, [ "Force a different architecture (e.g. x86 or x86_64)" diff --git a/source/dub/version_.d b/source/dub/version_.d index 74d8e3f..8947c5e 100644 --- a/source/dub/version_.d +++ b/source/dub/version_.d @@ -1 +1,3 @@ -module dub.version_; enum dubVersion = "v0.9.22"; +module dub.version_; +enum dubVersion = "v0.9.22"; +enum initialCompilerBinary = "dmd";