Add a `--make-dist` command to kiwix-build.
If specified, kiwix-build will not "make/install" the target but make the dist archive (source). It will build dependencies, as the make dist will try to compile and test the target.
This commit is contained in:
parent
bb5b85da50
commit
a9ce8ee8c1
|
@ -229,6 +229,12 @@ class Builder:
|
||||||
if hasattr(self, '_post_build_script'):
|
if hasattr(self, '_post_build_script'):
|
||||||
self.command('post_build_script', self._post_build_script)
|
self.command('post_build_script', self._post_build_script)
|
||||||
|
|
||||||
|
def make_dist(self):
|
||||||
|
if hasattr(self, '_pre_build_script'):
|
||||||
|
self.command('pre_build_script', self._pre_build_script)
|
||||||
|
self.command('configure', self._configure)
|
||||||
|
self.command('make_dist', self._make_dist)
|
||||||
|
|
||||||
|
|
||||||
class MakeBuilder(Builder):
|
class MakeBuilder(Builder):
|
||||||
configure_option = ""
|
configure_option = ""
|
||||||
|
@ -285,6 +291,11 @@ class MakeBuilder(Builder):
|
||||||
)
|
)
|
||||||
self.buildEnv.run_command(command, self.build_path, context)
|
self.buildEnv.run_command(command, self.build_path, context)
|
||||||
|
|
||||||
|
def _make_dist(self, context):
|
||||||
|
context.try_skip(self.build_path)
|
||||||
|
command = "make dist"
|
||||||
|
self.buildEnv.run_command(command, self.build_path, context)
|
||||||
|
|
||||||
|
|
||||||
class CMakeBuilder(MakeBuilder):
|
class CMakeBuilder(MakeBuilder):
|
||||||
def _configure(self, context):
|
def _configure(self, context):
|
||||||
|
@ -368,6 +379,10 @@ class MesonBuilder(Builder):
|
||||||
command = "{} -v install".format(self.buildEnv.ninja_command)
|
command = "{} -v install".format(self.buildEnv.ninja_command)
|
||||||
self.buildEnv.run_command(command, self.build_path, context)
|
self.buildEnv.run_command(command, self.build_path, context)
|
||||||
|
|
||||||
|
def _make_dist(self, context):
|
||||||
|
command = "{} -v dist".format(self.buildEnv.ninja_command)
|
||||||
|
self.buildEnv.run_command(command, self.build_path, context)
|
||||||
|
|
||||||
|
|
||||||
class GradleBuilder(Builder):
|
class GradleBuilder(Builder):
|
||||||
gradle_target = "build"
|
gradle_target = "build"
|
||||||
|
|
|
@ -942,9 +942,17 @@ class Builder:
|
||||||
|
|
||||||
builders = (dep.builder for dep in self.targets.values() if (dep.builder and not dep.skip))
|
builders = (dep.builder for dep in self.targets.values() if (dep.builder and not dep.skip))
|
||||||
for builder in builders:
|
for builder in builders:
|
||||||
|
if self.options.make_dist and builder.name == self.options.targets:
|
||||||
|
continue
|
||||||
print("build {} :".format(builder.name))
|
print("build {} :".format(builder.name))
|
||||||
builder.build()
|
builder.build()
|
||||||
|
|
||||||
|
if self.options.make_dist:
|
||||||
|
dep = self.targets[self.options.targets]
|
||||||
|
builder = dep.builder
|
||||||
|
print("make dist {}:".format(builder.name))
|
||||||
|
builder.make_dist()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
print("[INSTALL PACKAGES]")
|
print("[INSTALL PACKAGES]")
|
||||||
|
@ -980,6 +988,8 @@ def parse_args():
|
||||||
help="Skip the source download part")
|
help="Skip the source download part")
|
||||||
parser.add_argument('--build-deps-only', action='store_true',
|
parser.add_argument('--build-deps-only', action='store_true',
|
||||||
help="Build only the dependencies of the specified targets.")
|
help="Build only the dependencies of the specified targets.")
|
||||||
|
parser.add_argument('--make-dist', action='store_true',
|
||||||
|
help="Build distrubution (dist) source archive")
|
||||||
parser.add_argument('--make-release', action='store_true',
|
parser.add_argument('--make-release', action='store_true',
|
||||||
help="Build a release version")
|
help="Build a release version")
|
||||||
subgroup = parser.add_argument_group('advanced')
|
subgroup = parser.add_argument_group('advanced')
|
||||||
|
|
Loading…
Reference in New Issue