mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
parent
01c7ac785b
commit
736559887b
2 changed files with 13 additions and 7 deletions
|
@ -148,6 +148,7 @@ class PackageCommands(CommandBase):
|
||||||
if android is None:
|
if android is None:
|
||||||
android = self.config["build"]["android"]
|
android = self.config["build"]["android"]
|
||||||
binary_path = self.get_binary_path(release, dev, android=android)
|
binary_path = self.get_binary_path(release, dev, android=android)
|
||||||
|
dir_to_root = self.get_top_dir()
|
||||||
if android:
|
if android:
|
||||||
if dev:
|
if dev:
|
||||||
env["NDK_DEBUG"] = "1"
|
env["NDK_DEBUG"] = "1"
|
||||||
|
@ -159,25 +160,31 @@ class PackageCommands(CommandBase):
|
||||||
|
|
||||||
target_dir = path.dirname(binary_path)
|
target_dir = path.dirname(binary_path)
|
||||||
output_apk = "{}.apk".format(binary_path)
|
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)
|
blurdroid_path = find_dep_path_newest('blurdroid', binary_path)
|
||||||
if blurdroid_path is None:
|
if blurdroid_path is None:
|
||||||
print("Could not find blurdroid package; perhaps you haven't built Servo.")
|
print("Could not find blurdroid package; perhaps you haven't built Servo.")
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
dir_to_libs = path.join("support", "android", "apk", "libs")
|
dir_to_libs = path.join(dir_to_apk, "libs")
|
||||||
if not path.exists(dir_to_libs):
|
if not path.exists(dir_to_libs):
|
||||||
os.makedirs(dir_to_libs)
|
os.makedirs(dir_to_libs)
|
||||||
shutil.copy2(blurdroid_path + '/out/blurdroid.jar', dir_to_libs)
|
shutil.copy2(blurdroid_path + '/out/blurdroid.jar', dir_to_libs)
|
||||||
try:
|
try:
|
||||||
with cd(path.join("support", "android", "build-apk")):
|
with cd(path.join("support", "android", "build-apk")):
|
||||||
subprocess.check_call(["cargo", "run", "--", dev_flag, "-o", output_apk, "-t", target_dir,
|
subprocess.check_call(["cargo", "run", "--", dev_flag, "-o", output_apk, "-t", target_dir,
|
||||||
"-r", self.get_top_dir()], env=env)
|
"-r", dir_to_root], env=env)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print("Packaging Android exited with return value %d" % e.returncode)
|
print("Packaging Android exited with return value %d" % e.returncode)
|
||||||
return e.returncode
|
return e.returncode
|
||||||
elif is_macosx():
|
elif is_macosx():
|
||||||
dir_to_build = path.dirname(binary_path)
|
dir_to_build = path.dirname(binary_path)
|
||||||
dir_to_root = self.get_top_dir()
|
|
||||||
|
|
||||||
print("Creating Servo.app")
|
print("Creating Servo.app")
|
||||||
dir_to_dmg = path.join(dir_to_build, 'dmg')
|
dir_to_dmg = path.join(dir_to_build, 'dmg')
|
||||||
|
@ -258,7 +265,6 @@ class PackageCommands(CommandBase):
|
||||||
print("Packaged Servo into " + tar_path)
|
print("Packaged Servo into " + tar_path)
|
||||||
elif is_windows():
|
elif is_windows():
|
||||||
dir_to_package = path.dirname(binary_path)
|
dir_to_package = path.dirname(binary_path)
|
||||||
dir_to_root = self.get_top_dir()
|
|
||||||
dir_to_msi = path.join(dir_to_package, 'msi')
|
dir_to_msi = path.join(dir_to_package, 'msi')
|
||||||
if path.exists(dir_to_msi):
|
if path.exists(dir_to_msi):
|
||||||
print("Cleaning up from previous packaging")
|
print("Cleaning up from previous packaging")
|
||||||
|
@ -268,7 +274,7 @@ class PackageCommands(CommandBase):
|
||||||
|
|
||||||
print("Copying files")
|
print("Copying files")
|
||||||
dir_to_resources = path.join(dir_to_msi, 'resources')
|
dir_to_resources = path.join(dir_to_msi, 'resources')
|
||||||
shutil.copytree(path.join(self.get_top_dir(), 'resources'), dir_to_resources)
|
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
|
||||||
|
|
||||||
change_prefs(dir_to_resources, "windows")
|
change_prefs(dir_to_resources, "windows")
|
||||||
|
|
||||||
|
@ -308,7 +314,7 @@ class PackageCommands(CommandBase):
|
||||||
|
|
||||||
print("Copying files")
|
print("Copying files")
|
||||||
dir_to_resources = path.join(dir_to_temp, 'resources')
|
dir_to_resources = path.join(dir_to_temp, 'resources')
|
||||||
shutil.copytree(path.join(self.get_top_dir(), 'resources'), dir_to_resources)
|
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
|
||||||
shutil.copytree(browserhtml_path, path.join(dir_to_temp, 'browserhtml'))
|
shutil.copytree(browserhtml_path, path.join(dir_to_temp, 'browserhtml'))
|
||||||
shutil.copy(binary_path, dir_to_temp)
|
shutil.copy(binary_path, dir_to_temp)
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ fn main() {
|
||||||
let debug = passthrough.contains(&"-d".to_string());
|
let debug = passthrough.contains(&"-d".to_string());
|
||||||
|
|
||||||
// Set the build directory that will contain all the necessary files to create the apk
|
// Set the build directory that will contain all the necessary files to create the apk
|
||||||
let directory = args.root_path.join("support").join("android").join("apk");
|
let directory = args.target_path.join("apk");
|
||||||
let resdir = args.root_path.join("resources/");
|
let resdir = args.root_path.join("resources/");
|
||||||
|
|
||||||
// executing ndk-build
|
// executing ndk-build
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue