From e59e3698b247a4e7abf2a7ca491fc8ac0f4cc26c Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Thu, 11 May 2023 16:17:21 +0200 Subject: [PATCH] Open build definition system to more complex build definition. --- .github/scripts/build_definition.py | 38 +++++++++++++----------- .github/scripts/build_projects.py | 4 +-- .github/scripts/build_release_nightly.py | 4 +-- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/scripts/build_definition.py b/.github/scripts/build_definition.py index 4cfe1ac..34107db 100644 --- a/.github/scripts/build_definition.py +++ b/.github/scripts/build_definition.py @@ -11,29 +11,29 @@ BUILD_DEF = """ | OS_NAME | DESKTOP | PLATFORM_TARGET | libzim | libkiwix | zim-tools | kiwix-tools | kiwix-desktop | ======================================================================================================= # Bionic is a special case as we need to compile libzim on old arch for python - | bionic | | | x | | | | | + | bionic | | | b | | | | | ------------------------------------------------------------------------------------------------------- # Osx builds, build binaries on native_dyn and native_static. On any other things, build only the libraries - | osx | | native_dyn | | | x | x | | - | osx | | native_static | | | x | x | | - | osx | | | x | x | | | | + | osx | | native_dyn | | | b | b | | + | osx | | native_static | | | b | b | | + | osx | | | b | b | | | | ------------------------------------------------------------------------------------------------------- # Build kiwix-desktop only on specific targets - | | eval'True | | | | | | x | - | | | flatpak | | | | | x | + | | eval'True | | | | | | b | + | | | flatpak | | | | | b | ------------------------------------------------------------------------------------------------------- # Library builds, on embedded archs or on all *_mixed targets - | | | android_.* | x | x | | | | - | | | native_mixed | x | x | | | | - | | | .*_mixed | x | | | | | - | | | wasm | x | | | | | + | | | android_.* | b | b | | | | + | | | native_mixed | b | b | | | | + | | | .*_mixed | b | | | | | + | | | wasm | b | | | | | # Build binaries on *_static targets or on all others "non mixed" targets (where we have already build libs) - | | | native_.* | | | x | x | | - | | | .*_static | | | x | x | | - | | | armv[68]_.* | | | x | x | | - | | | aarch64_.* | | | x | x | | + | | | native_.* | | | b | b | | + | | | .*_static | | | b | b | | + | | | armv[68]_.* | | | b | b | | + | | | aarch64_.* | | | b | b | | # Else, let's build everything. - | | | | x | x | x | x | | + | | | | b | b | b | b | | """ @@ -80,7 +80,11 @@ class Context(NamedTuple): return True -def select_build_targets(): +BUILD = "b" +DEPS = "d" + + +def select_build_targets(criteria): from common import PLATFORM_TARGET, DESKTOP, OS_NAME context = Context(PLATFORM_TARGET=PLATFORM_TARGET, DESKTOP=DESKTOP, OS_NAME=OS_NAME) @@ -97,7 +101,7 @@ def select_build_targets(): "kiwix-tools", "kiwix-desktop", ) - if row[k] == "x" + if criteria in row[k] ] print(build_order) return build_order diff --git a/.github/scripts/build_projects.py b/.github/scripts/build_projects.py index 9795b03..5e5b659 100755 --- a/.github/scripts/build_projects.py +++ b/.github/scripts/build_projects.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from build_definition import select_build_targets +from build_definition import select_build_targets, BUILD from common import ( run_kiwix_build, make_archive, @@ -12,7 +12,7 @@ from common import ( DEV_BRANCH, ) -for target in select_build_targets(): +for target in select_build_targets(BUILD): run_kiwix_build(target, platform=PLATFORM_TARGET) if target == "kiwix-desktop": archive = create_desktop_image(make_release=False) diff --git a/.github/scripts/build_release_nightly.py b/.github/scripts/build_release_nightly.py index ee6310e..a35c2ab 100755 --- a/.github/scripts/build_release_nightly.py +++ b/.github/scripts/build_release_nightly.py @@ -19,9 +19,9 @@ from common import ( notarize_macos_build, ) -from build_definition import select_build_targets +from build_definition import select_build_targets, BUILD -TARGETS = select_build_target() +TARGETS = select_build_target(BUILD) # Filter what to build if we are doing a release. if MAKE_RELEASE: