aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo
diff options
context:
space:
mode:
Diffstat (limited to 'python/servo')
-rw-r--r--python/servo/bootstrap_commands.py10
-rw-r--r--python/servo/build_commands.py53
-rw-r--r--python/servo/command_base.py2
-rw-r--r--python/servo/package_commands.py40
4 files changed, 83 insertions, 22 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py
index 6361fa8189a..a2df3aaef33 100644
--- a/python/servo/bootstrap_commands.py
+++ b/python/servo/bootstrap_commands.py
@@ -92,7 +92,7 @@ class MachCommands(CommandBase):
if not (build or emulator_x86):
print("Must specify `--build` or `--emulator-x86` or both.")
- ndk = "android-ndk-r12b-{system}-{arch}"
+ ndk = "android-ndk-r15c-{system}-{arch}"
tools = "sdk-tools-{system}-4333796"
emulator_platform = "android-28"
@@ -105,10 +105,10 @@ class MachCommands(CommandBase):
"sdk-tools-windows-4333796.zip": "aa298b5346ee0d63940d13609fe6bec621384510",
# https://developer.android.com/ndk/downloads/older_releases
- "android-ndk-r12b-windows-x86.zip": "8e6eef0091dac2f3c7a1ecbb7070d4fa22212c04",
- "android-ndk-r12b-windows-x86_64.zip": "337746d8579a1c65e8a69bf9cbdc9849bcacf7f5",
- "android-ndk-r12b-darwin-x86_64.zip": "e257fe12f8947be9f79c10c3fffe87fb9406118a",
- "android-ndk-r12b-linux-x86_64.zip": "170a119bfa0f0ce5dc932405eaa3a7cc61b27694",
+ "android-ndk-r15c-windows-x86.zip": "f2e47121feb73ec34ced5e947cbf1adc6b56246e",
+ "android-ndk-r15c-windows-x86_64.zip": "970bb2496de0eada74674bb1b06d79165f725696",
+ "android-ndk-r15c-darwin-x86_64.zip": "ea4b5d76475db84745aa8828000d009625fc1f98",
+ "android-ndk-r15c-linux-x86_64.zip": "0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2",
}
toolchains = path.join(self.context.topdir, "android-toolchains")
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 512fdfe4977..c40890ff579 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -339,15 +339,15 @@ class MachCommands(CommandBase):
shutil.copy(path.join(self.android_support_dir(), "openssl.makefile"), openssl_dir)
shutil.copy(path.join(self.android_support_dir(), "openssl.sh"), openssl_dir)
- # Check if the NDK version is 12
+ # Check if the NDK version is 15
if not os.path.isfile(path.join(env["ANDROID_NDK"], 'source.properties')):
print("ANDROID_NDK should have file `source.properties`.")
print("The environment variable ANDROID_NDK may be set at a wrong path.")
sys.exit(1)
with open(path.join(env["ANDROID_NDK"], 'source.properties')) as ndk_properties:
lines = ndk_properties.readlines()
- if lines[1].split(' = ')[1].split('.')[0] != '12':
- print("Currently only support NDK 12.")
+ if lines[1].split(' = ')[1].split('.')[0] != '15':
+ print("Currently only support NDK 15. Please re-run `./mach bootstrap-android`.")
sys.exit(1)
env["RUST_TARGET"] = target
@@ -388,13 +388,20 @@ class MachCommands(CommandBase):
env['PATH'] = (path.join(llvm_toolchain, "bin") + ':'
+ path.join(gcc_toolchain, "bin") + ':'
+ env['PATH'])
- env['ANDROID_SYSROOT'] = path.join(env['ANDROID_NDK'], "platforms",
- android_platform, "arch-" + android_arch)
+ env['ANDROID_SYSROOT'] = path.join(env['ANDROID_NDK'], "sysroot")
support_include = path.join(env['ANDROID_NDK'], "sources", "android", "support", "include")
+ cpufeatures_include = path.join(env['ANDROID_NDK'], "sources", "android", "cpufeatures")
cxx_include = path.join(env['ANDROID_NDK'], "sources", "cxx-stl",
- "llvm-libc++", "libcxx", "include")
+ "llvm-libc++", "include")
clang_include = path.join(llvm_toolchain, "lib64", "clang", "3.8", "include")
+ cxxabi_include = path.join(env['ANDROID_NDK'], "sources", "cxx-stl",
+ "llvm-libc++abi", "include")
sysroot_include = path.join(env['ANDROID_SYSROOT'], "usr", "include")
+ arch_include = path.join(sysroot_include, android_toolchain_name)
+ android_platform_dir = path.join(env['ANDROID_NDK'], "platforms", android_platform, "arch-" + android_arch)
+ arch_libs = path.join(android_platform_dir, "usr", "lib")
+ clang_include = path.join(llvm_toolchain, "lib64", "clang", "5.0", "include")
+ android_api = android_platform.replace('android-', '')
env['HOST_CC'] = host_cc
env['HOST_CXX'] = host_cxx
env['HOST_CFLAGS'] = ''
@@ -403,6 +410,9 @@ class MachCommands(CommandBase):
env['CPP'] = path.join(llvm_toolchain, "bin", "clang") + " -E"
env['CXX'] = path.join(llvm_toolchain, "bin", "clang++")
env['ANDROID_TOOLCHAIN'] = gcc_toolchain
+ env['ANDROID_TOOLCHAIN_DIR'] = gcc_toolchain
+ env['ANDROID_VERSION'] = android_api
+ env['ANDROID_PLATFORM_DIR'] = android_platform_dir
env['GCC_TOOLCHAIN'] = gcc_toolchain
gcc_toolchain_bin = path.join(gcc_toolchain, android_toolchain_name, "bin")
env['AR'] = path.join(gcc_toolchain_bin, "ar")
@@ -425,21 +435,40 @@ class MachCommands(CommandBase):
"--sysroot=" + env['ANDROID_SYSROOT'],
"--gcc-toolchain=" + gcc_toolchain,
"-isystem", sysroot_include,
- "-L" + gcc_libs])
+ "-I" + arch_include,
+ "-B" + arch_libs,
+ "-L" + arch_libs,
+ "-D__ANDROID_API__=" + android_api,
+ ])
env['CXXFLAGS'] = ' '.join([
"--target=" + target,
"--sysroot=" + env['ANDROID_SYSROOT'],
"--gcc-toolchain=" + gcc_toolchain,
- "-I" + support_include,
+ "-I" + cpufeatures_include,
"-I" + cxx_include,
"-I" + clang_include,
"-isystem", sysroot_include,
+ "-I" + cxxabi_include,
+ "-I" + clang_include,
+ "-I" + arch_include,
+ "-I" + support_include,
"-L" + gcc_libs,
+ "-B" + arch_libs,
+ "-L" + arch_libs,
+ "-D__ANDROID_API__=" + android_api,
"-D__STDC_CONSTANT_MACROS",
- "-D__NDK_FPABI__="])
- env["NDK_ANDROID_VERSION"] = android_platform.replace("android-", "")
- env['CPPFLAGS'] = ' '.join(["--sysroot", env['ANDROID_SYSROOT']])
- env["CMAKE_ANDROID_ARCH_ABI"] = android_lib
+ "-D__NDK_FPABI__=",
+ ])
+ env['CPPFLAGS'] = ' '.join([
+ "--target=" + target,
+ "--sysroot=" + env['ANDROID_SYSROOT'],
+ "-I" + arch_include,
+ ])
+ env["NDK_ANDROID_VERSION"] = android_api
+ env["ANDROID_ABI"] = android_lib
+ env["ANDROID_PLATFORM"] = android_platform
+ env["ANDROID_TOOLCHAIN_NAME"] = "clang"
+ env["NDK_CMAKE_TOOLCHAIN_FILE"] = path.join(env['ANDROID_NDK'], "build", "cmake", "android.toolchain.cmake")
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()
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index ac9789ca389..0babff052f3 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -774,7 +774,7 @@ install them, let us know by filing a bug!")
def handle_android_target(self, target):
if target == "armv7-linux-androideabi":
- self.config["android"]["platform"] = "android-18"
+ self.config["android"]["platform"] = "android-21"
self.config["android"]["target"] = target
self.config["android"]["toolchain_prefix"] = "arm-linux-androideabi"
self.config["android"]["arch"] = "arm"
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py
index 94a30dfe421..6dd788f5fa4 100644
--- a/python/servo/package_commands.py
+++ b/python/servo/package_commands.py
@@ -19,6 +19,7 @@ import shutil
import subprocess
import sys
import tempfile
+import urllib
from mach.decorators import (
CommandArgument,
@@ -538,9 +539,25 @@ class PackageCommands(CommandBase):
@CommandArgument('platform',
choices=PACKAGES.keys(),
help='Package platform type to upload')
- def upload_nightly(self, platform):
+ @CommandArgument('--secret-from-taskcluster',
+ action='store_true',
+ help='Retrieve the appropriate secrets from taskcluster.')
+ def upload_nightly(self, platform, secret_from_taskcluster):
import boto3
+ def get_taskcluster_secret(name):
+ url = "http://taskcluster/secrets/v1/secret/project/servo/" + name
+ return json.load(urllib.urlopen(url))["secret"]
+
+ def get_s3_secret():
+ aws_access_key = None
+ aws_secret_access_key = None
+ if secret_from_taskcluster:
+ secret = get_taskcluster_secret("s3-upload-credentials")
+ aws_access_key = secret["aws_access_key_id"]
+ aws_secret_access_key = secret["aws_secret_access_key"]
+ return (aws_access_key, aws_secret_access_key)
+
def nightly_filename(package, timestamp):
return '{}-{}'.format(
timestamp.isoformat() + 'Z', # The `Z` denotes UTC
@@ -548,7 +565,12 @@ class PackageCommands(CommandBase):
)
def upload_to_s3(platform, package, timestamp):
- s3 = boto3.client('s3')
+ (aws_access_key, aws_secret_access_key) = get_s3_secret()
+ s3 = boto3.client(
+ 's3',
+ aws_access_key_id=aws_access_key,
+ aws_secret_access_key=aws_secret_access_key
+ )
BUCKET = 'servo-builds'
nightly_dir = 'nightly/{}'.format(platform)
@@ -565,7 +587,12 @@ class PackageCommands(CommandBase):
s3.copy(copy_source, BUCKET, latest_upload_key)
def update_maven(directory):
- s3 = boto3.client('s3')
+ (aws_access_key, aws_secret_access_key) = get_s3_secret()
+ s3 = boto3.client(
+ 's3',
+ aws_access_key_id=aws_access_key,
+ aws_secret_access_key=aws_secret_access_key
+ )
BUCKET = 'servo-builds'
nightly_dir = 'nightly/maven'
@@ -626,13 +653,18 @@ class PackageCommands(CommandBase):
'--message=Version Bump: {}'.format(brew_version),
])
+ if secret_from_taskcluster:
+ token = get_taskcluster_secret('github-homebrew-token')["token"]
+ else:
+ token = os.environ['GITHUB_HOMEBREW_TOKEN']
+
push_url = 'https://{}@github.com/servo/homebrew-servo.git'
# TODO(aneeshusa): Use subprocess.DEVNULL with Python 3.3+
with open(os.devnull, 'wb') as DEVNULL:
call_git([
'push',
'-qf',
- push_url.format(os.environ['GITHUB_HOMEBREW_TOKEN']),
+ push_url.format(token),
'master',
], stdout=DEVNULL, stderr=DEVNULL)