Commit a5d25c7b authored by Drew's avatar Drew

Merge pull request #87 from AnarchyTools/platform-expansions

Export ATBUILD_PLATFORM
parents fb64cf1a db7b2bd2
Pipeline #1771 passed with stage
......@@ -25,6 +25,7 @@ final class CustomTool: Tool {
cmd += "--\(key) \"\(evaluateSubstitutions(input: value, package: task.package))\" "
}
setenv("ATBUILD_USER_PATH", userPath().description, 1)
setenv("ATBUILD_PLATFORM", "\(Platform.targetPlatform)", 1)
anarchySystem(cmd)
}
}
\ No newline at end of file
......@@ -155,6 +155,19 @@ public enum Platform {
public static var buildPlatform: Platform = Platform.hostPlatform
}
extension Platform: CustomStringConvertible {
public var description: String {
switch(self) {
case .OSX:
return "osx"
case .Linux:
return "linux"
case .iOS(let architecture):
return "ios-\(architecture)"
}
}
}
func findToolPath(toolName: String, toolchain: String) -> Path {
if Platform.buildPlatform == Platform.hostPlatform {
......
......@@ -28,6 +28,7 @@ import atpkg
*/
final class Shell : Tool {
func run(task: Task, toolchain: String) {
setenv("ATBUILD_PLATFORM", "\(Platform.targetPlatform)", 1)
setenv("ATBUILD_USER_PATH", userPath().description, 1)
guard var script = task["script"]?.string else { fatalError("Invalid 'script' argument to shell tool.") }
script = evaluateSubstitutions(input: script, package: task.package)
......
......@@ -22,8 +22,9 @@
:key "value"
:test "${test_substitution}"
:userpath "\${ATBUILD_USER_PATH}"
:platform "\${ATBUILD_PLATFORM}"
:dependencies ["a"]
}
}
}
)
#!/bin/bash
set -e
UNAME=`uname`
echo "**********THE ATBUILD TEST SCRIPT*************"
......@@ -26,15 +28,21 @@ fi
echo "****************PLUGIN TEST**************"
cd $DIR/tests/fixtures/attool
$ATBUILD > /tmp/plugin.txt
if ! grep "\-key value --test test_substitution --userpath .*tests/fixtures/attool/user" /tmp/plugin.txt; then
if [ "$UNAME" == "Darwin" ]; then
SEARCHTEXT="\-key value --platform osx --test test_substitution --userpath .*tests/fixtures/attool/user"
else
SEARCHTEXT="\-key value --platform linux --test test_substitution --userpath .*tests/fixtures/attool/user"
fi
if ! grep "$SEARCHTEXT" /tmp/plugin.txt; then
cat /tmp/plugin.txt
echo "Did not find key print in plugin test"
echo $SEARCHTEXT
exit 1
fi
echo "****************IOS TEST**************"
cd $DIR/tests/fixtures/ios
UNAME=`uname`
if [ "$UNAME" == "Darwin" ]; then
$ATBUILD --platform ios-x86_64 ##FIXME
INFO=`lipo -info .atllbuild/products/static.a`
......
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