build: remove sccache (#26701)
This commit is contained in:
parent
8311ea1a36
commit
7cc571801c
7 changed files with 0 additions and 187 deletions
|
@ -445,9 +445,6 @@ step-fix-sync-on-mac: &step-fix-sync-on-mac
|
||||||
# Fix Clang Install (wrong binary)
|
# Fix Clang Install (wrong binary)
|
||||||
rm -rf src/third_party/llvm-build
|
rm -rf src/third_party/llvm-build
|
||||||
python src/tools/clang/scripts/update.py
|
python src/tools/clang/scripts/update.py
|
||||||
# Fix Framework Header Installs (symlinks not retained)
|
|
||||||
rm -rf src/electron/external_binaries
|
|
||||||
python src/electron/script/update-external-binaries.py
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
|
step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
|
||||||
|
|
13
DEPS
13
DEPS
|
@ -58,10 +58,6 @@ vars = {
|
||||||
# To allow running hooks without parsing the DEPS tree
|
# To allow running hooks without parsing the DEPS tree
|
||||||
'process_deps': True,
|
'process_deps': True,
|
||||||
|
|
||||||
# It is always needed for normal Electron builds,
|
|
||||||
# but might be impossible for custom in-house builds.
|
|
||||||
'download_external_binaries': True,
|
|
||||||
|
|
||||||
'checkout_nacl':
|
'checkout_nacl':
|
||||||
False,
|
False,
|
||||||
'checkout_libaom':
|
'checkout_libaom':
|
||||||
|
@ -157,15 +153,6 @@ hooks = [
|
||||||
'src/electron/patches/mtime-cache.json',
|
'src/electron/patches/mtime-cache.json',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'name': 'electron_external_binaries',
|
|
||||||
'pattern': 'src/electron/script/update-external-binaries.py',
|
|
||||||
'condition': 'download_external_binaries',
|
|
||||||
'action': [
|
|
||||||
'python3',
|
|
||||||
'src/electron/script/update-external-binaries.py',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'electron_npm_deps',
|
'name': 'electron_npm_deps',
|
||||||
'pattern': 'src/electron/package.json',
|
'pattern': 'src/electron/package.json',
|
||||||
|
|
|
@ -98,8 +98,6 @@ build_script:
|
||||||
$env:SAVE_GCLIENT_SRC="true"
|
$env:SAVE_GCLIENT_SRC="true"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# update external binaries
|
|
||||||
python src/electron/script/update-external-binaries.py
|
|
||||||
# update angle
|
# update angle
|
||||||
cd src\third_party\angle
|
cd src\third_party\angle
|
||||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
||||||
|
|
|
@ -86,8 +86,6 @@ $ gclient sync -f
|
||||||
```sh
|
```sh
|
||||||
$ cd src
|
$ cd src
|
||||||
$ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
|
$ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
|
||||||
# this next line is needed only if building with sccache
|
|
||||||
$ export GN_EXTRA_ARGS="${GN_EXTRA_ARGS} cc_wrapper=\"${PWD}/electron/external_binaries/sccache\""
|
|
||||||
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") $GN_EXTRA_ARGS"
|
$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") $GN_EXTRA_ARGS"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -141,12 +139,6 @@ This will build all of what was previously 'libchromiumcontent' (i.e. the
|
||||||
`content/` directory of `chromium` and its dependencies, incl. WebKit and V8),
|
`content/` directory of `chromium` and its dependencies, incl. WebKit and V8),
|
||||||
so it will take a while.
|
so it will take a while.
|
||||||
|
|
||||||
To speed up subsequent builds, you can use [sccache][sccache]. Add the GN arg
|
|
||||||
`cc_wrapper = "sccache"` by running `gn args out/Testing` to bring up an
|
|
||||||
editor and adding a line to the end of the file.
|
|
||||||
|
|
||||||
[sccache]: https://github.com/mozilla/sccache
|
|
||||||
|
|
||||||
The built executable will be under `./out/Testing`:
|
The built executable will be under `./out/Testing`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"baseUrl": "https://electron-build-tools.s3-us-west-2.amazonaws.com/build-dependencies",
|
|
||||||
"files": [
|
|
||||||
{
|
|
||||||
"name": "sccache-darwin-x64.zip",
|
|
||||||
"platform": "darwin",
|
|
||||||
"sha": "3bfe114b49a15e4f15e2e3a9ee6699f1acdb89446badbaa4144869c72a7690ca"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sccache-linux-x64.zip",
|
|
||||||
"platform": "linux",
|
|
||||||
"sha": "ceb3e10e8a860467efc327c7bbb473481268cc8575bdd39d51acf6eba635e343"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sccache-win32-x64.zip",
|
|
||||||
"platform": "win32",
|
|
||||||
"sha": "b6a20fd1c2026f3792e7286bc768a7ebc261847b76449b49f55455e1f841fecd"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -9,7 +9,6 @@ const HASH_VERSION = 3;
|
||||||
const filesToHash = [
|
const filesToHash = [
|
||||||
path.resolve(__dirname, '../DEPS'),
|
path.resolve(__dirname, '../DEPS'),
|
||||||
path.resolve(__dirname, '../yarn.lock'),
|
path.resolve(__dirname, '../yarn.lock'),
|
||||||
path.resolve(__dirname, '../script/external-binaries.json'),
|
|
||||||
path.resolve(__dirname, '../script/sysroots.json')
|
path.resolve(__dirname, '../script/sysroots.json')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,140 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import errno
|
|
||||||
import hashlib
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import tarfile
|
|
||||||
|
|
||||||
from lib.config import PLATFORM, get_target_arch
|
|
||||||
from lib.util import add_exec_bit, download, extract_zip, rm_rf, \
|
|
||||||
safe_mkdir, tempdir
|
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
||||||
CONFIG_PATH = os.path.join(SOURCE_ROOT, 'script', 'external-binaries.json')
|
|
||||||
|
|
||||||
def parse_args():
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
description='Download binaries for Electron build')
|
|
||||||
|
|
||||||
parser.add_argument('--base-url', required=False,
|
|
||||||
help="Base URL for all downloads")
|
|
||||||
parser.add_argument('--force',
|
|
||||||
action='store_true',
|
|
||||||
default=False,
|
|
||||||
required=False)
|
|
||||||
|
|
||||||
return parser.parse_args()
|
|
||||||
|
|
||||||
|
|
||||||
def parse_config():
|
|
||||||
with open(CONFIG_PATH, 'r') as config_file:
|
|
||||||
config = json.load(config_file)
|
|
||||||
return config
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
args = parse_args()
|
|
||||||
config = parse_config()
|
|
||||||
|
|
||||||
base_url = args.base_url if args.base_url is not None else config['baseUrl']
|
|
||||||
|
|
||||||
output_dir = os.path.join(SOURCE_ROOT, 'external_binaries')
|
|
||||||
config_hash_path = os.path.join(output_dir, '.hash')
|
|
||||||
|
|
||||||
if (not is_updated(config_hash_path) and not args.force):
|
|
||||||
return
|
|
||||||
|
|
||||||
rm_rf(output_dir)
|
|
||||||
safe_mkdir(output_dir)
|
|
||||||
|
|
||||||
for binary in config['files']:
|
|
||||||
if not binary_should_be_downloaded(binary):
|
|
||||||
continue
|
|
||||||
|
|
||||||
temp_path = download_binary(base_url, binary['sha'], binary['name'])
|
|
||||||
|
|
||||||
if temp_path.endswith('.zip'):
|
|
||||||
extract_zip(temp_path, output_dir)
|
|
||||||
else:
|
|
||||||
tar = tarfile.open(temp_path, "r:gz")
|
|
||||||
tar.extractall(output_dir)
|
|
||||||
tar.close()
|
|
||||||
|
|
||||||
# Hack alert. Set exec bit for sccache binaries.
|
|
||||||
# https://bugs.python.org/issue15795
|
|
||||||
if 'sccache' in binary['name']:
|
|
||||||
add_exec_bit_to_sccache_binary(output_dir)
|
|
||||||
|
|
||||||
with open(config_hash_path, 'w') as f:
|
|
||||||
f.write(sha256(CONFIG_PATH))
|
|
||||||
|
|
||||||
|
|
||||||
def is_updated(config_hash_path):
|
|
||||||
existing_hash = ''
|
|
||||||
try:
|
|
||||||
with open(config_hash_path, 'r') as f:
|
|
||||||
existing_hash = f.readline().strip()
|
|
||||||
except IOError as e:
|
|
||||||
if e.errno != errno.ENOENT:
|
|
||||||
raise
|
|
||||||
return not sha256(CONFIG_PATH) == existing_hash
|
|
||||||
|
|
||||||
|
|
||||||
def binary_should_be_downloaded(binary):
|
|
||||||
if 'platform' in binary and binary['platform'] != PLATFORM:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if 'targetArch' in binary and binary['targetArch'] != get_target_arch():
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def sha256(file_path):
|
|
||||||
hash_256 = hashlib.sha256()
|
|
||||||
with open(file_path, "rb") as f:
|
|
||||||
for chunk in iter(lambda: f.read(4096), b""):
|
|
||||||
hash_256.update(chunk)
|
|
||||||
return hash_256.hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
def download_binary(base_url, sha, binary_name, attempt=3):
|
|
||||||
full_url = '{0}/{1}/{2}'.format(base_url, sha, binary_name)
|
|
||||||
try:
|
|
||||||
temp_path = download_to_temp_dir(full_url, filename=binary_name, sha=sha)
|
|
||||||
return temp_path
|
|
||||||
except Exception as e:
|
|
||||||
if attempt == 1:
|
|
||||||
raise e
|
|
||||||
return download_binary(base_url, sha, binary_name, attempt - 1)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_sha(file_path, sha):
|
|
||||||
downloaded_sha = sha256(file_path)
|
|
||||||
if downloaded_sha != sha:
|
|
||||||
raise Exception("SHA for external binary file {} does not match "
|
|
||||||
"expected '{}' != '{}'".format(
|
|
||||||
file_path, downloaded_sha, sha))
|
|
||||||
|
|
||||||
|
|
||||||
def download_to_temp_dir(url, filename, sha):
|
|
||||||
download_dir = tempdir(prefix='electron-')
|
|
||||||
file_path = os.path.join(download_dir, filename)
|
|
||||||
download(text='Download ' + filename, url=url, path=file_path)
|
|
||||||
validate_sha(file_path, sha)
|
|
||||||
return file_path
|
|
||||||
|
|
||||||
|
|
||||||
def add_exec_bit_to_sccache_binary(binary_dir):
|
|
||||||
binary_name = 'sccache'
|
|
||||||
if PLATFORM == 'win32':
|
|
||||||
binary_name += '.exe'
|
|
||||||
|
|
||||||
binary_path = os.path.join(binary_dir, binary_name)
|
|
||||||
add_exec_bit(binary_path)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
Loading…
Add table
Reference in a new issue