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>
This commit is contained in:
Mukilan Thiyagarajan 2024-08-26 18:38:21 +05:30 committed by GitHub
parent 4397d8a021
commit b6d5ac09b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 519 additions and 510 deletions

View file

@ -85,7 +85,7 @@ jobs:
APK_SIGNING_KEY_ALIAS: ${{ secrets.APK_SIGNING_KEY_ALIAS }}
APK_SIGNING_KEY_PASS: ${{ secrets.APK_SIGNING_KEY_PASS }}
run: |
python3 ./mach build --use-crown --locked --android --target ${{ matrix.arch }} --${{ inputs.profile }}
python3 ./mach build --use-crown --locked --target ${{ matrix.arch }} --${{ inputs.profile }}
cp -r target/cargo-timings target/cargo-timings-android-${{ matrix.arch }}
# TODO: This is disabled since APK crashes during startup.
# See https://github.com/servo/servo/issues/31134