Skip to content

Commit

Permalink
work on define overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Jan 12, 2021
1 parent 0e7baf3 commit 49e3b16
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makesure.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
25. [ ] (?) `-F` to force build despite the reached_if
26. [x] `-x` to enable tracing in bash
27. [x] support `@options silent` mode and flag `-s`
28. [ ] allow override @define-s
- [ ] `-D "var=val"` / `--define "var=val"`
28. [x] allow override @define-s
- [x] `-D "var=val"` / `--define "var=val"`
29. [x] support @options directive
- [x] @options tracing
- [x] @options silent
Expand Down
17 changes: 17 additions & 0 deletions tests/10_define.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


@define A=aaa
@define B=${A}bbb
C=ccc

@goal testA
echo A=$A

@goal testB
echo B=$B

@goal testC
echo C=$C

@goal testABC
@depends_on testA testB testC
35 changes: 35 additions & 0 deletions tests/10_define.tush
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

$ cd "$MYDIR"; ./makesure -f tests/10_define.sh testA
| goal 'testA' ...
| A=aaa

$ cd "$MYDIR"; ./makesure -f tests/10_define.sh testB
| goal 'testB' ...
| B=aaabbb

$ cd "$MYDIR"; ./makesure -f tests/10_define.sh -D B=xxx testB
| goal 'testB' ...
| B=xxx

$ cd "$MYDIR"; ./makesure -f tests/10_define.sh testC
| goal 'testC' ...
| C=

$ cd "$MYDIR"; ./makesure -f tests/10_define.sh testABC
| goal 'testA' ...
| A=aaa
| goal 'testB' ...
| B=aaabbb
| goal 'testC' ...
| C=
| goal 'testABC' [empty].

$ cd "$MYDIR"; ./makesure -f tests/10_define.sh testABC --define A=111 -D "B=222" --define 'C=333'
| goal 'testA' ...
| A=111
| goal 'testB' ...
| B=222
| goal 'testC' ...
| C=333
| goal 'testABC' [empty].

0 comments on commit 49e3b16

Please sign in to comment.