mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #22306 - Manishearth:vr-packaging, r=jdm
Improve packaging for WebVR builds This is stuff I have to do manually each time I want to build a VR flavor of servo; making it automatic. <!-- 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/22306) <!-- Reviewable:end -->
This commit is contained in:
commit
eaf073b26b
4 changed files with 38 additions and 10 deletions
|
@ -564,8 +564,13 @@ class MachCommands(CommandBase):
|
|||
# Do some additional things if the build succeeded
|
||||
if status == 0:
|
||||
if android and not no_package:
|
||||
flavor = None
|
||||
if "googlevr" in features:
|
||||
flavor = "googlevr"
|
||||
elif "oculusvr" in features:
|
||||
flavor = "oculusvr"
|
||||
rv = Registrar.dispatch("package", context=self.context,
|
||||
release=release, dev=dev, target=target)
|
||||
release=release, dev=dev, target=target, flavor=flavor)
|
||||
if rv:
|
||||
return rv
|
||||
|
||||
|
|
|
@ -169,19 +169,24 @@ def copy_windows_dependencies(binary_path, destination):
|
|||
shutil.copy(nspr4_path, destination)
|
||||
|
||||
|
||||
def change_prefs(resources_path, platform):
|
||||
def change_prefs(resources_path, platform, vr=False):
|
||||
print("Swapping prefs")
|
||||
prefs_path = path.join(resources_path, "prefs.json")
|
||||
package_prefs_path = path.join(resources_path, "package-prefs.json")
|
||||
os_type = "os:{}".format(platform)
|
||||
with open(prefs_path) as prefs, open(package_prefs_path) as package_prefs:
|
||||
prefs = json.load(prefs)
|
||||
pref_sets = []
|
||||
package_prefs = json.load(package_prefs)
|
||||
for pref in package_prefs:
|
||||
if os_type in pref:
|
||||
prefs[pref.split(";")[1]] = package_prefs[pref]
|
||||
if pref in prefs:
|
||||
prefs[pref] = package_prefs[pref]
|
||||
if "all" in package_prefs:
|
||||
pref_sets += [package_prefs["all"]]
|
||||
if vr and "vr" in package_prefs:
|
||||
pref_sets += [package_prefs["vr"]]
|
||||
if platform in package_prefs:
|
||||
pref_sets += [package_prefs[platform]]
|
||||
for pref_set in pref_sets:
|
||||
for pref in pref_set:
|
||||
if pref in prefs:
|
||||
prefs[pref] = pref_set[pref]
|
||||
with open(prefs_path, "w") as out:
|
||||
json.dump(prefs, out, sort_keys=True, indent=2)
|
||||
delete(package_prefs_path)
|
||||
|
@ -276,6 +281,15 @@ class PackageCommands(CommandBase):
|
|||
if flavor is not None:
|
||||
flavor_name = flavor.title()
|
||||
|
||||
vr = flavor == "googlevr" or flavor == "oculusvr"
|
||||
|
||||
dir_to_resources = path.join(self.get_top_dir(), 'target', 'android', 'resources')
|
||||
if path.exists(dir_to_resources):
|
||||
delete(dir_to_resources)
|
||||
|
||||
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
|
||||
change_prefs(dir_to_resources, "android", vr=vr)
|
||||
|
||||
variant = ":assemble" + flavor_name + build_type + build_mode
|
||||
apk_task_name = ":servoapp" + variant
|
||||
aar_task_name = ":servoview" + variant
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
{
|
||||
"_comment": "this file is used to add some specific preferences to the Servo package (nightly builds)"
|
||||
"_comment": "this file is used to add some specific preferences to the Servo package (nightly builds)",
|
||||
"all": {},
|
||||
"macosx": {},
|
||||
"linux": {},
|
||||
"android": {},
|
||||
"windows": {},
|
||||
"vr": {
|
||||
"_comment": "settings specific to VR builds",
|
||||
"dom.webvr.enabled": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ android {
|
|||
|
||||
sourceSets {
|
||||
main {
|
||||
assets.srcDirs = ['../../../../resources']
|
||||
assets.srcDirs = [rootDir.absolutePath + "/../../../target/android/resources"]
|
||||
}
|
||||
armDebug {
|
||||
jniLibs.srcDirs = [getJniLibsPath(true, 'arm')]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue