mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00:00
Android life cycle improvements and Gradle integration
This commit is contained in:
parent
350d9c6c47
commit
7a2a90959e
30 changed files with 945 additions and 634 deletions
|
@ -28,7 +28,6 @@ from servo.command_base import (
|
|||
BuildNotFound,
|
||||
cd,
|
||||
CommandBase,
|
||||
find_dep_path_newest,
|
||||
is_macosx,
|
||||
is_windows,
|
||||
get_browserhtml_path,
|
||||
|
@ -143,34 +142,12 @@ class PackageCommands(CommandBase):
|
|||
target_dir = path.dirname(binary_path)
|
||||
if android:
|
||||
if dev:
|
||||
env["NDK_DEBUG"] = "1"
|
||||
env["ANT_FLAVOR"] = "debug"
|
||||
dev_flag = "-d"
|
||||
task_name = "assembleArmDebug"
|
||||
else:
|
||||
env["ANT_FLAVOR"] = "release"
|
||||
dev_flag = ""
|
||||
|
||||
output_apk = "{}.apk".format(binary_path)
|
||||
|
||||
dir_to_apk = path.join(target_dir, "apk")
|
||||
if path.exists(dir_to_apk):
|
||||
print("Cleaning up from previous packaging")
|
||||
delete(dir_to_apk)
|
||||
shutil.copytree(path.join(dir_to_root, "support", "android", "apk"), dir_to_apk)
|
||||
|
||||
blurdroid_path = find_dep_path_newest('blurdroid', binary_path)
|
||||
if blurdroid_path is None:
|
||||
print("Could not find blurdroid package; perhaps you haven't built Servo.")
|
||||
return 1
|
||||
else:
|
||||
dir_to_libs = path.join(dir_to_apk, "libs")
|
||||
if not path.exists(dir_to_libs):
|
||||
os.makedirs(dir_to_libs)
|
||||
shutil.copy2(blurdroid_path + '/out/blurdroid.jar', dir_to_libs)
|
||||
task_name = "assembleArmRelease"
|
||||
try:
|
||||
with cd(path.join("support", "android", "build-apk")):
|
||||
subprocess.check_call(["cargo", "run", "--", dev_flag, "-o", output_apk, "-t", target_dir,
|
||||
"-r", dir_to_root], env=env)
|
||||
with cd(path.join("support", "android", "apk")):
|
||||
subprocess.check_call(["./gradlew", "--no-daemon", task_name], env=env)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Packaging Android exited with return value %d" % e.returncode)
|
||||
return e.returncode
|
||||
|
|
|
@ -83,11 +83,12 @@ class PostBuildCommands(CommandBase):
|
|||
return
|
||||
script = [
|
||||
"am force-stop com.mozilla.servo",
|
||||
"echo servo >/sdcard/servo/android_params"
|
||||
"echo servo >/sdcard/Android/data/com.mozilla.servo/files/android_params"
|
||||
]
|
||||
for param in params:
|
||||
script += [
|
||||
"echo '%s' >>/sdcard/servo/android_params" % param.replace("'", "\\'")
|
||||
"echo '%s' >>/sdcard/Android/data/com.mozilla.servo/files/android_params"
|
||||
% param.replace("'", "\\'")
|
||||
]
|
||||
script += [
|
||||
"am start com.mozilla.servo/com.mozilla.servo.MainActivity",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue