Skip to content

Commit da32008

Browse files
starting the migration the lyluatex. testing the CI
1 parent 0158fa0 commit da32008

17 files changed

Lines changed: 43 additions & 661 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ jobs:
2222
PDF_NAME="${PDF_BASE}.pdf"
2323
echo "Building PDF: $PDF_NAME"
2424
25-
# Snippet compile is the first step inside `make pdf` (lilypond-book). We do not
26-
# run `make lily` separately here to avoid compiling every snippet twice in CI.
25+
# lyluatex compiles the LilyPond scores during the LuaLaTeX passes.
2726
make pdf
2827
2928
# Copy the built PDF to the timestamped filename

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM --platform=linux/amd64 kyledickersoncomposer/docker-lilypond:latest
2+
3+
WORKDIR /workdir
4+
5+
COPY . .
6+
7+
RUN mkdir -p bin && \
8+
lualatex -interaction=nonstopmode -shell-escape main.tex && \
9+
biber main && \
10+
makeglossaries main && \
11+
makeindex main.idx -s main.ist -o main.ind && \
12+
lualatex -interaction=nonstopmode -shell-escape main.tex && \
13+
lualatex -interaction=nonstopmode -shell-escape main.tex && \
14+
mv main.pdf bin/

Makefile

Lines changed: 13 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,34 @@
1-
# Makefile for building The Barry Book
2-
# Builds LaTeX document and places all output in bin/
3-
4-
# Absolute repo root so lilypond-book → lilypond -I survives any cwd (e.g. CI Docker).
51
BOOK_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
6-
7-
# Same image as CI (.github/workflows/main.yml).
82
DOCKER_LILYPOND_IMAGE ?= kyledickersoncomposer/docker-lilypond:latest
9-
103
MAIN = main
11-
OUTPUT_DIR = bin
12-
LILYPOND_BOOK = lilypond-book
13-
14-
# Promote LilyPond warnings (including bar checks: "warning: barcheck failed") to fatal errors.
15-
# Without this, barcheck issues still produce a PDF and exit 0.
16-
LILYPOND_FLAGS ?= -dwarning-as-error
17-
18-
# lilypond-book hides each snippet’s LilyPond stderr unless this is set (default was none).
19-
LILYBOOK_LILY_LOGLEVEL ?= WARNING
20-
21-
# Second pass in make lily-check: parallel lilypond on each extracted lily-*.ly.
22-
LILY_CHECK_JOBS ?= 8
23-
24-
# LaTeX compiler
25-
LATEX = pdflatex
26-
BIBTEX = biber
27-
MAKEGLOSSARIES = makeglossaries
28-
LATEX_FLAGS = -output-directory=$(OUTPUT_DIR) -interaction=nonstopmode
29-
30-
docker-pull:
31-
docker pull --platform linux/amd64 $(DOCKER_LILYPOND_IMAGE)
32-
33-
# Environment passed into scripts/docker/run-*.sh (see those files for the full pipeline).
34-
DOCKER_RUN = docker run --rm --platform linux/amd64 --pull missing \
35-
-v "$(BOOK_ROOT):/workdir" -w /workdir
36-
DOCKER_ENV_COMMON = \
37-
-e MAIN=$(MAIN) \
38-
-e OUTPUT_DIR=$(OUTPUT_DIR) \
39-
-e LILYPOND_BOOK=$(LILYPOND_BOOK) \
40-
-e LILYPOND_FLAGS="$(LILYPOND_FLAGS)" \
41-
-e LILYBOOK_LILY_LOGLEVEL=$(LILYBOOK_LILY_LOGLEVEL) \
42-
-e LATEX=$(LATEX) \
43-
-e BIBTEX=$(BIBTEX) \
44-
-e MAKEGLOSSARIES=$(MAKEGLOSSARIES) \
45-
-e LATEX_FLAGS="$(LATEX_FLAGS)"
464

47-
.PHONY: _lily_snippets check-ly clean docx docker-pull lily lily-check open pdf require-pandoc
5+
.PHONY: run pdf open clean docx require-pandoc
486

