Remove old build tools
This commit is contained in:
parent
a14656d94f
commit
3a79f8810c
24
.vscode/settings.json
vendored
24
.vscode/settings.json
vendored
@ -1,23 +1,3 @@
|
|||||||
{
|
{
|
||||||
//"latex-workshop.latex.recipe.default": "latexmk (lualatex)",
|
"latex-workshop.latex.recipe.default": "latexmk (xelatex)"
|
||||||
|
}
|
||||||
"latex-workshop.latex.recipe.default": "tectonic",
|
|
||||||
//"latex-workshop.latex.outDir": "%DIR%/../build/main",
|
|
||||||
"latex-workshop.latex.outDir": "%DIR%",
|
|
||||||
|
|
||||||
"latex-workshop.latex.recipes": [
|
|
||||||
{
|
|
||||||
"name": "tectonic",
|
|
||||||
"tools": ["tectonic"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
"latex-workshop.latex.tools": [
|
|
||||||
{
|
|
||||||
"name": "tectonic",
|
|
||||||
"command": "/home/mark/.cargo/bin/tectonic",
|
|
||||||
"args": ["-X", "compile", "--keep-intermediates", "--keep-logs", "%DOC_EXT%"],
|
|
||||||
"env": {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
153
build.sh
153
build.sh
@ -1,153 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# This script builds every document in this repo,
|
|
||||||
# (handout and solutions, if they exist), and creates
|
|
||||||
# a zip of all resulting files.
|
|
||||||
|
|
||||||
# Where we're running this script
|
|
||||||
run_dir=$(pwd)
|
|
||||||
|
|
||||||
tectonic=$(pwd)/tectonic
|
|
||||||
|
|
||||||
# Output files
|
|
||||||
target_dir="${run_dir}/output"
|
|
||||||
target_zip="${run_dir}/output.zip"
|
|
||||||
|
|
||||||
# Clean up previous build
|
|
||||||
rm -drf "${target_dir}"
|
|
||||||
rm -f "${target_zip}"
|
|
||||||
|
|
||||||
# Build one document.
|
|
||||||
# Args: <target_dir> <job_name> <doc_dir> <main_file>
|
|
||||||
# target_dir: move output pdf to this directory
|
|
||||||
# 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}"
|
|
||||||
local doc_dir="${3}"
|
|
||||||
local main_file="${4}"
|
|
||||||
|
|
||||||
echo "|> Building ${job_name}..."
|
|
||||||
cd "${doc_dir}"
|
|
||||||
|
|
||||||
tectonic_args=(
|
|
||||||
--chatter minimal
|
|
||||||
#--web-bundle "https://static.betalupi.com/tectonic/texlive2023.tar"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build handout
|
|
||||||
echo "\\def\\argNoSolutions{1}\\input{${main_file}}" |
|
|
||||||
"${tectonic}" \
|
|
||||||
"${tectonic_args[@]}" \
|
|
||||||
--outfmt pdf \
|
|
||||||
-
|
|
||||||
|
|
||||||
handout_stat=$?
|
|
||||||
|
|
||||||
if [[ $handout_stat == 0 ]]; then
|
|
||||||
mkdir -p "${b_target_dir}"
|
|
||||||
mv texput.pdf "${b_target_dir}/${job_name}.pdf"
|
|
||||||
else
|
|
||||||
rmdir --ignore-fail-on-non-empty "${b_target_dir}"
|
|
||||||
rm -f texput.pdf
|
|
||||||
echo "|> Handout build failed"
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $5 == 1 ]]; then
|
|
||||||
# Build solutions
|
|
||||||
echo "\\def\\argYesSolutions{1}\\input{${main_file}}" |
|
|
||||||
"${tectonic}" \
|
|
||||||
"${tectonic_args[@]}" \
|
|
||||||
--outfmt pdf \
|
|
||||||
-
|
|
||||||
|
|
||||||
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"
|
|
||||||
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
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
if [[ $handout_stat == 0 ]]; then
|
|
||||||
(
|
|
||||||
echo -n "{"
|
|
||||||
echo -n "\"title\": \"${job_name}\"",
|
|
||||||
echo -n "\"type\": \"$(realpath --relative-to="${target_dir}" "${b_target_dir}")\"",
|
|
||||||
echo -n "\"description\": \"${job_name}\"",
|
|
||||||
echo -n "\"handout\": \"https://static.betalupi.com/ormc/$(realpath --relative-to="${target_dir}" "${b_target_dir}")/${job_name}.pdf\","
|
|
||||||
if [[ $solution_stat == 0 ]]; then
|
|
||||||
echo -n "\"solutions\": \"https://static.betalupi.com/ormc/$(realpath --relative-to="${target_dir}" "${b_target_dir}")/${job_name}.sols.pdf\","
|
|
||||||
fi
|
|
||||||
if [ -f "starred" ]; then
|
|
||||||
echo -n "\"starred\": true"
|
|
||||||
else
|
|
||||||
echo -n "\"starred\": false"
|
|
||||||
fi
|
|
||||||
echo -n "},"
|
|
||||||
) >>"$target_dir/index.json"
|
|
||||||
fi
|
|
||||||
cd "${run_dir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdir -p "${target_dir}"
|
|
||||||
echo -n "[" >"$target_dir/index.json"
|
|
||||||
|
|
||||||
for d in "${run_dir}/Misc/Warm-Ups"/*.tex; do
|
|
||||||
file="$(basename "${d}")"
|
|
||||||
build \
|
|
||||||
"${target_dir}/Warm-Ups" \
|
|
||||||
"${file%.*}" \
|
|
||||||
"${run_dir}/Misc/Warm-Ups" \
|
|
||||||
"${file}" \
|
|
||||||
0
|
|
||||||
done
|
|
||||||
|
|
||||||
for d in "${run_dir}/Advanced"/*/; do
|
|
||||||
doc_dir=$(realpath "${d}")
|
|
||||||
job_name="$(basename "${doc_dir}")"
|
|
||||||
|
|
||||||
build \
|
|
||||||
"${target_dir}/Advanced" \
|
|
||||||
"${job_name}" \
|
|
||||||
"${doc_dir}" \
|
|
||||||
"main.tex" \
|
|
||||||
1
|
|
||||||
done
|
|
||||||
|
|
||||||
for d in "${run_dir}/Intermediate"/*/; do
|
|
||||||
doc_dir=$(realpath "${d}")
|
|
||||||
job_name="$(basename "${doc_dir}")"
|
|
||||||
|
|
||||||
build \
|
|
||||||
"${target_dir}/Intermediate" \
|
|
||||||
"${job_name}" \
|
|
||||||
"${doc_dir}" \
|
|
||||||
"main.tex" \
|
|
||||||
1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -n "{}]" >>"$target_dir/index.json"
|
|
||||||
|
|
||||||
# cd so paths in zip are relative
|
|
||||||
cd "${target_dir}"
|
|
||||||
|
|
||||||
zip -FSr "${target_zip}" .
|
|
||||||
zip -d "${target_zip}" "index.json" # We don't need this in the zip
|
|
Loading…
x
Reference in New Issue
Block a user