Skip to content

Commit

Permalink
Don't copy the target executable to the package directory for single-…
Browse files Browse the repository at this point in the history
…file packages.
  • Loading branch information
s-ludwig committed Jun 8, 2016
1 parent fa1b964 commit 3593cba
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions source/dub/generators/build.d
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class BuildGenerator : ProjectGenerator {
private {
PackageManager m_packageMan;
Path[] m_temporaryFiles;
Path m_targetExecutablePath;
}

this(Project project)
Expand Down Expand Up @@ -94,9 +95,13 @@ class BuildGenerator : ProjectGenerator {
override void performPostGenerateActions(GeneratorSettings settings, in TargetInfo[string] targets)
{
// run the generated executable
auto buildsettings = targets[m_project.rootPackage.name].buildSettings;
auto buildsettings = targets[m_project.rootPackage.name].buildSettings.dup;
if (settings.run && !(buildsettings.options & BuildOption.syntaxOnly)) {
auto exe_file_path = getTargetPath(buildsettings, settings);
Path exe_file_path;
if (!m_targetExecutablePath.length)
exe_file_path = getTargetPath(buildsettings, settings);
else
exe_file_path = m_targetExecutablePath ~ settings.compiler.getTargetFileName(buildsettings, settings.platform);
runTarget(exe_file_path, buildsettings, settings.runArgs, settings);
}
}
Expand Down Expand Up @@ -148,7 +153,7 @@ class BuildGenerator : ProjectGenerator {
auto cwd = Path(getcwd());

Path target_path;
if (settings.tempBuild) target_path = getTempDir() ~ format(".dub/build/%s-%s/%s/", pack.name, pack.version_, build_id);
if (settings.tempBuild) m_targetExecutablePath = target_path = getTempDir() ~ format(".dub/build/%s-%s/%s/", pack.name, pack.version_, build_id);
else target_path = pack.path ~ format(".dub/build/%s/", build_id);

if (!settings.force && isUpToDate(target_path, buildsettings, settings, pack, packages, additional_dep_files)) {
Expand Down Expand Up @@ -180,7 +185,8 @@ class BuildGenerator : ProjectGenerator {
cbuildsettings.targetPath = target_path.relativeTo(cwd).toNativeString();
buildWithCompiler(settings, cbuildsettings);

copyTargetFile(target_path, buildsettings, settings);
if (!settings.tempBuild)
copyTargetFile(target_path, buildsettings, settings);

return false;
}
Expand Down

0 comments on commit 3593cba

Please sign in to comment.