build: make external binaries download action more flexible (#14982)
* build: make external binaries download action more flexible * chore: reformat DEPS Make it look more like Chromium //DEPS: - use name-pattern-condition-action order for hooks - add trailing commas - remove some line breaks Also remove redundant entry from "recursedeps".
This commit is contained in:
parent
6e5dd735f6
commit
5525f34363
2 changed files with 52 additions and 53 deletions
66
DEPS
66
DEPS
|
@ -1,40 +1,30 @@
|
||||||
vars = {
|
vars = {
|
||||||
'chromium_version':
|
'chromium_version': '68.0.3440.128',
|
||||||
'68.0.3440.128',
|
'node_version': '18a9880b70039f5d41ee860a95fe84e5ef928973',
|
||||||
'node_version':
|
|
||||||
'18a9880b70039f5d41ee860a95fe84e5ef928973',
|
|
||||||
|
|
||||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||||
|
'pyyaml_version': '3.12',
|
||||||
'requests_version': 'e4d59bedfd3c7f4f254f4f5d036587bcd8152458',
|
'requests_version': 'e4d59bedfd3c7f4f254f4f5d036587bcd8152458',
|
||||||
|
|
||||||
'pyyaml_version':
|
|
||||||
'3.12',
|
|
||||||
|
|
||||||
'boto_git': 'https://github.com/boto',
|
'boto_git': 'https://github.com/boto',
|
||||||
|
'chromium_git': 'https://chromium.googlesource.com',
|
||||||
'chromium_git':
|
'electron_git': 'https://github.com/electron',
|
||||||
'https://chromium.googlesource.com',
|
|
||||||
|
|
||||||
'electron_git':
|
|
||||||
'https://github.com/electron',
|
|
||||||
|
|
||||||
'yaml_git':
|
|
||||||
'https://github.com/yaml',
|
|
||||||
|
|
||||||
'requests_git': 'https://github.com/kennethreitz',
|
'requests_git': 'https://github.com/kennethreitz',
|
||||||
|
'yaml_git': 'https://github.com/yaml',
|
||||||
|
|
||||||
# Python interface to Amazon Web Services. Is used for releases only.
|
# Python interface to Amazon Web Services. Is used for releases only.
|
||||||
'checkout_boto': False,
|
'checkout_boto': False,
|
||||||
|
|
||||||
'checkout_nacl':
|
'checkout_nacl': False,
|
||||||
False,
|
'checkout_libaom': True,
|
||||||
'checkout_libaom':
|
'checkout_oculus_sdk': False,
|
||||||
True,
|
|
||||||
'checkout_oculus_sdk':
|
|
||||||
False,
|
|
||||||
|
|
||||||
# Python "requests" module is used for releases only.
|
# Python "requests" module is used for releases only.
|
||||||
'checkout_requests': False,
|
'checkout_requests': False,
|
||||||
|
|
||||||
|
# It is always needed for normal Electron builds,
|
||||||
|
# but might be impossible for custom in-house builds.
|
||||||
|
'download_external_binaries': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
deps = {
|
deps = {
|
||||||
|
@ -56,66 +46,64 @@ deps = {
|
||||||
|
|
||||||
hooks = [
|
hooks = [
|
||||||
{
|
{
|
||||||
|
'name': 'patch_chromium',
|
||||||
|
'pattern': 'src/electron',
|
||||||
'action': [
|
'action': [
|
||||||
'python',
|
'python',
|
||||||
'src/electron/script/apply-patches',
|
'src/electron/script/apply-patches',
|
||||||
'--project-root=.',
|
'--project-root=.',
|
||||||
'--commit'
|
'--commit',
|
||||||
],
|
],
|
||||||
'pattern':
|
|
||||||
'src/electron',
|
|
||||||
'name':
|
|
||||||
'patch_chromium'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
'name': 'electron_external_binaries',
|
||||||
|
'pattern': 'src/electron/script/update-external-binaries.py',
|
||||||
|
'condition': 'download_external_binaries',
|
||||||
'action': [
|
'action': [
|
||||||
'python',
|
'python',
|
||||||
'src/electron/script/update-external-binaries.py'
|
|
||||||
],
|
|
||||||
'pattern':
|
|
||||||
'src/electron/script/update-external-binaries.py',
|
'src/electron/script/update-external-binaries.py',
|
||||||
'name':
|
'--root-url=http://github.com/electron/electron-frameworks/releases/download',
|
||||||
'electron_external_binaries'
|
'--version=v1.4.0',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
'name': 'electron_npm_deps',
|
||||||
|
'pattern': 'src/electron/package.json',
|
||||||
'action': [
|
'action': [
|
||||||
'python',
|
'python',
|
||||||
'-c',
|
'-c',
|
||||||
'import os; os.chdir("src"); os.chdir("electron"); os.system("npm install")',
|
'import os; os.chdir("src"); os.chdir("electron"); os.system("npm install")',
|
||||||
],
|
],
|
||||||
'pattern': 'src/electron/package.json',
|
|
||||||
'name': 'electron_npm_deps'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'setup_boto',
|
'name': 'setup_boto',
|
||||||
|
'pattern': 'src/electron',
|
||||||
'condition': 'checkout_boto',
|
'condition': 'checkout_boto',
|
||||||
'action': [
|
'action': [
|
||||||
'python',
|
'python',
|
||||||
'-c',
|
'-c',
|
||||||
'import os; os.chdir("src"); os.chdir("electron"); os.chdir("vendor"); os.chdir("boto"); os.system("python setup.py build");',
|
'import os; os.chdir("src"); os.chdir("electron"); os.chdir("vendor"); os.chdir("boto"); os.system("python setup.py build");',
|
||||||
],
|
],
|
||||||
'pattern': 'src/electron',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'setup_requests',
|
'name': 'setup_requests',
|
||||||
|
'pattern': 'src/electron',
|
||||||
'condition': 'checkout_requests',
|
'condition': 'checkout_requests',
|
||||||
'action': [
|
'action': [
|
||||||
'python',
|
'python',
|
||||||
'-c',
|
'-c',
|
||||||
'import os; os.chdir("src"); os.chdir("electron"); os.chdir("vendor"); os.chdir("requests"); os.system("python setup.py build");',
|
'import os; os.chdir("src"); os.chdir("electron"); os.chdir("vendor"); os.chdir("requests"); os.system("python setup.py build");',
|
||||||
],
|
],
|
||||||
'pattern': 'src/electron',
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
recursedeps = [
|
recursedeps = [
|
||||||
'src',
|
'src',
|
||||||
'src/libchromiumcontent',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
gclient_gn_args = [
|
gclient_gn_args = [
|
||||||
'checkout_libaom',
|
'checkout_libaom',
|
||||||
'checkout_nacl',
|
'checkout_nacl',
|
||||||
'checkout_oculus_sdk'
|
'checkout_oculus_sdk',
|
||||||
]
|
]
|
||||||
gclient_gn_args_file = 'src/build/config/gclient_args.gni'
|
gclient_gn_args_file = 'src/build/config/gclient_args.gni'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import argparse
|
||||||
import errno
|
import errno
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -8,38 +9,48 @@ from lib.config import PLATFORM, get_target_arch
|
||||||
from lib.util import add_exec_bit, download, extract_zip, rm_rf, \
|
from lib.util import add_exec_bit, download, extract_zip, rm_rf, \
|
||||||
safe_mkdir, tempdir
|
safe_mkdir, tempdir
|
||||||
|
|
||||||
VERSION = 'v1.4.0'
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
FRAMEWORKS_URL = 'http://github.com/electron/electron-frameworks/releases' \
|
|
||||||
'/download/' + VERSION
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='Download binaries for Electron build')
|
||||||
|
|
||||||
|
parser.add_argument('-u', '--root-url', required=True,
|
||||||
|
help="Root URL for all downloads.")
|
||||||
|
parser.add_argument('-v', '--version', required=True,
|
||||||
|
help="Version string, e.g. 'v1.0.0'.")
|
||||||
|
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
args = parse_args()
|
||||||
|
url_prefix = "{root_url}/{version}".format(**vars(args))
|
||||||
|
|
||||||
os.chdir(SOURCE_ROOT)
|
os.chdir(SOURCE_ROOT)
|
||||||
version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')
|
version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')
|
||||||
|
|
||||||
if (is_updated(version_file, VERSION)):
|
if (is_updated(version_file, args.version)):
|
||||||
return
|
return
|
||||||
|
|
||||||
rm_rf('external_binaries')
|
rm_rf('external_binaries')
|
||||||
safe_mkdir('external_binaries')
|
safe_mkdir('external_binaries')
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
download_and_unzip('Mantle')
|
download_and_unzip(url_prefix, 'Mantle')
|
||||||
download_and_unzip('ReactiveCocoa')
|
download_and_unzip(url_prefix, 'ReactiveCocoa')
|
||||||
download_and_unzip('Squirrel')
|
download_and_unzip(url_prefix, 'Squirrel')
|
||||||
elif sys.platform in ['cygwin', 'win32']:
|
elif sys.platform in ['cygwin', 'win32']:
|
||||||
download_and_unzip('directxsdk-' + get_target_arch())
|
download_and_unzip(url_prefix, 'directxsdk-' + get_target_arch())
|
||||||
|
|
||||||
# get sccache & set exec bit. https://bugs.python.org/issue15795
|
# get sccache & set exec bit. https://bugs.python.org/issue15795
|
||||||
download_and_unzip('sccache-{0}-x64'.format(PLATFORM))
|
download_and_unzip(url_prefix, 'sccache-{0}-x64'.format(PLATFORM))
|
||||||
appname = 'sccache'
|
appname = 'sccache'
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
appname += '.exe'
|
appname += '.exe'
|
||||||
add_exec_bit(os.path.join('external_binaries', appname))
|
add_exec_bit(os.path.join('external_binaries', appname))
|
||||||
|
|
||||||
with open(version_file, 'w') as f:
|
with open(version_file, 'w') as f:
|
||||||
f.write(VERSION)
|
f.write(args.version)
|
||||||
|
|
||||||
|
|
||||||
def is_updated(version_file, version):
|
def is_updated(version_file, version):
|
||||||
|
@ -53,15 +64,15 @@ def is_updated(version_file, version):
|
||||||
return existing_version == version
|
return existing_version == version
|
||||||
|
|
||||||
|
|
||||||
def download_and_unzip(framework):
|
def download_and_unzip(url_prefix, framework):
|
||||||
zip_path = download_framework(framework)
|
zip_path = download_framework(url_prefix, framework)
|
||||||
if zip_path:
|
if zip_path:
|
||||||
extract_zip(zip_path, 'external_binaries')
|
extract_zip(zip_path, 'external_binaries')
|
||||||
|
|
||||||
|
|
||||||
def download_framework(framework):
|
def download_framework(url_prefix, framework):
|
||||||
filename = framework + '.zip'
|
filename = framework + '.zip'
|
||||||
url = FRAMEWORKS_URL + '/' + filename
|
url = url_prefix + '/' + filename
|
||||||
download_dir = tempdir(prefix='electron-')
|
download_dir = tempdir(prefix='electron-')
|
||||||
path = os.path.join(download_dir, filename)
|
path = os.path.join(download_dir, filename)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue