Commit 36f4cbef authored by Drew's avatar Drew

Set environment variable $ATBUILD_PACKAGE_VERSION

parent 66a0cd92
Pipeline #1844 failed with stage
Subproject commit 257dd12841a2c73e8237924dcc09734a1a4445bb
Subproject commit 4141cc44c894fc5b0cfe7f644b25d772e72ad129
......@@ -26,6 +26,10 @@ final class CustomTool: Tool {
}
setenv("ATBUILD_USER_PATH", userPath().description, 1)
setenv("ATBUILD_PLATFORM", "\(Platform.targetPlatform)", 1)
if let version = task.package.version {
setenv("ATBUILD_PACKAGE_VERSION", version, 1)
}
anarchySystem(cmd)
}
}
\ No newline at end of file
......@@ -30,6 +30,9 @@ final class Shell : Tool {
func run(task: Task, toolchain: String) {
setenv("ATBUILD_PLATFORM", "\(Platform.targetPlatform)", 1)
setenv("ATBUILD_USER_PATH", userPath().description, 1)
if let version = task.package.version {
setenv("ATBUILD_PACKAGE_VERSION", version, 1)
}
guard var script = task["script"]?.string else { fatalError("Invalid 'script' argument to shell tool.") }
script = evaluateSubstitutions(input: script, package: task.package)
do {
......
......@@ -14,6 +14,7 @@
(package
:name "plugin"
:version "1.0"
:tasks {
:a {:tool "nop" }
......@@ -23,6 +24,7 @@
:test "${test_substitution}"
:userpath "\${ATBUILD_USER_PATH}"
:platform "\${ATBUILD_PLATFORM}"
:version "\${ATBUILD_PACKAGE_VERSION}"
:dependencies ["a"]
}
}
......
......@@ -153,9 +153,9 @@ echo "****************PLUGIN TEST**************"
cd $DIR/tests/fixtures/attool
$ATBUILD > /tmp/plugin.txt
if [ "$UNAME" == "Darwin" ]; then
SEARCHTEXT="\-key value --platform osx --test test_substitution --userpath .*tests/fixtures/attool/user"
SEARCHTEXT="\-key value --platform osx --test test_substitution --userpath .*tests/fixtures/attool/user --version 1.0"
else
SEARCHTEXT="\-key value --platform linux --test test_substitution --userpath .*tests/fixtures/attool/user"
SEARCHTEXT="\-key value --platform linux --test test_substitution --userpath .*tests/fixtures/attool/user --version 1.0"
fi
if ! grep "$SEARCHTEXT" /tmp/plugin.txt; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment