You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was written by an AI agent (Claude Code) working under the guidance of @felipesanches.
Summary
Many upstream Google Fonts repos need to run preparation scripts before invoking gftools-builder. Currently 61 repos use custom Python build scripts and 19 use custom shell scripts as wrappers around the build process. Adding a preCompile configuration key would let these projects move to a pure config.yaml-driven build.
Proposed Design
A new preCompile key in config.yaml that takes a list of shell commands to run before the build process begins:
preCompile: Shell commands that run as subprocesses before the build graph is created. They can modify source files, generate data, etc. They run after chdir to the config directory but before the recipe provider reads sources.
postCompile: Build operations that run on compiled font binaries within the ninja build graph.
This distinction is intentional — preCompile commands operate on source files (before fontmake runs), so they don't fit naturally into the ninja dependency graph as operations with $in/$out.
Implementation sketch
Schema: Add Optional("preCompile"): Seq(Str()) to GOOGLEFONTS_SCHEMA
Builder __init__: Run each command via subprocess.run(cmd, shell=True, check=True) after config parsing + chdir, but before calling the recipe provider
Docs: Add documentation alongside the existing postCompile entry
Does running preCompile commands as subprocesses (outside the ninja graph) seem like the right approach, or would you prefer them integrated into the build graph somehow?
Is Seq(Str()) (list of shell command strings) the right schema, or should it support operation dicts like postCompile does?
Any concerns about shell=True for running these commands? (It's needed for things like pipes and shell builtins, and matches what users would type in a terminal.)
Important
This issue was written by an AI agent (Claude Code) working under the guidance of @felipesanches.
Summary
Many upstream Google Fonts repos need to run preparation scripts before invoking
gftools-builder. Currently 61 repos use custom Python build scripts and 19 use custom shell scripts as wrappers around the build process. Adding apreCompileconfiguration key would let these projects move to a pureconfig.yaml-driven build.Proposed Design
A new
preCompilekey inconfig.yamlthat takes a list of shell commands to run before the build process begins:How it differs from
postCompilepreCompile: Shell commands that run as subprocesses before the build graph is created. They can modify source files, generate data, etc. They run afterchdirto the config directory but before the recipe provider reads sources.postCompile: Build operations that run on compiled font binaries within the ninja build graph.This distinction is intentional —
preCompilecommands operate on source files (before fontmake runs), so they don't fit naturally into the ninja dependency graph as operations with$in/$out.Implementation sketch
Optional("preCompile"): Seq(Str())toGOOGLEFONTS_SCHEMA__init__: Run each command viasubprocess.run(cmd, shell=True, check=True)after config parsing + chdir, but before calling the recipe providerpostCompileentryQuestions for @simoncozens
preCompilecommands as subprocesses (outside the ninja graph) seem like the right approach, or would you prefer them integrated into the build graph somehow?Seq(Str())(list of shell command strings) the right schema, or should it support operation dicts likepostCompiledoes?shell=Truefor running these commands? (It's needed for things like pipes and shell builtins, and matches what users would type in a terminal.)