Make Android build optional on Nix (#31231)

* Make Android build optional on Nix

I want to build Servo without also installing the entire Android SDK.
This makes it so Android support is only built if `buildAndroid` is
true.

Signed-off-by: syvb <me@iter.ca>

* Add Android support to nix-shell if SERVO_ANDROID_BUILD set

---------

Signed-off-by: syvb <me@iter.ca>
This commit is contained in:
Smitty 2024-02-01 21:13:24 -05:00 committed by GitHub
parent 92af41cfeb
commit f27227b1db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 13 deletions

3
mach
View file

@ -36,10 +36,11 @@ if __name__ == '__main__':
import subprocess
from shlex import quote
mach_dir = os.path.abspath(os.path.dirname(__file__))
build_android_args = ['--arg', 'buildAndroid', 'true'] if 'SERVO_ANDROID_BUILD' in os.environ else []
print('NOTE: Entering nix-shell etc/shell.nix')
try:
# sys argv already contains the ./mach part, so we just need to pass it as-is
result = subprocess.run(['nix-shell', mach_dir + '/etc/shell.nix', '--run', ' '.join(map(quote, sys.argv))])
result = subprocess.run(['nix-shell', mach_dir + '/etc/shell.nix'] + build_android_args + ['--run', ' '.join(map(quote, sys.argv))])
sys.exit(result.returncode)
except KeyboardInterrupt:
sys.exit(0)