Migrate pylib/anki qt/aqt to group syntax (eg pylib:anki)
This commit is contained in:
parent
45f5709214
commit
09c57369ad
@ -13,7 +13,7 @@ if [ "$CLEAR_RUST" = "1" ]; then
|
||||
rm -rf $BUILD_ROOT/rust
|
||||
fi
|
||||
|
||||
./ninja pylib/anki qt/aqt check
|
||||
./ninja pylib qt check
|
||||
|
||||
echo "--- Ensure libs importable"
|
||||
SKIP_RUN=1 ./run
|
||||
|
@ -7,4 +7,4 @@ mkdir -p $STATE
|
||||
|
||||
echo "+++ Building and testing"
|
||||
ln -sf out/node_modules .
|
||||
BUILD_ROOT=$STATE/build ./ninja pylib/anki qt/aqt wheels check
|
||||
BUILD_ROOT=$STATE/build ./ninja pylib qt wheels check
|
||||
|
@ -9,7 +9,7 @@ if exist \buildkite\state\node_modules (
|
||||
move \buildkite\state\node_modules .
|
||||
)
|
||||
|
||||
call tools\ninja build pylib/anki qt/aqt check || exit /b 1
|
||||
call tools\ninja build pylib qt check || exit /b 1
|
||||
|
||||
echo --- Cleanup
|
||||
move out \buildkite\state\
|
||||
|
@ -43,7 +43,7 @@ fn build_forms(build: &mut Build) -> Result<()> {
|
||||
py_files.push(outpath.replace(".ui", "_qt6.py"));
|
||||
}
|
||||
build.add_action(
|
||||
"qt/aqt:forms",
|
||||
"qt:aqt:forms",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $first_form",
|
||||
@ -66,7 +66,7 @@ fn build_forms(build: &mut Build) -> Result<()> {
|
||||
/// _aqt module.
|
||||
fn build_generated_sources(build: &mut Build) -> Result<()> {
|
||||
build.add_action(
|
||||
"qt/aqt:hooks.py",
|
||||
"qt:aqt:hooks.py",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $out",
|
||||
@ -80,7 +80,7 @@ fn build_generated_sources(build: &mut Build) -> Result<()> {
|
||||
},
|
||||
)?;
|
||||
build.add_action(
|
||||
"qt/aqt:sass_vars",
|
||||
"qt:aqt:sass_vars",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $root_scss $out",
|
||||
@ -99,7 +99,7 @@ fn build_generated_sources(build: &mut Build) -> Result<()> {
|
||||
// we need to add a py.typed file to the generated sources, or mypy
|
||||
// will ignore them when used with the generated wheel
|
||||
build.add_action(
|
||||
"qt/aqt:py.typed",
|
||||
"qt:aqt:py.typed",
|
||||
CopyFile {
|
||||
input: "qt/aqt/py.typed".into(),
|
||||
output: "qt/_aqt/py.typed",
|
||||
@ -126,7 +126,7 @@ fn build_css(build: &mut Build) -> Result<()> {
|
||||
out_path.set_extension("css");
|
||||
|
||||
build.add_action(
|
||||
"qt/aqt:data/web/css",
|
||||
"qt:aqt:data:web:css",
|
||||
CompileSass {
|
||||
input: scss.into(),
|
||||
output: out_path.as_str(),
|
||||
@ -144,7 +144,7 @@ fn build_css(build: &mut Build) -> Result<()> {
|
||||
".css",
|
||||
);
|
||||
build.add_action(
|
||||
"qt/aqt:data/web/css",
|
||||
"qt:aqt:data:web:css",
|
||||
CopyFiles {
|
||||
inputs: other_ts_css.into(),
|
||||
output_folder: "qt/_aqt/data/web/css",
|
||||
@ -154,7 +154,7 @@ fn build_css(build: &mut Build) -> Result<()> {
|
||||
|
||||
fn build_imgs(build: &mut Build) -> Result<()> {
|
||||
build.add_action(
|
||||
"qt/aqt:data/web/imgs",
|
||||
"qt:aqt:data:web:imgs",
|
||||
CopyFiles {
|
||||
inputs: inputs![glob!["qt/aqt/data/web/imgs/*"]],
|
||||
output_folder: "qt/_aqt/data/web/imgs",
|
||||
@ -165,7 +165,7 @@ fn build_imgs(build: &mut Build) -> Result<()> {
|
||||
fn build_js(build: &mut Build) -> Result<()> {
|
||||
for ts_file in &["deckbrowser", "webview", "toolbar", "reviewer-bottom"] {
|
||||
build.add_action(
|
||||
"qt/aqt:data/web/js",
|
||||
"qt:aqt:data:web:js",
|
||||
EsbuildScript {
|
||||
script: "ts/transform_ts.mjs".into(),
|
||||
entrypoint: format!("qt/aqt/data/web/js/{ts_file}.ts").into(),
|
||||
@ -189,7 +189,7 @@ fn build_js(build: &mut Build) -> Result<()> {
|
||||
".js",
|
||||
);
|
||||
build.add_action(
|
||||
"qt/aqt:data/web/js",
|
||||
"qt:aqt:data:web:js",
|
||||
CopyFiles {
|
||||
inputs: files_from_ts.into(),
|
||||
output_folder: "qt/_aqt/data/web/js",
|
||||
@ -199,9 +199,9 @@ fn build_js(build: &mut Build) -> Result<()> {
|
||||
}
|
||||
|
||||
fn build_vendor_js(build: &mut Build) -> Result<()> {
|
||||
build.add_action("qt/aqt:data/web/js/vendor:mathjax", copy_mathjax())?;
|
||||
build.add_action("qt:aqt:data:web:js:vendor:mathjax", copy_mathjax())?;
|
||||
build.add_action(
|
||||
"qt/aqt:data/web/js/vendor",
|
||||
"qt:aqt:data:web:js:vendor",
|
||||
CopyFiles {
|
||||
inputs: inputs![
|
||||
":node_modules:jquery",
|
||||
@ -217,7 +217,7 @@ fn build_vendor_js(build: &mut Build) -> Result<()> {
|
||||
|
||||
fn build_pages(build: &mut Build) -> Result<()> {
|
||||
build.add_action(
|
||||
"qt/aqt:data/web/pages",
|
||||
"qt:aqt:data:web:pages",
|
||||
CopyFiles {
|
||||
inputs: inputs![":ts:pages"],
|
||||
output_folder: "qt/_aqt/data/web/pages",
|
||||
@ -229,30 +229,30 @@ fn build_pages(build: &mut Build) -> Result<()> {
|
||||
fn build_icons(build: &mut Build) -> Result<()> {
|
||||
build_themed_icons(build)?;
|
||||
build.add_action(
|
||||
"qt/aqt:data/qt/icons:mdi_unthemed",
|
||||
"qt:aqt:data:qt:icons:mdi_unthemed",
|
||||
CopyFiles {
|
||||
inputs: inputs![":node_modules:mdi_unthemed"],
|
||||
output_folder: "qt/_aqt/data/qt/icons",
|
||||
},
|
||||
)?;
|
||||
build.add_action(
|
||||
"qt/aqt:data/qt/icons:from_src",
|
||||
"qt:aqt:data:qt:icons:from_src",
|
||||
CopyFiles {
|
||||
inputs: inputs![glob!["qt/aqt/data/qt/icons/*.{png,svg}"]],
|
||||
output_folder: "qt/_aqt/data/qt/icons",
|
||||
},
|
||||
)?;
|
||||
build.add_action(
|
||||
"qt/aqt:data/qt/icons",
|
||||
"qt:aqt:data:qt:icons",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $out $in",
|
||||
inputs: hashmap! {
|
||||
"script" => inputs!["qt/tools/build_qrc.py"],
|
||||
"in" => inputs![
|
||||
":qt/aqt:data/qt/icons:mdi_unthemed",
|
||||
":qt/aqt:data/qt/icons:mdi_themed",
|
||||
":qt/aqt:data/qt/icons:from_src",
|
||||
":qt:aqt:data:qt:icons:mdi_unthemed",
|
||||
":qt:aqt:data:qt:icons:mdi_themed",
|
||||
":qt:aqt:data:qt:icons:from_src",
|
||||
]
|
||||
},
|
||||
outputs: hashmap! {
|
||||
@ -281,7 +281,7 @@ fn build_themed_icons(build: &mut Build) -> Result<()> {
|
||||
colors.extend(extra);
|
||||
}
|
||||
build.add_action(
|
||||
"qt/aqt:data/qt/icons:mdi_themed",
|
||||
"qt:aqt:data:qt:icons:mdi_themed",
|
||||
BuildThemedIcon {
|
||||
src_icon: path,
|
||||
colors,
|
||||
@ -324,7 +324,7 @@ impl BuildAction for BuildThemedIcon<'_> {
|
||||
build.add_inputs("pyenv_bin", inputs![":pyenv:bin"]);
|
||||
build.add_inputs("script", inputs!["qt/tools/color_svg.py"]);
|
||||
build.add_inputs("in", inputs![self.src_icon.as_str()]);
|
||||
build.add_inputs("", inputs![":qt/aqt:sass_vars"]);
|
||||
build.add_inputs("", inputs![":qt:aqt:sass_vars"]);
|
||||
build.add_variable("colors", self.colors.join(":"));
|
||||
build.add_outputs("out", outputs);
|
||||
}
|
||||
@ -333,7 +333,7 @@ impl BuildAction for BuildThemedIcon<'_> {
|
||||
fn build_macos_helper(build: &mut Build) -> Result<()> {
|
||||
if cfg!(target_os = "macos") {
|
||||
build.add_action(
|
||||
"qt/aqt:data/lib:libankihelper",
|
||||
"qt:aqt:data:lib:libankihelper",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $out $in",
|
||||
@ -359,7 +359,7 @@ fn build_wheel(build: &mut Build) -> Result<()> {
|
||||
src_folder: "qt/aqt",
|
||||
gen_folder: "$builddir/qt/_aqt",
|
||||
platform: None,
|
||||
deps: inputs![":qt/aqt", glob!("qt/aqt/**"), "python/requirements.aqt.in"],
|
||||
deps: inputs![":qt:aqt", glob!("qt/aqt/**"), "python/requirements.aqt.in"],
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -376,7 +376,7 @@ fn check_python(build: &mut Build) -> Result<()> {
|
||||
PythonTest {
|
||||
folder: "qt/tests",
|
||||
python_path: &["pylib", "$builddir/pylib", "$builddir/qt"],
|
||||
deps: inputs![":pylib/anki", ":qt/aqt", glob!["qt/tests/**"]],
|
||||
deps: inputs![":pylib:anki", ":qt:aqt", glob!["qt/tests/**"]],
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ fn main() -> Result<()> {
|
||||
check_sql(build)?;
|
||||
check_minilints(build)?;
|
||||
|
||||
build.trailing_text = "default pylib/anki qt/aqt\n".into();
|
||||
build.trailing_text = "default pylib qt\n".into();
|
||||
|
||||
build.write_build_file();
|
||||
|
||||
|
@ -21,14 +21,14 @@ use crate::python::GenPythonProto;
|
||||
pub fn build_pylib(build: &mut Build) -> Result<()> {
|
||||
// generated files
|
||||
build.add_action(
|
||||
"pylib/anki:proto",
|
||||
"pylib:anki:proto",
|
||||
GenPythonProto {
|
||||
proto_files: inputs![glob!["proto/anki/*.proto"]],
|
||||
},
|
||||
)?;
|
||||
|
||||
build.add_action(
|
||||
"pylib/anki:_fluent.py",
|
||||
"pylib:anki:_fluent.py",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $strings $out",
|
||||
@ -43,7 +43,7 @@ pub fn build_pylib(build: &mut Build) -> Result<()> {
|
||||
},
|
||||
)?;
|
||||
build.add_action(
|
||||
"pylib/anki:hooks_gen.py",
|
||||
"pylib:anki:hooks_gen.py",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $out",
|
||||
@ -57,9 +57,9 @@ pub fn build_pylib(build: &mut Build) -> Result<()> {
|
||||
},
|
||||
)?;
|
||||
build.add_action(
|
||||
"pylib/anki:_rsbridge",
|
||||
"pylib:anki:rsbridge",
|
||||
LinkFile {
|
||||
input: inputs![":pylib/rsbridge"],
|
||||
input: inputs![":pylib:rsbridge"],
|
||||
output: &format!(
|
||||
"pylib/anki/_rsbridge.{}",
|
||||
match build.host_platform {
|
||||
@ -69,7 +69,7 @@ pub fn build_pylib(build: &mut Build) -> Result<()> {
|
||||
),
|
||||
},
|
||||
)?;
|
||||
build.add_action("pylib/anki:buildinfo.py", GenBuildInfo {})?;
|
||||
build.add_action("pylib:anki:buildinfo.py", GenBuildInfo {})?;
|
||||
|
||||
// wheel
|
||||
build.add_action(
|
||||
@ -81,7 +81,7 @@ pub fn build_pylib(build: &mut Build) -> Result<()> {
|
||||
gen_folder: "$builddir/pylib/anki",
|
||||
platform: overriden_python_target_platform().or(Some(build.host_platform)),
|
||||
deps: inputs![
|
||||
":pylib/anki",
|
||||
":pylib:anki",
|
||||
glob!("pylib/anki/**"),
|
||||
"python/requirements.anki.in",
|
||||
],
|
||||
@ -98,7 +98,7 @@ pub fn check_pylib(build: &mut Build) -> Result<()> {
|
||||
PythonTest {
|
||||
folder: "pylib/tests",
|
||||
python_path: &["$builddir/pylib"],
|
||||
deps: inputs![":pylib/anki", glob!["pylib/{anki,tests}/**"]],
|
||||
deps: inputs![":pylib:anki", glob!["pylib/{anki,tests}/**"]],
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -175,8 +175,8 @@ pub fn check_python(build: &mut Build) -> Result<()> {
|
||||
],
|
||||
deps: inputs![
|
||||
glob!["{pylib,ftl,qt}/**/*.{py,pyi}"],
|
||||
":pylib/anki",
|
||||
":qt/aqt"
|
||||
":pylib:anki",
|
||||
":qt:aqt"
|
||||
],
|
||||
},
|
||||
)?;
|
||||
@ -191,9 +191,9 @@ fn add_pylint(build: &mut Build) -> Result<()> {
|
||||
// so we need to merge our pylib sources and generated files before invoking it,
|
||||
// and add a top-level __init__.py
|
||||
build.add_action(
|
||||
"pylint/anki",
|
||||
"check:pylint:copy_pylib",
|
||||
RsyncFiles {
|
||||
inputs: inputs![":pylib/anki"],
|
||||
inputs: inputs![":pylib:anki"],
|
||||
target_folder: "pylint/anki",
|
||||
strip_prefix: "$builddir/pylib/anki",
|
||||
// avoid copying our large rsbridge binary
|
||||
@ -201,7 +201,7 @@ fn add_pylint(build: &mut Build) -> Result<()> {
|
||||
},
|
||||
)?;
|
||||
build.add_action(
|
||||
"pylint/anki",
|
||||
"check:pylint:copy_pylib",
|
||||
RsyncFiles {
|
||||
inputs: inputs![glob!["pylib/anki/**"]],
|
||||
target_folder: "pylint/anki",
|
||||
@ -210,7 +210,7 @@ fn add_pylint(build: &mut Build) -> Result<()> {
|
||||
},
|
||||
)?;
|
||||
build.add_action(
|
||||
"pylint/anki",
|
||||
"check:pylint:copy_pylib",
|
||||
RunCommand {
|
||||
command: ":pyenv:bin",
|
||||
args: "$script $out",
|
||||
@ -231,8 +231,8 @@ fn add_pylint(build: &mut Build) -> Result<()> {
|
||||
],
|
||||
pylint_ini: inputs![".pylintrc"],
|
||||
deps: inputs![
|
||||
":pylint/anki",
|
||||
":qt/aqt",
|
||||
":check:pylint:copy_pylib",
|
||||
":qt:aqt",
|
||||
glob!("{pylib/tools,ftl,qt,python,tools}/**/*.py")
|
||||
],
|
||||
},
|
||||
|
@ -107,7 +107,7 @@ fn build_rsbridge(build: &mut Build) -> Result<()> {
|
||||
"native-tls"
|
||||
};
|
||||
build.add_action(
|
||||
"pylib/rsbridge",
|
||||
"pylib:rsbridge",
|
||||
CargoBuild {
|
||||
inputs: inputs![
|
||||
glob!["{pylib/rsbridge/**,rslib/**}"],
|
||||
@ -160,7 +160,7 @@ pub fn check_rust(build: &mut Build) -> Result<()> {
|
||||
let inputs = inputs![
|
||||
inputs,
|
||||
// defer tests until build has completed; ensure re-run on changes
|
||||
":pylib/rsbridge"
|
||||
":pylib:rsbridge"
|
||||
];
|
||||
|
||||
build.add_action(
|
||||
|
@ -14,7 +14,7 @@ pub struct ConfigureBuild {}
|
||||
|
||||
impl BuildAction for ConfigureBuild {
|
||||
fn command(&self) -> &str {
|
||||
"$cmd && ninja -f $builddir/build.ninja -t cleandead"
|
||||
"$cmd"
|
||||
}
|
||||
|
||||
fn files(&mut self, build: &mut impl FilesHandle) {
|
||||
|
@ -27,7 +27,7 @@ The build/ folder is made up of 4 packages:
|
||||
|
||||
If you run into trouble with the build process:
|
||||
|
||||
- You can see the executed commands with e.g. `./ninja pylib/anki -v`
|
||||
- You can see the executed commands with e.g. `./ninja pylib -v`
|
||||
- You can see the output of successful commands by defining OUTPUT_SUCCESS=1
|
||||
- You can see what's triggering a rebuild of a target with e.g.
|
||||
`./ninja qt/anki -d explain`.
|
||||
|
2
run
2
run
@ -6,5 +6,5 @@ export PYTHONWARNINGS=default
|
||||
export PYTHONPYCACHEPREFIX=out/pycache
|
||||
export ANKIDEV=1
|
||||
|
||||
./ninja pylib/anki qt/aqt
|
||||
./ninja pylib qt
|
||||
./out/pyenv/bin/python tools/run.py $*
|
||||
|
2
run.bat
2
run.bat
@ -8,6 +8,6 @@ set ANKIDEV=1
|
||||
REM put mpv on the path
|
||||
set PATH=%PATH%;out\extracted\win_amd64_audio
|
||||
|
||||
call tools\ninja pylib/anki qt/aqt extract:win_amd64_audio || exit /b 1
|
||||
call tools\ninja pylib qt extract:win_amd64_audio || exit /b 1
|
||||
.\out\pyenv\scripts\python tools\run.py %* || exit /b 1
|
||||
popd
|
||||
|
@ -2,5 +2,5 @@
|
||||
#
|
||||
# Run mypy in daemon mode for fast checking
|
||||
|
||||
./ninja pylib/anki qt/aqt
|
||||
./ninja pylib qt
|
||||
MYPY_CACHE_DIR=out/tests/mypy out/pyenv/bin/dmypy run pylib/anki qt/aqt pylib/tests
|
||||
|
@ -6,5 +6,5 @@ export PYTHONWARNINGS=default
|
||||
export PYTHONPYCACHEPREFIX=out/pycache
|
||||
export ANKIDEV=1
|
||||
|
||||
./ninja pylib/anki qt/aqt pyenv-qt5.14
|
||||
./ninja pylib qt pyenv-qt5.14
|
||||
./out/pyenv-qt5.14/bin/python tools/run.py $*
|
||||
|
@ -6,5 +6,5 @@ export PYTHONWARNINGS=default
|
||||
export PYTHONPYCACHEPREFIX=out/pycache
|
||||
export ANKIDEV=1
|
||||
|
||||
./ninja pylib/anki qt/aqt pyenv-qt5.15
|
||||
./ninja pylib qt pyenv-qt5.15
|
||||
./out/pyenv-qt5.15/bin/python tools/run.py $*
|
||||
|
Loading…
Reference in New Issue
Block a user