Sped up build
This commit is contained in:
parent
6c30f0447b
commit
68d85ba833
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -16,3 +16,4 @@ generated/**
|
||||||
!images/**
|
!images/**
|
||||||
|
|
||||||
.ninja_log
|
.ninja_log
|
||||||
|
build.ninja
|
||||||
|
|
1302
build.ninja
1302
build.ninja
File diff suppressed because it is too large
Load diff
192
configure.jq
Normal file → Executable file
192
configure.jq
Normal file → Executable file
|
@ -1,81 +1,121 @@
|
||||||
|
#!/usr/bin/env -S jq -r -f
|
||||||
# Takes iditacards output json and produces the dynamic ninja build
|
# Takes iditacards output json and produces the dynamic ninja build
|
||||||
|
# Example usage: cue export -- *.cue *.yaml | ./configure.jq > output/build.ninja
|
||||||
|
|
||||||
def expandout:
|
def ifblank(x): if . | length > 0 then . else x end;
|
||||||
to_entries[] | .value + { name: .key };
|
def cuesources: $ARGS.positional | join(" ");
|
||||||
|
def header: "# Generated from configure.jq, do not edit this file!
|
||||||
|
|
||||||
def everything:
|
root = .
|
||||||
(
|
|
||||||
(.assets | map_values(. + { pseudo: false })),
|
|
||||||
(.pseudoassets | map_values(. + { pseudo: true }))
|
|
||||||
) | expandout;
|
|
||||||
|
|
||||||
def cuesources:
|
rule configure
|
||||||
$ARGS.positional | join(" ");
|
description = recreate build.ninja using configure.jq
|
||||||
|
command = cue export -- *.cue *.yaml | ./configure.jq --args -- *.cue *.yaml > $out
|
||||||
|
generator = 1
|
||||||
|
|
||||||
"# Generated from configure.jq, do not edit this file!",
|
build build.ninja: configure | configure.jq \(cuesources)
|
||||||
"",
|
|
||||||
"root = .",
|
base = .
|
||||||
"",
|
include rules.ninja
|
||||||
"rule configure",
|
|
||||||
" description = recreate build.ninja using configure.jq via configure.sh",
|
build output/.everything.json: cuegen \(cuesources)
|
||||||
" command = bash configure.sh > build.ninja",
|
filter = .
|
||||||
" generator = 1",
|
";
|
||||||
" restat = 1",
|
|
||||||
"",
|
def dirof: split("/")[0:-1] | join("/") | if . | length > 0 then . + "/" else "" end;
|
||||||
"build build.ninja: configure | configure.jq configure.sh \(cuesources)",
|
def filof: . as $saved | split("/")[-1] | ifblank($saved);
|
||||||
"include rules.ninja",
|
def rawof: filof as $saved | split(".")[0:-1] | join(".") | ifblank($saved);
|
||||||
"",
|
|
||||||
"build output/everything.json: cuegen \(cuesources)",
|
def generate_pdf_builds($dir; $raw; $tex): "
|
||||||
" filter = .",
|
build output/\($dir)\($raw).pdf: tex2pdf \($tex) || output/\($dir).\($raw).pdf.dd
|
||||||
"", (
|
dyndep = output/\($dir).\($raw).pdf.dd
|
||||||
everything | (
|
|
||||||
select(.kind == "template") |
|
build output/\($dir).\($raw).pdf.dd: scantex \($tex)
|
||||||
.w = (.size | split("x")[0]) |
|
target = output/\($dir)\($raw).pdf
|
||||||
.h = (.size | split("x")[1]) |
|
";
|
||||||
.rawsuffix = (if .print then "raw." else "" end) |
|
|
||||||
"build output/.\(.name).json.stamp | output/\(.name).json: extract output/everything.json",
|
def generate_png_from_pdf_builds($dir; $raw; $pdf):
|
||||||
" filter = --arg asset '\(.name)' '.assets[$$asset].data'",
|
(.size | split("x")[0]) as $w |
|
||||||
" target = output/\(.name).json",
|
(.size | split("x")[1]) as $h |
|
||||||
"build output/\(.name).tex: template2tex output/\(.name).json | templates/\(.template)",
|
(if .print then "raw." else "" end) as $ext | "
|
||||||
" template = templates/\(.template)",
|
build output/\($dir)\($raw).\($ext)png: pdf2png \($pdf)
|
||||||
"build output/\(.name).pdf: tex2pdf output/\(.name).tex || output/.\(.name).pdf.dd",
|
w = \($w)
|
||||||
" dyndep = output/.\(.name).pdf.dd",
|
h = \($h)
|
||||||
"build output/.\(.name).pdf.dd: scantex output/\(.name).tex",
|
";
|
||||||
" target = output/\(.name).pdf",
|
|
||||||
"build output/\(.name).\(.rawsuffix)png: pdf2png output/\(.name).pdf",
|
def generate_png_copy_builds($dir; $raw; $png):
|
||||||
" w = \(.w)",
|
(if .print then "raw." else "" end) as $ext | "
|
||||||
" h = \(.h)",
|
build output/\($dir)\($raw).\($ext)png: copy \($png)
|
||||||
(select(.print) | "build output/\(.name).png: convert output/\(.name).raw.png"),
|
";
|
||||||
(select(.print) | " args = \(.print)")
|
|
||||||
),(
|
def generate_print_png_builds($dir; $raw; $rawpng):
|
||||||
select(.kind == "image") |
|
if .print then "
|
||||||
.rawsuffix = (if .print then "raw." else "" end) |
|
build output/\($dir)\($raw).png: convert \($rawpng)
|
||||||
"build output/\(.name).\(.rawsuffix)png: copy \(.source)",
|
args = \(.print)
|
||||||
(select(.print) | "build output/\(.name).png: convert output/\(.name).raw.png"),
|
" else empty end;
|
||||||
(select(.print) | " args = \(.print)")
|
|
||||||
),(
|
def generate_template_builds:
|
||||||
select(.kind == "tex") |
|
(.name | dirof) as $dir |
|
||||||
.w = (.size | split("x")[0]) |
|
(.name | rawof) as $raw | ("
|
||||||
.h = (.size | split("x")[1]) |
|
build output/\($dir).\($raw).update | output/\($dir).\($raw).json: extract output/.everything.json
|
||||||
.rawsuffix = (if .print then "raw." else "" end) |
|
filter = --arg asset '\(.name)' '.assets[$$asset].data'
|
||||||
"build output/\(.name).pdf: tex2pdf \(.source) || output/.\(.name).pdf.dd",
|
target = output/\($dir).\($raw).json
|
||||||
" dyndep = output/.\(.name).pdf.dd",
|
|
||||||
"build output/.\(.name).pdf.dd: scantex \(.source)",
|
build output/\($dir)/tex/\($raw).tex: template2tex output/\($dir).\($raw).json | templates/\(.template)
|
||||||
" target = output/\(.name).pdf",
|
template = templates/\(.template)
|
||||||
"build output/\(.name).\(.rawsuffix)png: pdf2png output/\(.name).pdf",
|
",
|
||||||
" w = \(.w)",
|
generate_pdf_builds($dir; $raw; "output/\($dir)/tex/\($raw).tex"),
|
||||||
" h = \(.h)",
|
generate_png_from_pdf_builds($dir; $raw; "output/\($dir)\($raw).pdf"),
|
||||||
(select(.print) | "build output/\(.name).png: convert output/\(.name).raw.png"),
|
generate_print_png_builds($dir; $raw; "output/\($dir)\($raw).raw.png")
|
||||||
(select(.print) | " args = \(.print)")
|
);
|
||||||
),(
|
|
||||||
select(.kind == "texdoc") |
|
def generate_image_builds:
|
||||||
"build output/\(.name).pdf: tex2pdf2x \(.source) || output/.\(.name).pdf.dd",
|
(.name | dirof) as $dir |
|
||||||
" dyndep = output/.\(.name).pdf.dd",
|
(.name | rawof) as $raw | (
|
||||||
"build output/.\(.name).pdf.dd: scantex \(.source)",
|
generate_png_copy_builds($dir; $raw; .source),
|
||||||
" target = output/\(.name).pdf"
|
generate_print_png_builds($dir; $raw; "output/\($dir)\($raw).raw.png")
|
||||||
),(
|
);
|
||||||
select(.kind == "cat") |
|
|
||||||
.ins = (.contents | map("output/\(.).pdf") | join(" ")) |
|
def generate_tex_builds:
|
||||||
"build output/\(.name).pdf: pdfunite \(.ins)"
|
(.size | split("x")[0]) as $w |
|
||||||
)
|
(.size | split("x")[1]) as $h |
|
||||||
)
|
(.name | dirof) as $dir |
|
||||||
|
(.name | rawof) as $raw | (
|
||||||
|
generate_pdf_builds($dir; $raw; .source),
|
||||||
|
generate_png_from_pdf_builds($dir; $raw; "output/\($dir)\($raw).pdf"),
|
||||||
|
generate_print_png_builds($dir; $raw; "output/\($dir)\($raw).raw.png")
|
||||||
|
);
|
||||||
|
|
||||||
|
def generate_texdoc_builds:
|
||||||
|
(.name | dirof) as $dir |
|
||||||
|
(.name | rawof) as $raw | "
|
||||||
|
build output/\($dir)\($raw).pdf: tex2pdf2x \(.source) || output/\($dir).\($raw).pdf.dd
|
||||||
|
dyndep = output/\($dir).\($raw).pdf.dd
|
||||||
|
|
||||||
|
build output/\($dir).\($raw).pdf.dd: scantex \(.source)
|
||||||
|
target = output/\($dir)\($raw).pdf
|
||||||
|
";
|
||||||
|
|
||||||
|
def generate_cat_builds:
|
||||||
|
(.contents | map("output/" + . + ".pdf") | join(" ")) as $pdfcontents |
|
||||||
|
(.contents | map("output/" + . + ".png") | join(" ")) as $pngcontents |
|
||||||
|
(.contents | map("output/" + . + ".raw.png") | join(" ")) as $rawcontents |
|
||||||
|
(.name | dirof) as $dir |
|
||||||
|
(.name | rawof) as $raw | "
|
||||||
|
build output/\($dir)\($raw).pdf: pdfunite \($pdfcontents)
|
||||||
|
build output/\($dir)\($raw).png: pngunite \($pngcontents)
|
||||||
|
build output/\($dir)\($raw).raw.png: pngunite \($rawcontents)
|
||||||
|
";
|
||||||
|
|
||||||
|
def generate_builds:
|
||||||
|
(select(.kind == "template") | generate_template_builds),
|
||||||
|
(select(.kind == "image") | generate_image_builds),
|
||||||
|
(select(.kind == "tex") | generate_tex_builds),
|
||||||
|
(select(.kind == "texdoc") | generate_texdoc_builds),
|
||||||
|
(select(.kind == "cat") | generate_cat_builds);
|
||||||
|
|
||||||
|
def expandout: to_entries[] | .value + { name: .key };
|
||||||
|
def everything: (.assets, .pseudoassets) | expandout;
|
||||||
|
|
||||||
|
header,
|
||||||
|
(everything | generate_builds)
|
||||||
|
|
98
configure.py
Normal file
98
configure.py
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
""" Generates build.ninja for iditacards build in output/. """
|
||||||
|
|
||||||
|
import glob
|
||||||
|
import subprocess
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
cue_sources = glob.glob(f'*.cue')
|
||||||
|
yaml_sources = glob.glob(f'*.yaml')
|
||||||
|
sources = cue_sources + yaml_sources
|
||||||
|
|
||||||
|
everything = json.loads(subprocess.run(['cue', 'export', '--'] + sources, stdout=subprocess.PIPE).stdout)
|
||||||
|
|
||||||
|
assets = everything['assets']
|
||||||
|
pseudos = everything['pseudoassets']
|
||||||
|
all_assets = { **assets, **pseudos }
|
||||||
|
|
||||||
|
print('# Generated from configure.sh, do not edit this file!\n')
|
||||||
|
|
||||||
|
with open(f'{script_dir}/rules.ninja', 'r') as f:
|
||||||
|
print(f.read())
|
||||||
|
|
||||||
|
print(f'''
|
||||||
|
base = .
|
||||||
|
|
||||||
|
rule configure
|
||||||
|
description = recreate $out using $in
|
||||||
|
command = $in > $out
|
||||||
|
generator = 1
|
||||||
|
restat = 1
|
||||||
|
|
||||||
|
build build.ninja: configure ./configure.py | {' '.join(sources)}
|
||||||
|
|
||||||
|
build output/.everything.json: cuegen {' '.join(sources)}
|
||||||
|
filter = .
|
||||||
|
''')
|
||||||
|
|
||||||
|
for name, asset in all_assets.items():
|
||||||
|
assetdir = os.path
|
||||||
|
if asset['kind'] == 'template':
|
||||||
|
print(f'''
|
||||||
|
build output/.{name}.update | .{name}.json: extract .everything.json
|
||||||
|
filter = --arg asset '{name}' '.assets[$$asset].data'
|
||||||
|
target = .{name}.json
|
||||||
|
|
||||||
|
build tex/{name}.tex: template2tex .{name}.json | ../templates/{asset["template"]}
|
||||||
|
template = ../templates/{asset["template"]}
|
||||||
|
|
||||||
|
build {name}.pdf: tex2pdf tex/{name}.tex || .{name}.pdf.dd
|
||||||
|
dyndep = .{name}.pdf.dd
|
||||||
|
|
||||||
|
build .{name}.pdf.dd: scantex tex/{name}.tex
|
||||||
|
target = {name}.pdf
|
||||||
|
|
||||||
|
build {name}.{'raw.' if 'print' in asset else ''}png: pdf2png {name}.pdf
|
||||||
|
w = {asset['size'].split('x')[0]}
|
||||||
|
h = {asset['size'].split('x')[1]}
|
||||||
|
''')
|
||||||
|
|
||||||
|
if asset['kind'] == 'image':
|
||||||
|
print(f'''
|
||||||
|
build {name}.{'raw.' if 'print' in asset else ''}png: copy ../{asset['source']}
|
||||||
|
''')
|
||||||
|
|
||||||
|
if asset['kind'] == 'tex':
|
||||||
|
print(f'''
|
||||||
|
build {name}.pdf: tex2pdf ../{asset['source']} || .{name}.pdf.dd
|
||||||
|
dyndep = .{name}.pdf.dd
|
||||||
|
|
||||||
|
build .{name}.pdf.dd: scantex ../{asset['source']}
|
||||||
|
target = {name}.pdf
|
||||||
|
|
||||||
|
build {name}.{'raw.' if 'print' in asset else ''}png: pdf2png {name}.pdf
|
||||||
|
w = {asset['size'].split('x')[0]}
|
||||||
|
h = {asset['size'].split('x')[1]}
|
||||||
|
''')
|
||||||
|
|
||||||
|
if asset['kind'] == 'texdoc':
|
||||||
|
print(f'''
|
||||||
|
build {name}.pdf: tex2pdf2x ../{asset['source']} || .{name}.pdf.dd
|
||||||
|
dyndep = .{name}.pdf.dd
|
||||||
|
|
||||||
|
build .{name}.pdf.dd: scantex ../{asset['source']}
|
||||||
|
target = {name}.pdf
|
||||||
|
''')
|
||||||
|
|
||||||
|
if asset['kind'] == 'cat':
|
||||||
|
print(f'''
|
||||||
|
build {name}.pdf: pdfunite {' '.join(content + '.pdf' for content in asset['contents'])}
|
||||||
|
''')
|
||||||
|
|
||||||
|
if 'print' in asset:
|
||||||
|
print(f'''
|
||||||
|
build {name}.png: convert {name}.raw.png
|
||||||
|
args = {asset['print']}
|
||||||
|
''')
|
143
configure.sh
143
configure.sh
|
@ -1,8 +1,141 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# The real configure script uses jq to parse cue output
|
# Outputs a build.ninja script for placing into $1 (or output/ if omitted)
|
||||||
cue export -- *.cue *.yaml | jq -r -f configure.jq --args -- *.cue *.yaml
|
|
||||||
|
|
||||||
# TODO: generate line-by-line asset list with jq and process them to generate
|
scriptdir="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||||
# build.ninja in builddir="$1". Regenerate any changed *.jsons at configure
|
builddir="${1-output}"
|
||||||
# time, hopefully ninja picks up those changes!
|
|
||||||
|
cue_sources=( "$scriptdir"/*.cue "$scriptdir"/*.yaml )
|
||||||
|
everything="$(cue export -- "${cue_sources[@]}" | jq -c)"
|
||||||
|
ASSET_TO_JSON="| to_entries[] | .value + { name: .key }"
|
||||||
|
mapfile -t assets < <(jq -c ".assets $ASSET_TO_JSON" <<<"$everything")
|
||||||
|
mapfile -t pseudos < <(jq -c ".pseudoassets $ASSET_TO_JSON" <<<"$everything")
|
||||||
|
|
||||||
|
# base is the directory that contains the script
|
||||||
|
base="$(realpath -s --relative-to="$builddir" "$scriptdir")"
|
||||||
|
|
||||||
|
# root is the directory that the assets are generated into
|
||||||
|
root=.
|
||||||
|
|
||||||
|
relative_cue_sources=( )
|
||||||
|
for cue_source in "${cue_sources[@]}"; do
|
||||||
|
relative_cue_sources+=( "$base/$cue_source" )
|
||||||
|
done
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
# Generated from configure.sh, do not edit this file!
|
||||||
|
|
||||||
|
base = $base
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat "$scriptdir/rules.ninja"
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
rule configure
|
||||||
|
description = recreate build.ninja using $base/configure.sh
|
||||||
|
command = $base/configure.sh $root
|
||||||
|
generator = 1
|
||||||
|
restat = 1
|
||||||
|
|
||||||
|
build ./build.ninja: configure | $base/configure.sh ${relative_cue_sources[*]}
|
||||||
|
|
||||||
|
build $root/.everything.json: cuegen ${relative_cue_sources[*]}
|
||||||
|
filter = .
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for asset in "${assets[@]}" "${pseudos[@]}"; do
|
||||||
|
# reset asset variables, also quiets shellcheck
|
||||||
|
name=
|
||||||
|
print=
|
||||||
|
kind=
|
||||||
|
source=
|
||||||
|
template=
|
||||||
|
size=
|
||||||
|
data=
|
||||||
|
contents=
|
||||||
|
|
||||||
|
eval "$(jq -r 'to_entries[] | "\(.key)=\(.value|@text|@sh)"' <<<"$asset")"
|
||||||
|
rawsuffix="$(echo -n "$print" | sed 's/.*/raw./')"
|
||||||
|
|
||||||
|
case $kind in
|
||||||
|
template)
|
||||||
|
cat <<EOF
|
||||||
|
build $root/.$name.updated | $root/.$name.json: extract $root/.everything.json
|
||||||
|
filter = --arg asset '$name' '.assets[\$\$asset].data'
|
||||||
|
target = $root/.$name.json
|
||||||
|
|
||||||
|
build $root/tex/$name.tex: template2tex $root/.$name.json | $base/templates/$template
|
||||||
|
template = $base/templates/$template
|
||||||
|
|
||||||
|
build $root/$name.pdf: tex2pdf $root/tex/$name.tex || $root/.$name.pdf.dd
|
||||||
|
dyndep = $root/.$name.pdf.dd
|
||||||
|
|
||||||
|
build $root/.$name.pdf.dd: scantex $root/tex/$name.tex
|
||||||
|
target = $root/$name.pdf
|
||||||
|
|
||||||
|
build $root/$name.${rawsuffix}png: pdf2png $root/$name.pdf
|
||||||
|
w = ${size%x*}
|
||||||
|
h = ${size#*x}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
|
||||||
|
image)
|
||||||
|
cat <<EOF
|
||||||
|
build $root/$name.${rawsuffix}png: copy $base/$source
|
||||||
|
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
|
||||||
|
tex)
|
||||||
|
cat <<EOF
|
||||||
|
build $root/$name.pdf: tex2pdf $base/$source || $root/.$name.pdf.dd
|
||||||
|
dyndep = $root/.$name.pdf.dd
|
||||||
|
|
||||||
|
build $root/.$name.pdf.dd: scantex $base/$source
|
||||||
|
target = $root/$name.pdf
|
||||||
|
|
||||||
|
build $root/$name.${rawsuffix}png: pdf2png $root/$name.pdf
|
||||||
|
w = ${size%x*}
|
||||||
|
h = ${size#*x}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
|
||||||
|
texdoc)
|
||||||
|
cat <<EOF
|
||||||
|
build $root/$name.pdf: tex2pdf2x $base/$source || $root/.$name.pdf.dd
|
||||||
|
dyndep = $root/.$name.pdf.dd
|
||||||
|
|
||||||
|
build $root/.$name.pdf.dd: scantex $base/$source
|
||||||
|
target = $root/$name.pdf
|
||||||
|
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
|
||||||
|
cat)
|
||||||
|
mapfile -t ins < <(jq -r ".[]" <<<"$contents")
|
||||||
|
echo -n "build $root/$name.pdf: pdfunite"
|
||||||
|
for i in "${ins[@]}"; do
|
||||||
|
echo -n " $root/$i.pdf"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "ERROR! UNKNOWN ASSET TYPE $kind!" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# always run convert if print is non-empty
|
||||||
|
if [ -n "$print" ]; then
|
||||||
|
cat <<EOF
|
||||||
|
build $root/$name.png: convert $root/$name.raw.png
|
||||||
|
args = $print
|
||||||
|
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
108
legs.yaml
108
legs.yaml
|
@ -82,3 +82,111 @@ legs:
|
||||||
4: hypo
|
4: hypo
|
||||||
6: hypo
|
6: hypo
|
||||||
8: damage
|
8: damage
|
||||||
|
|
||||||
|
park:
|
||||||
|
name: 'Park'
|
||||||
|
level: secondleg
|
||||||
|
effect: '\freecardtype{attachment}'
|
||||||
|
spaces:
|
||||||
|
2: starve
|
||||||
|
4: damage
|
||||||
|
6: damage
|
||||||
|
8: starve
|
||||||
|
|
||||||
|
solar_farm:
|
||||||
|
name: 'Solar Farm'
|
||||||
|
level: secondleg
|
||||||
|
effect: '\energycosts{-1}'
|
||||||
|
spaces:
|
||||||
|
2: damage
|
||||||
|
4: starve
|
||||||
|
6: starve
|
||||||
|
8: damage
|
||||||
|
|
||||||
|
town:
|
||||||
|
name: 'Town'
|
||||||
|
level: secondleg
|
||||||
|
effect: '\freecardtype{food}'
|
||||||
|
spaces:
|
||||||
|
2: hypo
|
||||||
|
4: starve
|
||||||
|
6: starve
|
||||||
|
8: hypo
|
||||||
|
|
||||||
|
village:
|
||||||
|
name: 'Village'
|
||||||
|
level: secondleg
|
||||||
|
effect: '\healthcosts{-1}'
|
||||||
|
spaces:
|
||||||
|
2: starve
|
||||||
|
4: hypo
|
||||||
|
6: hypo
|
||||||
|
8: starve
|
||||||
|
|
||||||
|
# Third legs
|
||||||
|
cliff:
|
||||||
|
name: 'Cliff'
|
||||||
|
level: thirdleg
|
||||||
|
effect: '\allowednot{\cardtypetext{personal}{}}'
|
||||||
|
spaces:
|
||||||
|
1: starve
|
||||||
|
3: hypo
|
||||||
|
5: starve
|
||||||
|
7: hypo
|
||||||
|
9: starve
|
||||||
|
|
||||||
|
wasteland:
|
||||||
|
name: 'Wasteland'
|
||||||
|
level: thirdleg
|
||||||
|
effect: '\allowednot{\cardtypetext{food}{}}'
|
||||||
|
spaces:
|
||||||
|
1: damage
|
||||||
|
3: starve
|
||||||
|
5: damage
|
||||||
|
7: starve
|
||||||
|
9: damage
|
||||||
|
|
||||||
|
exposed:
|
||||||
|
name: 'Exposed'
|
||||||
|
level: thirdleg
|
||||||
|
effect: '\daydraw{-3}'
|
||||||
|
spaces:
|
||||||
|
1: hypo
|
||||||
|
3: starve
|
||||||
|
5: hypo
|
||||||
|
7: starve
|
||||||
|
9: hypo
|
||||||
|
|
||||||
|
mountainside:
|
||||||
|
name: 'Mountainside'
|
||||||
|
level: thirdleg
|
||||||
|
effect: '\healthcosts{+1}'
|
||||||
|
spaces:
|
||||||
|
1: starve
|
||||||
|
3: damage
|
||||||
|
5: starve
|
||||||
|
7: damage
|
||||||
|
9: starve
|
||||||
|
|
||||||
|
river:
|
||||||
|
name: 'River'
|
||||||
|
level: thirdleg
|
||||||
|
effect: '\energycosts{+1}'
|
||||||
|
spaces:
|
||||||
|
1: hypo
|
||||||
|
3: damage
|
||||||
|
5: hypo
|
||||||
|
7: damage
|
||||||
|
9: hypo
|
||||||
|
|
||||||
|
swamp:
|
||||||
|
name: 'Swamp'
|
||||||
|
level: thirdleg
|
||||||
|
effect: '\speed{-3}'
|
||||||
|
spaces:
|
||||||
|
1: damage
|
||||||
|
3: hypo
|
||||||
|
5: damage
|
||||||
|
7: hypo
|
||||||
|
9: damage
|
||||||
|
|
||||||
|
|
25
rules.ninja
25
rules.ninja
|
@ -14,13 +14,12 @@ rule template2tex
|
||||||
|
|
||||||
rule cuegen
|
rule cuegen
|
||||||
description = run cue on $in to produce $out
|
description = run cue on $in to produce $out
|
||||||
command = cue export $in | bash update.sh $out
|
command = cue export $in > $out
|
||||||
# restat = 1
|
|
||||||
|
|
||||||
rule extract
|
rule extract
|
||||||
description = extract $out from $in via jq filter $filter
|
description = extract $target from $in via jq filter $filter
|
||||||
command = jq -c $filter < $in | bash update.sh $out
|
command = touch $out && jq -c $filter < $in | bash $base/update.sh $target
|
||||||
# restat = 1
|
restat = 1
|
||||||
|
|
||||||
rule tex2pdf
|
rule tex2pdf
|
||||||
description = render tex from $in to $out
|
description = render tex from $in to $out
|
||||||
|
@ -29,9 +28,7 @@ rule tex2pdf
|
||||||
-interaction=batchmode $
|
-interaction=batchmode $
|
||||||
-halt-on-error $
|
-halt-on-error $
|
||||||
--shell-escape $
|
--shell-escape $
|
||||||
--output-directory=$$(dirname $out) $in >/dev/null $
|
--output-directory=$$(dirname $out) $in >/dev/null
|
||||||
&& [ $$(basename -s .tex $in) = $$(basename -s .pdf $out) ] $
|
|
||||||
|| mv $$(dirname $out)/$$(basename -s .tex $in).pdf $out
|
|
||||||
pool = tex_pool
|
pool = tex_pool
|
||||||
|
|
||||||
rule tex2pdf2x
|
rule tex2pdf2x
|
||||||
|
@ -42,18 +39,16 @@ rule tex2pdf2x
|
||||||
-halt-on-error $
|
-halt-on-error $
|
||||||
--shell-escape $
|
--shell-escape $
|
||||||
--output-directory=$$(dirname $out) $in >/dev/null $
|
--output-directory=$$(dirname $out) $in >/dev/null $
|
||||||
&& xelatex $
|
|| xelatex $
|
||||||
-interaction=batchmode $
|
-interaction=batchmode $
|
||||||
-halt-on-error $
|
-halt-on-error $
|
||||||
--shell-escape $
|
--shell-escape $
|
||||||
--output-directory=$$(dirname $out) $in >/dev/null $
|
--output-directory=$$(dirname $out) $in >/dev/null
|
||||||
&& { [ $$(basename -s .tex $in) = $$(basename -s .pdf $out) ] $
|
|
||||||
|| mv $$(dirname $out)/$$(basename -s .tex $in).pdf $out; }
|
|
||||||
pool = tex_pool
|
pool = tex_pool
|
||||||
|
|
||||||
rule scantex
|
rule scantex
|
||||||
description = scan tex $in for dependencies
|
description = scan tex $in for dependencies
|
||||||
command = bash scantex.sh $in $target > $out
|
command = bash $base/scantex.sh $in $target > $out
|
||||||
|
|
||||||
rule pdf2png
|
rule pdf2png
|
||||||
description = convert pdf $in to png $out with size $w by $h
|
description = convert pdf $in to png $out with size $w by $h
|
||||||
|
@ -74,3 +69,7 @@ rule pdfunite
|
||||||
&& pdfjam --nup 3x3 $out $
|
&& pdfjam --nup 3x3 $out $
|
||||||
--no-landscape --delta '0.5cm 0.5cm' --scale 0.9 $
|
--no-landscape --delta '0.5cm 0.5cm' --scale 0.9 $
|
||||||
-o $$(dirname $out)/$$(basename -s .pdf $out)-mini.pdf >/dev/null 2>&1
|
-o $$(dirname $out)/$$(basename -s .pdf $out)-mini.pdf >/dev/null 2>&1
|
||||||
|
|
||||||
|
rule pngunite
|
||||||
|
description = unite pngs to create a mosaic
|
||||||
|
command = magick montage -mode concatenate $in $out
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
echo 'ninja_dyndep_version = 1'
|
echo 'ninja_dyndep_version = 1'
|
||||||
|
|
||||||
|
scriptdir="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||||
src="$1"
|
src="$1"
|
||||||
dst="$2"
|
dst="$2"
|
||||||
tgt="${dst%%.*}.pdf"
|
tgt="${dst%.*}.pdf"
|
||||||
|
|
||||||
|
cd "$scriptdir" || exit 1
|
||||||
|
|
||||||
temp="$(mktemp -p .)"
|
temp="$(mktemp -p .)"
|
||||||
trap 'rm -rf ${temp} ${temp}.*' EXIT INT
|
trap 'rm -rf ${temp} ${temp}.*' EXIT INT
|
||||||
|
@ -13,7 +16,7 @@ cp "$src" "$temp.tex"
|
||||||
xelatex -recorder --shell-escape "$temp.tex" >/dev/null
|
xelatex -recorder --shell-escape "$temp.tex" >/dev/null
|
||||||
|
|
||||||
deps="$(awk -v "temp=$temp" -v "repl=${src%%.*}" '/INPUT \./ {gsub(temp,repl,$2); print $2}' < "$temp.fls" | sort | uniq | tr '\n' ' ')"
|
deps="$(awk -v "temp=$temp" -v "repl=${src%%.*}" '/INPUT \./ {gsub(temp,repl,$2); print $2}' < "$temp.fls" | sort | uniq | tr '\n' ' ')"
|
||||||
outs="$(awk -v "temp=${temp#*/}" -v "repl=${dst%%.*}" '/OUTPUT / {gsub(temp,repl,$2); print $2}' < "$temp.fls" | sort | uniq | tr '\n' ' ')"
|
outs="$(awk -v "temp=${temp#*/}" -v "repl=${dst%.*}" '/OUTPUT / {gsub(temp,repl,$2); print $2}' < "$temp.fls" | sort | uniq | tr '\n' ' ')"
|
||||||
|
|
||||||
echo -n "build $tgt"
|
echo -n "build $tgt"
|
||||||
[ -z "$outs" ] || echo -n " | $outs"
|
[ -z "$outs" ] || echo -n " | $outs"
|
||||||
|
|
Loading…
Reference in a new issue