add variant sample
This commit is contained in:
parent
cd19bd75b3
commit
e28f17694a
2
variant_path/.gitignore
vendored
Normal file
2
variant_path/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/build-default
|
||||
!/build-default/tup.config
|
1
variant_path/Tupfile
Normal file
1
variant_path/Tupfile
Normal file
|
@ -0,0 +1 @@
|
|||
: |> ./generate_header.sh > %o |> header.txt ./<header_group>
|
0
variant_path/Tupfile.ini
Normal file
0
variant_path/Tupfile.ini
Normal file
9
variant_path/Tuprules.tup
Normal file
9
variant_path/Tuprules.tup
Normal file
|
@ -0,0 +1,9 @@
|
|||
&root = .
|
||||
|
||||
# This doesn't work, cannot find the generated header.txt
|
||||
# I want to access the variant path for . but $(TUP_VARIANTDIR) will follow the
|
||||
# current Tupfile and there is no variant "anchor" like &-variables.
|
||||
!add_header = | &(root)/<header_group> |> cat &(root)/header.txt %f &(root)/footer.txt > %o |> %B.gen.txt
|
||||
|
||||
# This works
|
||||
#!add_header = | &(root)/<header_group> |> cat %f &(root)/footer.txt > %o |> %B.gen.txt
|
2
variant_path/footer.txt
Normal file
2
variant_path/footer.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
--
|
||||
the end
|
8
variant_path/generate_header.sh
Executable file
8
variant_path/generate_header.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cat << EOF
|
||||
YEAR $(date +%Y)
|
||||
====
|
||||
EOF
|
3
variant_path/src/Tupfile
Normal file
3
variant_path/src/Tupfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
include_rules
|
||||
|
||||
: a.txt |> !add_header |>
|
1
variant_path/src/a.txt
Normal file
1
variant_path/src/a.txt
Normal file
|
@ -0,0 +1 @@
|
|||
letter a
|
3
variant_path/src/sub/Tupfile
Normal file
3
variant_path/src/sub/Tupfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
include_rules
|
||||
|
||||
: b.txt |> !add_header |>
|
1
variant_path/src/sub/b.txt
Normal file
1
variant_path/src/sub/b.txt
Normal file
|
@ -0,0 +1 @@
|
|||
letter b
|
Loading…
Reference in a new issue