Open build definition system to more complex build definition.

This commit is contained in:
Matthieu Gautier 2023-05-11 16:17:21 +02:00
parent fc81551555
commit e59e3698b2
3 changed files with 25 additions and 21 deletions

View File

@ -11,29 +11,29 @@ BUILD_DEF = """
| OS_NAME | DESKTOP | PLATFORM_TARGET | libzim | libkiwix | zim-tools | kiwix-tools | kiwix-desktop | | 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 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 builds, build binaries on native_dyn and native_static. On any other things, build only the libraries
| osx | | native_dyn | | | x | x | | | osx | | native_dyn | | | b | b | |
| osx | | native_static | | | x | x | | | osx | | native_static | | | b | b | |
| osx | | | x | x | | | | | osx | | | b | b | | | |
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------
# Build kiwix-desktop only on specific targets # Build kiwix-desktop only on specific targets
| | eval'True | | | | | | x | | | eval'True | | | | | | b |
| | | flatpak | | | | | x | | | | flatpak | | | | | b |
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------
# Library builds, on embedded archs or on all *_mixed targets # Library builds, on embedded archs or on all *_mixed targets
| | | android_.* | x | x | | | | | | | android_.* | b | b | | | |
| | | native_mixed | x | x | | | | | | | native_mixed | b | b | | | |
| | | .*_mixed | x | | | | | | | | .*_mixed | b | | | | |
| | | wasm | x | | | | | | | | wasm | b | | | | |
# Build binaries on *_static targets or on all others "non mixed" targets (where we have already build libs) # Build binaries on *_static targets or on all others "non mixed" targets (where we have already build libs)
| | | native_.* | | | x | x | | | | | native_.* | | | b | b | |
| | | .*_static | | | x | x | | | | | .*_static | | | b | b | |
| | | armv[68]_.* | | | x | x | | | | | armv[68]_.* | | | b | b | |
| | | aarch64_.* | | | x | x | | | | | aarch64_.* | | | b | b | |
# Else, let's build everything. # Else, let's build everything.
| | | | x | x | x | x | | | | | | b | b | b | b | |
""" """
@ -80,7 +80,11 @@ class Context(NamedTuple):
return True return True
def select_build_targets(): BUILD = "b"
DEPS = "d"
def select_build_targets(criteria):
from common import PLATFORM_TARGET, DESKTOP, OS_NAME from common import PLATFORM_TARGET, DESKTOP, OS_NAME
context = Context(PLATFORM_TARGET=PLATFORM_TARGET, DESKTOP=DESKTOP, OS_NAME=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-tools",
"kiwix-desktop", "kiwix-desktop",
) )
if row[k] == "x" if criteria in row[k]
] ]
print(build_order) print(build_order)
return build_order return build_order

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from build_definition import select_build_targets from build_definition import select_build_targets, BUILD
from common import ( from common import (
run_kiwix_build, run_kiwix_build,
make_archive, make_archive,
@ -12,7 +12,7 @@ from common import (
DEV_BRANCH, DEV_BRANCH,
) )
for target in select_build_targets(): for target in select_build_targets(BUILD):
run_kiwix_build(target, platform=PLATFORM_TARGET) run_kiwix_build(target, platform=PLATFORM_TARGET)
if target == "kiwix-desktop": if target == "kiwix-desktop":
archive = create_desktop_image(make_release=False) archive = create_desktop_image(make_release=False)

View File

@ -19,9 +19,9 @@ from common import (
notarize_macos_build, 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. # Filter what to build if we are doing a release.
if MAKE_RELEASE: if MAKE_RELEASE: