-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39b97fa
commit 1ef555e
Showing
6 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dubhome/ | ||
pr2647-build-deep |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name "pr2647-build-deep"; | ||
targetType "executable"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name "pack" | ||
targetType "staticLibrary" | ||
dependency "urld" version="==2.1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module lib; | ||
|
||
import url; | ||
|
||
string getDlangUrl() | ||
{ | ||
URL url; | ||
with(url) | ||
{ | ||
scheme = "https"; | ||
host = "dlang.org"; | ||
} | ||
return url.toString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module test_build_deep; | ||
|
||
import std.array; | ||
import std.file; | ||
import std.path; | ||
import std.process; | ||
import std.stdio; | ||
|
||
void main() | ||
{ | ||
const dubhome = __FILE_FULL_PATH__.dirName().dirName().buildNormalizedPath("dubhome"); | ||
const packdir = __FILE_FULL_PATH__.dirName().dirName().buildNormalizedPath("pack"); | ||
const dub = absolutePath(environment["DUB"]); | ||
|
||
if (exists(dubhome)) | ||
{ | ||
rmdirRecurse(dubhome); | ||
} | ||
|
||
scope (success) | ||
{ | ||
// leave dubhome in the tree for analysis in case of failure | ||
rmdirRecurse(dubhome); | ||
} | ||
|
||
const string[string] env = [ | ||
"DUB_HOME": dubhome, | ||
]; | ||
|
||
// testing the regular way first: `dub build` only builds what is needed | ||
// (urld is downloaded but not built) | ||
const dubBuildProg = [dub, "build"]; | ||
writefln("running %s ...", dubBuildProg.join(" ")); | ||
auto dubBuild = spawnProcess(dubBuildProg, stdin, stdout, stderr, env, Config.none, packdir); | ||
wait(dubBuild); | ||
assert(exists(buildPath(dubhome, "cache", "pack"))); | ||
assert(isDir(buildPath(dubhome, "cache", "pack"))); | ||
assert(exists(buildPath(dubhome, "packages", "urld"))); | ||
assert(isDir(buildPath(dubhome, "packages", "urld"))); | ||
assert(!exists(buildPath(dubhome, "cache", "urld"))); | ||
|
||
// now testing the --deep switch: `dub build --deep` will build urld | ||
const dubBuildDeepProg = [dub, "build", "--deep"]; | ||
writefln("running %s ...", dubBuildDeepProg.join(" ")); | ||
auto dubBuildDeep = spawnProcess(dubBuildDeepProg, stdin, stdout, stderr, env, Config.none, packdir); | ||
wait(dubBuildDeep); | ||
assert(exists(buildPath(dubhome, "cache", "pack"))); | ||
assert(isDir(buildPath(dubhome, "cache", "pack"))); | ||
assert(exists(buildPath(dubhome, "packages", "urld"))); | ||
assert(isDir(buildPath(dubhome, "packages", "urld"))); | ||
assert(exists(buildPath(dubhome, "cache", "urld"))); | ||
assert(isDir(buildPath(dubhome, "cache", "urld"))); | ||
} |