From 358e26a0cb1bb30a94f287af37103e7989eb20e5 Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 20 Jan 2025 19:16:01 -0800 Subject: [PATCH] No warm-up solutions --- build.sh | 54 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/build.sh b/build.sh index aac5dd6..73fb4fe 100755 --- a/build.sh +++ b/build.sh @@ -23,6 +23,7 @@ rm -f "${target_zip}" # job_name: name of this document. Output is saved as job_name.pdf # doc_dir: cd here before building. # main_file: build this tex file. Usually main.tex +# solutions: if 1, build solutions too function build() { local b_target_dir="${1}" local job_name="${2}" @@ -56,31 +57,33 @@ function build() { echo "" fi - # Build solutions - echo "\\def\\argYesSolutions{1}\\input{${main_file}}" | - "${tectonic}" \ - "${tectonic_args[@]}" \ - --outfmt pdf \ - - + if [[ $5 == 1 ]]; then + # Build solutions + echo "\\def\\argYesSolutions{1}\\input{${main_file}}" | + "${tectonic}" \ + "${tectonic_args[@]}" \ + --outfmt pdf \ + - - solution_stat=$? + solution_stat=$? - if [[ $solution_stat == 0 ]]; then - mkdir -p "${b_target_dir}" - mv texput.pdf "${b_target_dir}/${job_name}.sols.pdf" - else - rmdir --ignore-fail-on-non-empty "${b_target_dir}" - rm -f texput.pdf - echo "|> Solution build failed" + if [[ $solution_stat == 0 ]]; then + mkdir -p "${b_target_dir}" + mv texput.pdf "${b_target_dir}/${job_name}.sols.pdf" + else + rmdir --ignore-fail-on-non-empty "${b_target_dir}" + rm -f texput.pdf + echo "|> Solution build failed" + fi + + # Clean up if files contents are identical + #if [[ $(cmp -bl "${b_target_dir}/${job_name}.sols.pdf" "${b_target_dir}/${job_name}.pdf" | wc -l) < 200 ]]; then + # echo "|> Versions identical, removing ${job_name}.sols.pdf" + # rm "${b_target_dir}/${job_name}.sols.pdf" + # solution_stat=1; + #fi fi - # Clean up if files contents are identical - #if [[ $(cmp -bl "${b_target_dir}/${job_name}.sols.pdf" "${b_target_dir}/${job_name}.pdf" | wc -l) < 200 ]]; then - # echo "|> Versions identical, removing ${job_name}.sols.pdf" - # rm "${b_target_dir}/${job_name}.sols.pdf" - # solution_stat=1; - #fi - echo "" if [[ $handout_stat == 0 ]]; then @@ -113,7 +116,8 @@ for d in "${run_dir}/Misc/Warm-Ups"/*.tex; do "${target_dir}/Warm-Ups" \ "${file%.*}" \ "${run_dir}/Misc/Warm-Ups" \ - "${file}" + "${file}" \ + 0 done for d in "${run_dir}/Advanced"/*/; do @@ -124,7 +128,8 @@ for d in "${run_dir}/Advanced"/*/; do "${target_dir}/Advanced" \ "${job_name}" \ "${doc_dir}" \ - "main.tex" + "main.tex" \ + 1 done for d in "${run_dir}/Intermediate"/*/; do @@ -135,7 +140,8 @@ for d in "${run_dir}/Intermediate"/*/; do "${target_dir}/Intermediate" \ "${job_name}" \ "${doc_dir}" \ - "main.tex" + "main.tex" \ + 1 done echo -n "{}]" >>"$target_dir/index.json"