diff --git a/bake/bakefile.py b/bake/bakefile.py index 95b3edd..3e531c5 100644 --- a/bake/bakefile.py +++ b/bake/bakefile.py @@ -472,7 +472,7 @@ class TaskScript(BaseAction): # Remove duplicates from the list. _actions = [] - for action in actions: + for action in reversed(actions): if action not in _actions: _actions.append(action) actions = _actions diff --git a/tests/ordering.Bakefile b/tests/ordering.Bakefile new file mode 100644 index 0000000..fdc848e --- /dev/null +++ b/tests/ordering.Bakefile @@ -0,0 +1,12 @@ +build: build/stage + +build/stage: fetch + echo Building stage + +fetch: fetch/consul fetch/s6-overlay + +fetch/consul: + echo Fetching consul + +fetch/s6-overlay: + echo Fetching S6 diff --git a/tests/ordering.bats b/tests/ordering.bats new file mode 100644 index 0000000..c63c634 --- /dev/null +++ b/tests/ordering.bats @@ -0,0 +1,9 @@ +#!/usr/bin/env bats +export BAKEFILE=ordering.Bakefile + +@test "dependencies are resolved correctly" { + run bake + [[ "${status}" -eq 0 ]] + [[ "${lines[0]}" == *"build…"* ]] + [[ "${lines[1]}" == *"fetch/consul, fetch/s6-overlay, fetch, & build/stage."* ]] +}