Allow adding re-configure dependencies and doing non-matching builds (#22)

* Fix type checking errors with config version

* Add optional reconfigure dependency list to project config

* Add non-matching build option
Skips hash check and progress output

* Uncomment `config.reconfig_deps` assignment

* Change default target for non-matching instead of stubbing check/progress
This commit is contained in:
Nathan
2024-05-18 14:50:32 -06:00
committed by GitHub
parent d102696838
commit cf654dd8ad
2 changed files with 25 additions and 5 deletions

View File

@@ -71,6 +71,7 @@ class ProjectConfig:
self.sjiswrap_path: Optional[Path] = None # If None, download
# Project config
self.non_matching: bool = False
self.build_rels: bool = True # Build REL files
self.check_sha_path: Optional[Path] = None # Path to version.sha1
self.config_path: Optional[Path] = None # Path to config.yml
@@ -90,6 +91,9 @@ class ProjectConfig:
self.shift_jis = (
True # Convert source files from UTF-8 to Shift JIS automatically
)
self.reconfig_deps: Optional[List[Path]] = (
None # Additional re-configuration dependency files
)
# Progress output and progress.json config
self.progress_all: bool = True # Include combined "all" category
@@ -553,6 +557,7 @@ def generate_build_ninja(
)
n.newline()
link_outputs: List[Path] = []
if build_config:
link_steps: List[LinkStep] = []
used_compiler_versions: Set[str] = set()
@@ -760,6 +765,7 @@ def generate_build_ninja(
###
for step in link_steps:
step.write(n)
link_outputs.append(step.output())
n.newline()
###
@@ -861,7 +867,7 @@ def generate_build_ninja(
outputs=ok_path,
rule="check",
inputs=config.check_sha_path,
implicit=[dtk, *map(lambda step: step.output(), link_steps)],
implicit=[dtk, *link_outputs],
)
n.newline()
@@ -961,6 +967,7 @@ def generate_build_ninja(
configure_script,
python_lib,
python_lib_dir / "ninja_syntax.py",
*(config.reconfig_deps or [])
],
)
n.newline()
@@ -970,7 +977,10 @@ def generate_build_ninja(
###
n.comment("Default rule")
if build_config:
n.default(progress_path)
if config.non_matching:
n.default(link_outputs)
else:
n.default(progress_path)
else:
n.default(build_config_path)