aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo
diff options
context:
space:
mode:
Diffstat (limited to 'python/servo')
-rw-r--r--python/servo/build_commands.py4
-rw-r--r--python/servo/command_base.py6
-rw-r--r--python/servo/package_commands.py17
-rw-r--r--python/servo/platform/build_target.py6
-rw-r--r--python/servo/testing_commands.py2
5 files changed, 22 insertions, 13 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 121aa493459..622f99ad067 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -59,7 +59,7 @@ class MachCommands(CommandBase):
help="Command-line arguments to be passed through to Cargo")
@CommandBase.common_command_arguments(build_configuration=True, build_type=True)
def build(self, build_type: BuildType, jobs=None, params=None, no_package=False,
- verbose=False, very_verbose=False, with_asan=False, **kwargs):
+ verbose=False, very_verbose=False, with_asan=False, flavor=None, **kwargs):
opts = params or []
if build_type.is_release():
@@ -134,7 +134,7 @@ class MachCommands(CommandBase):
built_binary = self.get_binary_path(build_type, asan=with_asan)
if not no_package and self.target.needs_packaging():
- rv = Registrar.dispatch("package", context=self.context, build_type=build_type, flavor=None)
+ rv = Registrar.dispatch("package", context=self.context, build_type=build_type, flavor=flavor)
if rv:
return rv
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 6513a1b150a..1436aa41379 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -531,7 +531,11 @@ class CommandBase(object):
help='Build in release mode without debug assertions'),
CommandArgument('--profile', group="Build Type",
help='Build with custom Cargo profile'),
- CommandArgument('--with-asan', action='store_true', help="Build with AddressSanitizer")
+ CommandArgument('--with-asan', action='store_true', help="Build with AddressSanitizer"),
+ CommandArgument(
+ '--flavor', default=None, group="Build Type",
+ help='Product flavor to be used when packaging with Gradle/Hvigor (android/ohos).'
+ ),
]
if build_configuration:
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py
index 6ddf378c2c5..6d7e80b58b2 100644
--- a/python/servo/package_commands.py
+++ b/python/servo/package_commands.py
@@ -132,9 +132,6 @@ class PackageCommands(CommandBase):
@CommandArgument('--target', '-t',
default=None,
help='Package for given target platform')
- @CommandArgument('--flavor', '-f',
- default=None,
- help='Package using the given Gradle flavor')
@CommandBase.common_command_arguments(build_configuration=False, build_type=True)
@CommandBase.allow_target_configuration
def package(self, build_type: BuildType, flavor=None, with_asan=False):
@@ -203,7 +200,13 @@ class PackageCommands(CommandBase):
if build_type.is_custom():
build_mode = "release"
- hvigor_command = ["--no-daemon", "assembleHap", "-p", "product=default", "-p", f"buildMode={build_mode}"]
+ flavor_name = "default"
+ if flavor is not None:
+ flavor_name = flavor
+
+ hvigor_command = ["--no-daemon", "assembleHap",
+ "-p", f"product={flavor_name}",
+ "-p", f"buildMode={build_mode}"]
# Detect if PATH already has hvigor, or else fallback to npm installation
# provided via HVIGOR_PATH
if "HVIGOR_PATH" not in env:
@@ -419,7 +422,7 @@ class PackageCommands(CommandBase):
help='Install the given target platform')
@CommandBase.common_command_arguments(build_configuration=False, build_type=True)
@CommandBase.allow_target_configuration
- def install(self, build_type: BuildType, emulator=False, usb=False, with_asan=False):
+ def install(self, build_type: BuildType, emulator=False, usb=False, with_asan=False, flavor=None):
env = self.build_env()
try:
binary_path = self.get_binary_path(build_type, asan=with_asan)
@@ -448,7 +451,7 @@ class PackageCommands(CommandBase):
exec_command += ["-d"]
exec_command += ["install", "-r", pkg_path]
elif self.is_openharmony():
- pkg_path = self.target.get_package_path(build_type.directory_name())
+ pkg_path = self.target.get_package_path(build_type.directory_name(), flavor=flavor)
hdc_path = path.join(env["OHOS_SDK_NATIVE"], "../", "toolchains", "hdc")
exec_command = [hdc_path, "install", "-r", pkg_path]
elif is_windows():
@@ -458,7 +461,7 @@ class PackageCommands(CommandBase):
if not path.exists(pkg_path):
print("Servo package not found. Packaging servo...")
result = Registrar.dispatch(
- "package", context=self.context, build_type=build_type
+ "package", context=self.context, build_type=build_type, flavor=flavor
)
if result != 0:
return result
diff --git a/python/servo/platform/build_target.py b/python/servo/platform/build_target.py
index ecdb6c71c13..2118e2e1efe 100644
--- a/python/servo/platform/build_target.py
+++ b/python/servo/platform/build_target.py
@@ -382,11 +382,13 @@ class OpenHarmonyTarget(CrossBuildTarget):
def needs_packaging(self) -> bool:
return True
- def get_package_path(self, build_type_directory: str) -> str:
+ def get_package_path(self, build_type_directory: str, flavor: Optional[str] = None) -> str:
base_path = util.get_target_dir()
base_path = path.join(base_path, "openharmony", self.triple())
hap_name = "servoshell-default-signed.hap"
- build_output_path = path.join("entry", "build", "default", "outputs", "default")
+ if not flavor:
+ flavor = "default"
+ build_output_path = path.join("entry", "build", flavor, "outputs", "default")
return path.join(base_path, build_type_directory, build_output_path, hap_name)
def abi_string(self) -> str:
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index 0e08f84c3ea..16ea7333758 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -806,7 +806,7 @@ tests/wpt/mozilla/tests for Servo-only tests""" % reference_path)
@CommandArgument('params', nargs='...',
help="Command-line arguments to be passed through to Servo")
@CommandBase.common_command_arguments(binary_selection=True)
- def smoketest(self, servo_binary: str, params):
+ def smoketest(self, servo_binary: str, params, **kwargs):
# We pass `-f` here so that any thread panic will cause Servo to exit,
# preventing a panic from hanging execution. This means that these kind
# of panics won't cause timeouts on CI.