7+
run:
8+
make pdf
9+
make open
4910
pdf:
50-
$(DOCKER_RUN) $(DOCKER_ENV_COMMON) \
51-
$(DOCKER_LILYPOND_IMAGE) \
52-
bash /workdir/scripts/docker/run-pdf.sh
53-
54-
# Strict LilyPond pass: clears cached lily-*.ly (so lilypond-book cannot skip stale snippets), then
55-
# lilypond-book, then runs lilypond again on each extracted snippet in parallel (full stderr per file).
56-
check-ly:
57-
@$(MAKE) lily-check
58-
59-
lily-check:
60-
@$(MAKE) _lily_snippets LILYBOOK_LOGLEVEL=PROGRESS LILY_SNIPPET_STRICT=1
61-
62-
# Verbose snippet run (maps generated files to .tex in the log).
63-
lily:
64-
@$(MAKE) _lily_snippets LILYBOOK_LOGLEVEL=DEBUG
65-
66-
# Internal: do not call directly unless LILYBOOK_LOGLEVEL is set (PROGRESS or DEBUG).
67-
# LILY_SNIPPET_STRICT=1 (make lily-check): delete cached lily-*.ly, then per-snippet lilypond re-run.
68-
_lily_snippets: LILYBOOK_LOGLEVEL ?= PROGRESS
69-
_lily_snippets: LILY_SNIPPET_STRICT ?= 0
70-
_lily_snippets:
71-
$(DOCKER_RUN) $(DOCKER_ENV_COMMON) \
72-
-e LILYBOOK_LOGLEVEL=$(LILYBOOK_LOGLEVEL) \
73-
-e LILY_SNIPPET_STRICT=$(LILY_SNIPPET_STRICT) \
74-
-e LILY_CHECK_JOBS=$(LILY_CHECK_JOBS) \
75-
$(DOCKER_LILYPOND_IMAGE) \
76-
bash /workdir/scripts/docker/run-lily-snippets.sh
77-
11+
docker build -t barry-book .
12+
docker run --rm -v "$(BOOK_ROOT)/bin:/workdir/bin" barry-book
13+
7814
require-pandoc:
7915
@command -v pandoc >/dev/null 2>&1 || { \
8016
echo "pandoc is required for DOCX export."; \
8117
echo "Install it with: brew install pandoc"; \
8218
exit 1; \
8319
}
84-
8520
docx: pdf require-pandoc
86-
@echo "Exporting $(OUTPUT_DIR)/$(MAIN).docx for Google Docs spell checking..."
87-
cd $(OUTPUT_DIR) && pandoc \
21+
@echo "Exporting bin/$(MAIN).docx for Google Docs spell checking..."
22+
cd bin && pandoc \
8823
--standalone \
8924
--from=latex \
9025
--to=docx \
9126
--resource-path=.:.. \
9227
--metadata=title:"The Barry Book" \
9328
--output=$(MAIN).docx \
94-
$(MAIN).tex
95-
@echo "DOCX export complete! Output: $(OUTPUT_DIR)/$(MAIN).docx"
96-
29+
../$(MAIN).tex
30+
@echo "DOCX export complete! Output: bin/$(MAIN).docx"
9731
open:
98-
open $(OUTPUT_DIR)/$(MAIN).pdf
99-
32+
open bin/$(MAIN).pdf
10033
clean:
101-
@echo "Cleaning build artifacts..."
102-
@rm -rf $(OUTPUT_DIR)
103-
@find . -maxdepth 1 -name "tmp*" -type f -delete 2>/dev/null
104-
@find . -maxdepth 1 -name "*.tmp" -type f -delete 2>/dev/null
105-
@echo "Clean complete!"
34+
rm -rf bin

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ The built PDF is also saved at `bin/main.pdf`.
9494
The build process:
9595

9696
- Starts the Docker build image
97-
- Processes `main.tex` and included `.tex` files with `lilypond-book`
98-
- Copies `references.bib` into the build directory
99-
- Runs `pdflatex`, `biber`, `makeglossaries`, and final LaTeX passes
97+
- Processes `main.tex` and included `.tex` files with LuaLaTeX and `lyluatex`
98+
- Runs `lualatex -shell-escape`, `biber`, `makeglossaries`, and final LaTeX passes
10099
- Generates `bin/main.pdf`
101100

102101
### Clean Build Artifacts
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
\beginOnePageRealBookChart
2-
\lilypondfile{chapters/applications/all-of-me/excerpts/all-of-me-changes.ly}
3-
\finishRealBookChart
41
\section{Tune with Changes}
2+
% \lilypondfile[insert=fullpage]{chapters/applications/all-of-me/excerpts/all-of-me-changes.ly}

chapters/applications/all-of-me/excerpts/all-of-me-changes.ly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title = #"All Of Me"
22
composer = #"-Simons & Marks"
33
meter = #" (Med. Swing)"
4-
\include "real-book-chart.ily"
4+
\include "../../../../source/real-book-chart.ily"
55

66
theNotes = \relative c' {
77
\key c \major
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
\section{Tune with Changes}
2-
These are words.
32

4-
\beginOnePageRealBookChart
5-
\lilypondfile{chapters/applications/stella-by-starlight/excerpts/stella-changes.ly}
6-
\finishRealBookChart
3+
\newgeometry{margin=0cm}
4+
\thispagestyle{empty}
5+
\lilypondfile[insert=fullpage]{chapters/applications/stella-by-starlight/excerpts/stella-changes.ly}
6+
\restoregeometry

chapters/foundations/functional-harmony/excerpt/fixed-height-demo.ly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\include "book-example.ily"
1+
\include "../../../../source/book-example.ily"
22

33
music = \relative c' {
44
\key c \major

chapters/foundations/functional-harmony/functions-as-tendency.tex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@ \section{Functions as Tendency}
22
ABC
33

44
\beginBookExample{Fixed-height excerpt primitive}
5-
\beginFixedHeightMusicExample{0.16\textheight}
6-
\lilypondfile{./chapters/foundations/functional-harmony/excerpt/fixed-height-demo.ly}
7-
\finishFixedHeightMusicExample
5+
% \lilypondfile[insert=systems]{./chapters/foundations/functional-harmony/excerpt/fixed-height-demo.ly}
86
\finishBookExample

frontmatter/source-note.tex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
\vspace*{\fill}
44
\begin{flushleft}
55
\begin{minipage}{0.78\textwidth}
6-
This work is freely available, transparent, and collaborative. The complete source code (every note, every chord symbol, every layout decision) is publicly accessible.
7-
8-
Anyone can view it, learn from it, suggest improvements, or adapt it for their own needs.
9-
10-
This is a living document, continuously refined and updated to maintain the highest standards of accuracy and pedagogical clarity.
6+
This work is freely available, transparent, and collaborative. The complete source code is publicly accessible. Anyone can view it, learn from it, suggest improvements, or adapt it for their own needs. This is a living document, continuously refined and updated to maintain the highest standards of accuracy and pedagogical clarity.
117
\end{minipage}
128
\end{flushleft}
139
\vspace*{\fill}

0 commit comments

Comments
 (0)