Fix recompilation of the CI of meson project.
We were assuming that meson project correspond to our projects and so we were always building them, even if they were already compiled. (This way, a simple `kiwix-build` is enough to recompile the WIP code of our project). However, on the CI, we do not archive the source code/build directory in the base deps archive. So when we try to compile, the compile step of meson projects fails because the source are not here. We have a small workaround for pugixml but as zstd is also meson, it is time to do something correct. By default, all projects now try to skip if a build is already present. Our projects are marked as `force_build` and so, they do not try to skip.
This commit is contained in:
parent
3ea1bfd38e
commit
fb07b58812
|
@ -148,12 +148,6 @@ def make_deps_archive(target=None, name=None, full=False):
|
||||||
files_to_archive += (HOME / "BUILD_native_static").glob("*/.*_ok")
|
files_to_archive += (HOME / "BUILD_native_static").glob("*/.*_ok")
|
||||||
files_to_archive += HOME.glob("BUILD_android*/**/.*_ok")
|
files_to_archive += HOME.glob("BUILD_android*/**/.*_ok")
|
||||||
files_to_archive += SOURCE_DIR.glob("*/.*_ok")
|
files_to_archive += SOURCE_DIR.glob("*/.*_ok")
|
||||||
files_to_archive += [
|
|
||||||
SOURCE_DIR / "pugixml-{}".format(base_deps_versions["pugixml"])
|
|
||||||
]
|
|
||||||
files_to_archive += HOME.glob(
|
|
||||||
"BUILD_*/pugixml-{}".format(base_deps_versions["pugixml"])
|
|
||||||
)
|
|
||||||
if PLATFORM_TARGET.startswith("armhf"):
|
if PLATFORM_TARGET.startswith("armhf"):
|
||||||
files_to_archive += (SOURCE_DIR / "armhf").glob("*")
|
files_to_archive += (SOURCE_DIR / "armhf").glob("*")
|
||||||
toolchains_subdirs = HOME.glob("BUILD_*/TOOLCHAINS/*/*")
|
toolchains_subdirs = HOME.glob("BUILD_*/TOOLCHAINS/*/*")
|
||||||
|
|
|
@ -21,6 +21,7 @@ class _MetaDependency(type):
|
||||||
|
|
||||||
class Dependency(metaclass=_MetaDependency):
|
class Dependency(metaclass=_MetaDependency):
|
||||||
all_deps = {}
|
all_deps = {}
|
||||||
|
force_build = False
|
||||||
force_native_build = False
|
force_native_build = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -240,6 +241,8 @@ class Builder:
|
||||||
print(" {} {} : ".format(name, self.name), end="", flush=True)
|
print(" {} {} : ".format(name, self.name), end="", flush=True)
|
||||||
log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
|
log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
|
||||||
context = Context(name, log, self.target.force_native_build)
|
context = Context(name, log, self.target.force_native_build)
|
||||||
|
if self.target.force_build:
|
||||||
|
context.no_skip = True
|
||||||
try:
|
try:
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
ret = function(*args, context=context)
|
ret = function(*args, context=context)
|
||||||
|
@ -493,11 +496,13 @@ class MesonBuilder(Builder):
|
||||||
run_command(command, self.source_path, context, env=env)
|
run_command(command, self.source_path, context, env=env)
|
||||||
|
|
||||||
def _compile(self, context):
|
def _compile(self, context):
|
||||||
|
context.try_skip(self.build_path)
|
||||||
command = "{} -v".format(neutralEnv('ninja_command'))
|
command = "{} -v".format(neutralEnv('ninja_command'))
|
||||||
env = self.buildEnv.get_env(cross_comp_flags=False, cross_compilers=False, cross_path=True)
|
env = self.buildEnv.get_env(cross_comp_flags=False, cross_compilers=False, cross_path=True)
|
||||||
run_command(command, self.build_path, context, env=env)
|
run_command(command, self.build_path, context, env=env)
|
||||||
|
|
||||||
def _test(self, context):
|
def _test(self, context):
|
||||||
|
context.try_skip(self.build_path)
|
||||||
if ( self.buildEnv.platformInfo.build == 'android'
|
if ( self.buildEnv.platformInfo.build == 'android'
|
||||||
or (self.buildEnv.platformInfo.build != 'native'
|
or (self.buildEnv.platformInfo.build != 'native'
|
||||||
and not self.buildEnv.platformInfo.static)
|
and not self.buildEnv.platformInfo.static)
|
||||||
|
@ -508,6 +513,7 @@ class MesonBuilder(Builder):
|
||||||
run_command(command, self.build_path, context, env=env)
|
run_command(command, self.build_path, context, env=env)
|
||||||
|
|
||||||
def _install(self, context):
|
def _install(self, context):
|
||||||
|
context.try_skip(self.build_path)
|
||||||
command = "{} -v install".format(neutralEnv('ninja_command'))
|
command = "{} -v install".format(neutralEnv('ninja_command'))
|
||||||
env = self.buildEnv.get_env(cross_comp_flags=False, cross_compilers=False, cross_path=True)
|
env = self.buildEnv.get_env(cross_comp_flags=False, cross_compilers=False, cross_path=True)
|
||||||
run_command(command, self.build_path, context, env=env)
|
run_command(command, self.build_path, context, env=env)
|
||||||
|
@ -536,6 +542,7 @@ class GradleBuilder(Builder):
|
||||||
shutil.copytree(self.source_path, self.build_path)
|
shutil.copytree(self.source_path, self.build_path)
|
||||||
|
|
||||||
def _compile(self, context):
|
def _compile(self, context):
|
||||||
|
context.try_skip(self.build_path)
|
||||||
command = "./gradlew {gradle_target} {gradle_option}"
|
command = "./gradlew {gradle_target} {gradle_option}"
|
||||||
command = command.format(
|
command = command.format(
|
||||||
gradle_target=self.gradle_target,
|
gradle_target=self.gradle_target,
|
||||||
|
|
|
@ -5,6 +5,7 @@ from .base import (
|
||||||
|
|
||||||
class KiwixDesktop(Dependency):
|
class KiwixDesktop(Dependency):
|
||||||
name = "kiwix-desktop"
|
name = "kiwix-desktop"
|
||||||
|
force_build = True
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/kiwix/kiwix-desktop.git"
|
git_remote = "https://github.com/kiwix/kiwix-desktop.git"
|
||||||
|
|
|
@ -10,6 +10,7 @@ from kiwixbuild._global import option, get_target_step, neutralEnv
|
||||||
|
|
||||||
class Kiwixlib(Dependency):
|
class Kiwixlib(Dependency):
|
||||||
name = "kiwix-lib"
|
name = "kiwix-lib"
|
||||||
|
force_build = True
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/kiwix/kiwix-lib.git"
|
git_remote = "https://github.com/kiwix/kiwix-lib.git"
|
||||||
|
@ -39,6 +40,7 @@ class Kiwixlib(Dependency):
|
||||||
|
|
||||||
class KiwixlibApp(Dependency):
|
class KiwixlibApp(Dependency):
|
||||||
name = "kiwix-lib-app"
|
name = "kiwix-lib-app"
|
||||||
|
force_build = True
|
||||||
|
|
||||||
class Source(Kiwixlib.Source):
|
class Source(Kiwixlib.Source):
|
||||||
name = "kiwix-lib"
|
name = "kiwix-lib"
|
||||||
|
|
|
@ -5,6 +5,7 @@ from .base import (
|
||||||
|
|
||||||
class KiwixTools(Dependency):
|
class KiwixTools(Dependency):
|
||||||
name = "kiwix-tools"
|
name = "kiwix-tools"
|
||||||
|
force_build = True
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/kiwix/kiwix-tools.git"
|
git_remote = "https://github.com/kiwix/kiwix-tools.git"
|
||||||
|
|
|
@ -6,6 +6,7 @@ from kiwixbuild._global import option
|
||||||
|
|
||||||
class Libzim(Dependency):
|
class Libzim(Dependency):
|
||||||
name = "libzim"
|
name = "libzim"
|
||||||
|
force_build = True
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/openzim/libzim.git"
|
git_remote = "https://github.com/openzim/libzim.git"
|
||||||
|
|
|
@ -5,6 +5,7 @@ from .base import (
|
||||||
|
|
||||||
class ZimTools(Dependency):
|
class ZimTools(Dependency):
|
||||||
name = "zim-tools"
|
name = "zim-tools"
|
||||||
|
force_build = True
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/openzim/zim-tools.git"
|
git_remote = "https://github.com/openzim/zim-tools.git"
|
||||||
|
|
|
@ -5,6 +5,7 @@ from .base import (
|
||||||
|
|
||||||
class Zimwriterfs(Dependency):
|
class Zimwriterfs(Dependency):
|
||||||
name = "zimwriterfs"
|
name = "zimwriterfs"
|
||||||
|
force_build = True
|
||||||
|
|
||||||
class Source(GitClone):
|
class Source(GitClone):
|
||||||
git_remote = "https://github.com/openzim/zimwriterfs.git"
|
git_remote = "https://github.com/openzim/zimwriterfs.git"
|
||||||
|
|
|
@ -187,8 +187,11 @@ class Context:
|
||||||
self.log_file = log_file
|
self.log_file = log_file
|
||||||
self.force_native_build = force_native_build
|
self.force_native_build = force_native_build
|
||||||
self.autoskip_file = None
|
self.autoskip_file = None
|
||||||
|
self.no_skip = False
|
||||||
|
|
||||||
def try_skip(self, path, extra_name=""):
|
def try_skip(self, path, extra_name=""):
|
||||||
|
if self.no_skip:
|
||||||
|
return
|
||||||
if extra_name:
|
if extra_name:
|
||||||
extra_name = "_{}".format(extra_name)
|
extra_name = "_{}".format(extra_name)
|
||||||
self.autoskip_file = pj(path, ".{}{}_ok".format(self.command_name, extra_name))
|
self.autoskip_file = pj(path, ".{}{}_ok".format(self.command_name, extra_name))
|
||||||
|
|
|
@ -236,10 +236,6 @@ def make_deps_archive(target=None, name=None, full=False):
|
||||||
files_to_archive += (HOME/"BUILD_native_static").glob('*/.*_ok')
|
files_to_archive += (HOME/"BUILD_native_static").glob('*/.*_ok')
|
||||||
files_to_archive += HOME.glob('BUILD_android*/**/.*_ok')
|
files_to_archive += HOME.glob('BUILD_android*/**/.*_ok')
|
||||||
files_to_archive += SOURCE_DIR.glob('*/.*_ok')
|
files_to_archive += SOURCE_DIR.glob('*/.*_ok')
|
||||||
files_to_archive += [SOURCE_DIR/'pugixml-{}'.format(
|
|
||||||
base_deps_versions['pugixml'])]
|
|
||||||
files_to_archive += HOME.glob('BUILD_*/pugixml-{}'.format(
|
|
||||||
base_deps_versions['pugixml']))
|
|
||||||
if PLATFORM.startswith('armhf'):
|
if PLATFORM.startswith('armhf'):
|
||||||
files_to_archive += (SOURCE_DIR/'armhf').glob('*')
|
files_to_archive += (SOURCE_DIR/'armhf').glob('*')
|
||||||
toolchains_subdirs = HOME.glob('**/TOOLCHAINS/*/*')
|
toolchains_subdirs = HOME.glob('**/TOOLCHAINS/*/*')
|
||||||
|
|
Loading…
Reference in New Issue