aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2023-11-10 11:38:33 +0100
committerGitHub <noreply@github.com>2023-11-10 10:38:33 +0000
commit96d37d3785ceadb33d0d0e9c81a967bf3179343a (patch)
treed9ab598a41f70fca7da6aac7e95b3f114872d132 /python/servo/command_base.py
parentc78b98252a7a6de2df8628adef9515d454c9c3ac (diff)
downloadservo-96d37d3785ceadb33d0d0e9c81a967bf3179343a.tar.gz
servo-96d37d3785ceadb33d0d0e9c81a967bf3179343a.zip
Add `--production` option to mach (#30707)
* --prod(uction) mach argument * Use profile in workflows instead of production * Use profiles in unit tests * ups * Build (${{ inputs.profile }})
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index c8de5a8ca61..f1d5e97974b 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -63,6 +63,9 @@ class BuildType:
def release() -> BuildType:
return BuildType(BuildType.Kind.RELEASE, None)
+ def prod() -> BuildType:
+ return BuildType(BuildType.Kind.CUSTOM, "production")
+
def custom(profile: str) -> BuildType:
return BuildType(BuildType.Kind.CUSTOM, profile)
@@ -72,6 +75,9 @@ class BuildType:
def is_release(self) -> bool:
return self.kind == BuildType.Kind.RELEASE
+ def is_prod(self) -> bool:
+ return self.kind == BuildType.Kind.CUSTOM and self.profile == "production"
+
def is_custom(self) -> bool:
return self.kind == BuildType.Kind.CUSTOM
@@ -734,6 +740,9 @@ class CommandBase(object):
CommandArgument('--dev', '--debug', '-d', group="Build Type",
action='store_true',
help='Build in development mode'),
+ CommandArgument('--prod', '--production', group="Build Type",
+ action='store_true',
+ help='Build in release mode without debug assertions'),
CommandArgument('--profile', group="Build Type",
help='Build with custom Cargo profile'),
]
@@ -798,10 +807,11 @@ class CommandBase(object):
# If `build_type` already exists in kwargs we are doing a recursive dispatch.
if 'build_type' not in kwargs:
kwargs['build_type'] = self.configure_build_type(
- kwargs['release'], kwargs['dev'], kwargs['profile'],
+ kwargs['release'], kwargs['dev'], kwargs['prod'], kwargs['profile'],
)
kwargs.pop('release', None)
kwargs.pop('dev', None)
+ kwargs.pop('prod', None)
kwargs.pop('profile', None)
if build_configuration:
@@ -819,8 +829,8 @@ class CommandBase(object):
return decorator_function
- def configure_build_type(self, release: bool, dev: bool, profile: Optional[str]) -> BuildType:
- option_count = release + dev + (profile is not None)
+ def configure_build_type(self, release: bool, dev: bool, prod: bool, profile: Optional[str]) -> BuildType:
+ option_count = release + dev + prod + (profile is not None)
if option_count > 1:
print("Please specify either --dev (-d) for a development")
@@ -842,6 +852,8 @@ class CommandBase(object):
return BuildType.release()
elif dev:
return BuildType.dev()
+ elif prod:
+ return BuildType.prod()
else:
return BuildType.custom(profile)