mirror of
https://github.com/servo/servo.git
synced 2025-06-18 13:24:29 +00:00
Auto merge of #18680 - MortimerGoro:android_flavors, r=larsbergstrom
Implement Gradle flavors for Android VR compilations <!-- Please describe your changes on the following line: --> This PR adds support to easily generate Android VR builds. Rust/Java VR dependencies are not added by default. Default build (No VR support) ``` ./mach build --release --android ./mach package --release --android ./mach install --release --android ``` GoogleVR builds (e.g. Daydream) ``` ./mach build --release --android --features googlevr ./mach package --release --android --flavor googlevr ./mach install --release --android ``` OculusVR builds (e.g. Gear VR) ``` ./mach build --release --android --features oculusvr ./mach package --release --android --flavor oculusvr ./mach install --release --android ``` --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18680) <!-- Reviewable:end -->
This commit is contained in:
commit
2567c40829
13 changed files with 132 additions and 21 deletions
|
@ -309,6 +309,11 @@ class MachCommands(CommandBase):
|
|||
env['CPPFLAGS'] = ' '.join(["--sysroot", env['ANDROID_SYSROOT']])
|
||||
env["CMAKE_ANDROID_ARCH_ABI"] = self.config["android"]["lib"]
|
||||
env["CMAKE_TOOLCHAIN_FILE"] = path.join(self.android_support_dir(), "toolchain.cmake")
|
||||
# Set output dir for gradle aar files
|
||||
aar_out_dir = self.android_aar_dir()
|
||||
if not os.path.exists(aar_out_dir):
|
||||
os.makedirs(aar_out_dir)
|
||||
env["AAR_OUT_DIR"] = aar_out_dir
|
||||
|
||||
cargo_binary = "cargo" + BIN_SUFFIX
|
||||
|
||||
|
|
|
@ -551,6 +551,9 @@ class CommandBase(object):
|
|||
def android_build_dir(self, dev):
|
||||
return path.join(self.get_target_dir(), self.config["android"]["target"], "debug" if dev else "release")
|
||||
|
||||
def android_aar_dir(self):
|
||||
return path.join(self.context.topdir, "target", "android_aar")
|
||||
|
||||
def handle_android_target(self, target):
|
||||
if target == "arm-linux-androideabi":
|
||||
self.config["android"]["platform"] = "android-18"
|
||||
|
|
|
@ -180,7 +180,10 @@ class PackageCommands(CommandBase):
|
|||
@CommandArgument('--target', '-t',
|
||||
default=None,
|
||||
help='Package for given target platform')
|
||||
def package(self, release=False, dev=False, android=None, debug=False, debugger=None, target=None):
|
||||
@CommandArgument('--flavor', '-f',
|
||||
default=None,
|
||||
help='Package using the given Gradle flavor')
|
||||
def package(self, release=False, dev=False, android=None, debug=False, debugger=None, target=None, flavor=None):
|
||||
env = self.build_env()
|
||||
if android is None:
|
||||
android = self.config["build"]["android"]
|
||||
|
@ -206,7 +209,11 @@ class PackageCommands(CommandBase):
|
|||
else:
|
||||
build_mode = "Release"
|
||||
|
||||
task_name = "assemble" + build_type + build_mode
|
||||
flavor_name = "Main"
|
||||
if flavor is not None:
|
||||
flavor_name = flavor.title()
|
||||
|
||||
task_name = "assemble" + flavor_name + build_type + build_mode
|
||||
try:
|
||||
with cd(path.join("support", "android", "apk")):
|
||||
subprocess.check_call(["./gradlew", "--no-daemon", task_name], env=env)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue