Commit 658955ba authored by Drew's avatar Drew

Add only-platforms

A task-level mechanism to skip tasks on some platforms
parent 36f4cbef
Pipeline #1847 failed with stage
Subproject commit 4141cc44c894fc5b0cfe7f644b25d772e72ad129 Subproject commit 3e38cdc00304c0c927cf88d5e889c3cb49bd6f21
...@@ -38,6 +38,12 @@ final public class TaskRunner { ...@@ -38,6 +38,12 @@ final public class TaskRunner {
} }
static private func runTaskWithoutDependencies(task: Task, package: Package, toolchain: String) { static private func runTaskWithoutDependencies(task: Task, package: Package, toolchain: String) {
if task.onlyPlatforms.count > 0 {
if !task.onlyPlatforms.contains(Platform.targetPlatform.description) {
print("Skipping task \(task) on platform \(Platform.targetPlatform)")
return
}
}
print("Running task \(task.qualifiedName) with overlays \(task.appliedOverlays) for platform \(Platform.targetPlatform)") print("Running task \(task.qualifiedName) with overlays \(task.appliedOverlays) for platform \(Platform.targetPlatform)")
do { do {
try task.checkRequiredOverlays() try task.checkRequiredOverlays()
......
(package
:name "only_platforms"
:tasks {
:if-linux {
:tool "shell"
:script "echo hello from linux"
:only-platforms ["linux"]
}
:if-osx {
:tool "shell"
:script "echo hello from osx"
:only-platforms ["osx"]
}
:default {
:tool "nop"
:dependencies ["if-linux" "if-osx"]
}
}
)
\ No newline at end of file
...@@ -16,6 +16,28 @@ if ! $ATBUILD atbuild --use-overlay static; then ...@@ -16,6 +16,28 @@ if ! $ATBUILD atbuild --use-overlay static; then
$ATBUILD atbuild $ATBUILD atbuild
fi fi
echo "****************ONLY-PLATFORMS TEST**************"
cd $DIR/tests/fixtures/only_platforms
$ATBUILD > /tmp/only.txt
if [ "$UNAME" == "Darwin" ]; then
EXPECT="hello from osx"
DONTEXPECT="hello from linux"
else
EXPECT="hello from linux"
DONTEXPECT="hello from osx"
fi
if ! grep "$EXPECT" /tmp/only.txt; then
echo "Didn't find $EXPECT in /tmp/only.txt"
exit 1
fi
if grep "$DONTEXPECT" /tmp/only.txt; then
echo "Found $DONTEXPECT in /tmp/only.txt"
exit 1
fi
echo "****************EXECUTABLE-NAME TEST**************" echo "****************EXECUTABLE-NAME TEST**************"
cd $DIR/tests/fixtures/executable_name cd $DIR/tests/fixtures/executable_name
$ATBUILD check $ATBUILD check
......
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