aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/post_build_commands.py
diff options
context:
space:
mode:
authorPaul Rouget <me@paulrouget.com>2018-07-31 22:38:54 +0800
committerPaul Rouget <me@paulrouget.com>2018-07-31 22:39:45 +0800
commitbef2fe83cd995eb291e1ce58c2966b232431a735 (patch)
treee41ff1e02633e59f1e016c493f86781636e47847 /python/servo/post_build_commands.py
parent76d394eca84b0acdeeabe90f855fa0a2b525d235 (diff)
downloadservo-bef2fe83cd995eb291e1ce58c2966b232431a735.tar.gz
servo-bef2fe83cd995eb291e1ce58c2966b232431a735.zip
new android port: fix android build and tests
Diffstat (limited to 'python/servo/post_build_commands.py')
-rw-r--r--python/servo/post_build_commands.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py
index 0132d2ea4b0..5b29015e8ff 100644
--- a/python/servo/post_build_commands.py
+++ b/python/servo/post_build_commands.py
@@ -9,6 +9,7 @@
from __future__ import print_function, unicode_literals
+import json
import os
import os.path as path
import subprocess
@@ -34,6 +35,13 @@ def read_file(filename, if_exists=False):
return f.read()
+# Copied from Python 3.3+'s shlex.quote()
+def shell_quote(arg):
+ # use single quotes, and put single quotes into double quotes
+ # the string $'b is then quoted as '$'"'"'b'
+ return "'" + arg.replace("'", "'\"'\"'") + "'"
+
+
@CommandProvider
class PostBuildCommands(CommandBase):
@Command('run',
@@ -88,15 +96,11 @@ class PostBuildCommands(CommandBase):
return
script = [
"am force-stop com.mozilla.servo",
- "echo servo >/sdcard/Android/data/com.mozilla.servo/files/android_params"
]
- for param in params:
- script += [
- "echo '%s' >>/sdcard/Android/data/com.mozilla.servo/files/android_params"
- % param.replace("'", "\\'")
- ]
+ json_params = shell_quote(json.dumps(params))
+ extra = "-e servoargs " + json_params
script += [
- "am start com.mozilla.servo/com.mozilla.servo.MainActivity",
+ "am start " + extra + " com.mozilla.servo/com.mozilla.servo.MainActivity",
"sleep 0.5",
"echo Servo PID: $(pidof com.mozilla.servo)",
"exit"
@@ -257,7 +261,7 @@ class PostBuildCommands(CommandBase):
copy2(full_name, destination)
return self.call_rustup_run(
- ["cargo", "doc", "--manifest-path", self.servo_manifest()] + params,
+ ["cargo", "doc", "--manifest-path", self.ports_servo_manifest()] + params,
env=self.build_env()
)