aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/platform/windows.py
diff options
context:
space:
mode:
authorMukilan Thiyagarajan <mukilan@igalia.com>2024-08-26 18:38:21 +0530
committerGitHub <noreply@github.com>2024-08-26 13:08:21 +0000
commitb6d5ac09b0b2acbb0f5b00232e53d0111a159063 (patch)
tree18842738e78794ba096a0af44b16d37695cff6d7 /python/servo/platform/windows.py
parent4397d8a02156a009d16d8b79796b1e54ca635624 (diff)
downloadservo-b6d5ac09b0b2acbb0f5b00232e53d0111a159063.tar.gz
servo-b6d5ac09b0b2acbb0f5b00232e53d0111a159063.zip
mach: introduce `BuildTarget` abstraction (#33114)
Introduce a new `BuildTarget` abstraction to centralize the code for supporting different ways of choosing the build target (e.g --android, --target x86_64-linux-android , --target aarch64-linux-ohos). This is currently handled in an adhoc fashion in different commands ( mach package, install, run) leading to a proliferation of keyword parameters for the commands and duplicated logic. The patch introduces a new `allow_target_configuration` decorator to do the validation and parsing of these parameters into the appropriate `BuildTarget` subclass, which is now stored as an instance attribute of the CommandBase class. All the code that previously relied on `self.cross_compile_target` has been switched to use the BuildTarget. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'python/servo/platform/windows.py')
-rw-r--r--python/servo/platform/windows.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/python/servo/platform/windows.py b/python/servo/platform/windows.py
index dced63a8fb5..52b7d4f0a2c 100644
--- a/python/servo/platform/windows.py
+++ b/python/servo/platform/windows.py
@@ -14,8 +14,10 @@ from typing import Optional
import urllib
import zipfile
-from .. import util
+from servo import util
+
from .base import Base
+from .build_target import BuildTarget
DEPS_URL = "https://github.com/servo/servo-build-deps/releases/download/msvc-deps"
DEPENDENCIES = {
@@ -57,7 +59,7 @@ class Windows(Base):
else:
print("done")
- def _platform_bootstrap(self, force: bool = False) -> bool:
+ def _platform_bootstrap(self, force: bool) -> bool:
installed_something = self.passive_bootstrap()
try:
@@ -77,7 +79,8 @@ class Windows(Base):
print("Could not run chocolatey. Follow manual build setup instructions.")
raise e
- installed_something |= self._platform_bootstrap_gstreamer(force)
+ target = BuildTarget.from_triple(None)
+ installed_something |= self._platform_bootstrap_gstreamer(target, force)
return installed_something
def passive_bootstrap(self) -> bool:
@@ -103,8 +106,8 @@ class Windows(Base):
return True
- def gstreamer_root(self, cross_compilation_target: Optional[str]) -> Optional[str]:
- build_target_triple = cross_compilation_target or self.triple
+ def gstreamer_root(self, target: BuildTarget) -> Optional[str]:
+ build_target_triple = target.triple()
gst_arch_names = {
"x86_64": "X86_64",
"x86": "X86",
@@ -132,11 +135,11 @@ class Windows(Base):
return None
- def is_gstreamer_installed(self, cross_compilation_target: Optional[str]) -> bool:
- return self.gstreamer_root(cross_compilation_target) is not None
+ def is_gstreamer_installed(self, target: BuildTarget) -> bool:
+ return self.gstreamer_root(target) is not None
- def _platform_bootstrap_gstreamer(self, force: bool) -> bool:
- if not force and self.is_gstreamer_installed(cross_compilation_target=None):
+ def _platform_bootstrap_gstreamer(self, target: BuildTarget, force: bool) -> bool:
+ if not force and self.is_gstreamer_installed(target):
return False
if "x86_64" not in self.triple:
@@ -171,5 +174,5 @@ class Windows(Base):
"msiexec.exe", "-ArgumentList", f"@({quoted_arguments})", ").ExitCode"
])
- assert self.is_gstreamer_installed(cross_compilation_target=None)
+ assert self.is_gstreamer_installed(target)
return True