diff --git a/bin/dub b/bin/dub old mode 100644 new mode 100755 index 34fe490..38cdf79 --- a/bin/dub +++ b/bin/dub @@ -20,7 +20,7 @@ START_SCRIPT=`mktemp -t dub.start.XXXXXXXX` # copy dub.d to /tmp and make it deletable by anyone -cp -p "$DUB_BIN"/app.d /tmp/app.d +cp -p "$DUB_SOURCE"/app.d /tmp/app.d chmod 666 /tmp/app.d # run VPM and delete the dub.d file again, VPM will output the compile/run script diff --git a/source/app.d b/source/app.d index 8526efd..c95002d 100644 --- a/source/app.d +++ b/source/app.d @@ -107,11 +107,10 @@ //Added check for existance of [AppNameInPackagejson].d //If exists, use that as the starting file. - string binName = getBinName(vpm); - version(Windows) { string appName = binName[0..$-4]; } - version(Posix) { string appName = binName; } + auto outfile = getBinName(vpm); + auto mainsrc = getMainSourceFile(vpm); - logDebug("Application Name is '%s'", binName); + logDebug("Application output name is '%s'", outfile); // Create start script, which will be used by the calling bash/cmd script. // build "rdmd --force %DFLAGS% -I%~dp0..\source -Jviews -Isource @deps.txt %LIBS% source\app.d" ~ application arguments @@ -119,12 +118,12 @@ string[] flags = ["--force"]; if( cmd == "build" ){ flags ~= "--build-only"; - flags ~= "-of"~binName; + flags ~= "-of"~outfile; } else { version(Windows){ import std.random; auto rnd = to!string(uniform(uint.min, uint.max)) ~ "-"; - del_exe_file = environment.get("TEMP")~"\\.rdmd\\source\\"~rnd~binName; + del_exe_file = environment.get("TEMP")~"\\.rdmd\\source\\"~rnd~outfile; flags ~= "-of"~del_exe_file; } } @@ -135,7 +134,7 @@ flags ~= vpm.dflags; flags ~= getLibs(vibedDir); flags ~= getPackagesAsVersion(vpm); - flags ~= (Path("source") ~ appName).toNativeString(); + flags ~= (mainsrc).toNativeString(); flags ~= args[1 .. $]; appStartScript = "rdmd " ~ getDflags() ~ " " ~ join(flags, " "); @@ -252,7 +251,7 @@ private string getBinName(const Vpm vpm) { string ret; - if(existsFile(Path("source") ~ (vpm.packageName() ~ ".d"))) + if( vpm.packageName.length > 0 ) ret = vpm.packageName(); //Otherwise fallback to source/app.d else ret ="app"; @@ -261,6 +260,14 @@ return ret; } +private Path getMainSourceFile(const Vpm vpm) +{ + auto p = Path("source") ~ (vpm.packageName() ~ ".d"); + return existsFile(p) ? p : Path("source/app.d"); + + +} + private void initDirectory(string fName) { Path cwd; diff --git a/source/dub/dependency.d b/source/dub/dependency.d index 3bdc492..bfab5f6 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -183,7 +183,8 @@ || (m_versA < m_versB && doCmp(m_cmpA, m_versB, m_versA) && doCmp(m_cmpB, m_versA, m_versB)); } - bool matches(const string vers) const { return matches(Version(vers)); } + bool matches(string vers) const { return matches(Version(vers)); } + bool matches(const(Version) v) const { return matches(v); } bool matches(ref const(Version) v) const { //logTrace(" try match: %s with: %s", v, this); // Master only matches master diff --git a/source/dub/registry.d b/source/dub/registry.d index 3c28201..14f1302 100644 --- a/source/dub/registry.d +++ b/source/dub/registry.d Binary files differ diff --git a/source/dub/utils.d b/source/dub/utils.d index dcd6964..7cbab7e 100644 --- a/source/dub/utils.d +++ b/source/dub/utils.d @@ -11,6 +11,7 @@ import vibe.core.log; import vibe.data.json; import vibe.inet.url; +import vibe.stream.operations; import vibe.utils.string; // todo: cleanup imports.