-
-
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.
add "cacheArtifactPath" in TargetDescription
Allow 3rd party programs (e.g. Meson) to locate artifacts in the cache
- Loading branch information
Showing
8 changed files
with
118 additions
and
34 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
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
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
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
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/ | ||
pr2644-describe-artifact-path |
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 "pr2644-describe-artifact-path"; | ||
targetType "executable"; |
61 changes: 61 additions & 0 deletions
61
test/pr2644-describe-artifact-path/source/describe_artifact_path.d
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,61 @@ | ||
module describe_artifact_path; | ||
|
||
import std.path; | ||
import std.file; | ||
import std.process; | ||
import std.stdio; | ||
import std.json; | ||
|
||
void main() | ||
{ | ||
const dubhome = __FILE_FULL_PATH__.dirName().dirName().buildNormalizedPath("dubhome"); | ||
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, | ||
]; | ||
const fetchProgram = [ | ||
environment["DUB"], | ||
"fetch", | ||
"[email protected]", | ||
]; | ||
auto dubFetch = spawnProcess(fetchProgram, stdin, stdout, stderr, env); | ||
wait(dubFetch); | ||
|
||
|
||
const describeProgram = [ | ||
environment["DUB"], | ||
"describe", | ||
"--compiler=" ~ environment["DC"], | ||
"--build=debug", | ||
"--config=lib", | ||
"[email protected]", | ||
]; | ||
auto result = execute(describeProgram, env); | ||
assert(result.status == 0, "expected dub describe to return zero"); | ||
auto json = parseJSON(result.output); | ||
|
||
auto cacheFile = json["targets"][0]["cacheArtifactPath"].str; | ||
assert(!exists(cacheFile), "found cache file in virgin dubhome"); | ||
|
||
const buildProgram = [ | ||
environment["DUB"], | ||
"build", | ||
"--compiler=" ~ environment["DC"], | ||
"--build=debug", | ||
"--config=lib", | ||
"[email protected]", | ||
]; | ||
auto dubBuild = spawnProcess(buildProgram, stdin, stdout, stderr, env); | ||
wait(dubBuild); | ||
|
||
assert(exists(cacheFile), "did not find cache file after build"); | ||
} |