build: build ffmpeg and native_mksnapshot for GN release builds (#14240)

* build ffmpeg and native_mksnapshot for GN release builds

* Test ffmpeg via verify-ffmpeg.py

* remove sccache from Windows builds
This commit is contained in:
John Kleinschmidt 2018-08-22 11:41:25 -04:00 коммит произвёл GitHub
Родитель a2a7c6b062
Коммит 5a72441b2a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 87 добавлений и 22 удалений

Просмотреть файл

@ -122,7 +122,7 @@ build-steps: &build-steps
script/verify-ffmpeg.py
else
echo 'Verifying ffmpeg on release build'
script/verify-ffmpeg.py -R
script/verify-ffmpeg.py -c R
fi
else
echo 'Skipping tests due to configuration'
@ -191,6 +191,34 @@ gn-build-steps: &gn-build-steps
command: |
cd src
ninja -C out/Default electron:electron_app
- run:
name: ffmpeg GN gen
command: |
if [ "$BUILD_FFMPEG" == "true" ]; then
cd src
gn gen out/ffmpeg --args='import("//electron/build/args/ffmpeg.gn") cc_wrapper="'"$SCCACHE_PATH"'"'" $GN_EXTRA_ARGS"
fi
- run:
name: Non proprietary ffmpeg build
command: |
if [ "$BUILD_FFMPEG" == "true" ]; then
cd src
ninja -C out/ffmpeg third_party/ffmpeg
fi
- run:
name: native mksnapshot GN gen
command: |
if [ "$BUILD_NATIVE_MKSNAPSHOT" == "true" ]; then
cd src
gn gen out/native_mksnapshot --args='import("//electron/build/args/native_mksnapshot.gn") cc_wrapper="'"$SCCACHE_PATH"'" v8_snapshot_toolchain="'"$MKSNAPSHOT_TOOLCHAIN"'"'" $GN_EXTRA_ARGS"
fi
- run:
name: native mksnapshot (arm/arm64) build
command: |
if [ "$BUILD_NATIVE_MKSNAPSHOT" == "true" ]; then
cd src
ninja -C out/native_mksnapshot v8:mksnapshot
fi
- run:
name: Build dist.zip
command: |
@ -203,6 +231,12 @@ gn-build-steps: &gn-build-steps
name: Setup for headless testing
command: |
sh -e /etc/init.d/xvfb start
- run:
name: Verify ffmpeg
command: |
if [ "$RUN_TESTS" != "false" ] && [ "$BUILD_FFMPEG" == "true" ]; then
python src/electron/script/verify-ffmpeg.py -c Default --source-root "$PWD/src" --ffmpeg-path "$PWD/src/out/ffmpeg"
fi
- run:
name: Test
environment:
@ -223,6 +257,12 @@ gn-build-steps: &gn-build-steps
path: src/junit
- store_artifacts:
path: src/out/Default/dist.zip
- store_artifacts:
path: src/out/ffmpeg/libffmpeg.dylib
- store_artifacts:
path: src/out/ffmpeg/libffmpeg.so
- store_artifacts:
path: src/out/native_mksnapshot/mksnapshot
gn-mac-build-steps: &gn-mac-build-steps
steps:
@ -482,6 +522,7 @@ jobs:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/testing.gn
BUILD_FFMPEG: true
<<: *gn-linux-build-machine
<<: *gn-build-steps
@ -489,6 +530,7 @@ jobs:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/release.gn
BUILD_FFMPEG: true
<<: *gn-linux-build-machine
<<: *gn-build-steps
@ -508,6 +550,7 @@ jobs:
GN_CONFIG: //electron/build/args/testing.gn
GN_EXTRA_ARGS: 'target_cpu = "x86"'
NPM_CONFIG_ARCH: ia32
BUILD_FFMPEG: true
<<: *gn-linux-build-machine
<<: *gn-build-steps
@ -517,6 +560,7 @@ jobs:
GN_CONFIG: //electron/build/args/release.gn
GN_EXTRA_ARGS: 'target_cpu = "x86"'
NPM_CONFIG_ARCH: ia32
BUILD_FFMPEG: true
<<: *gn-linux-build-machine
<<: *gn-build-steps
@ -544,6 +588,9 @@ jobs:
GN_EXTRA_ARGS: 'target_cpu = "arm"'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True'
RUN_TESTS: false
BUILD_FFMPEG: true
BUILD_NATIVE_MKSNAPSHOT: true
MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm
<<: *gn-linux-build-machine
<<: *gn-build-steps
@ -571,6 +618,9 @@ jobs:
GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True'
RUN_TESTS: false
BUILD_FFMPEG: true
BUILD_NATIVE_MKSNAPSHOT: true
MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm64
<<: *gn-linux-build-machine
<<: *gn-build-steps

Просмотреть файл

@ -21,7 +21,7 @@ build_script:
- md src
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache\sccache.exe"
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
- >-
gclient config
--name "src\electron"
@ -29,13 +29,11 @@ build_script:
"https://github.com/electron/electron"
- gclient sync --with_branch_heads --with_tags
- cd src
- >-
%SCCACHE_PATH% -s
- gn gen out/Default "--args=import(\"//electron/build/args/%gn_args%.gn\") cc_wrapper=\"%CC_WRAPPER%\" "
- gn gen out/Default "--args=import(\"//electron/build/args/%gn_args%.gn\")"
- ninja -C out/Default electron:electron_app
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\")"
- ninja -C out/ffmpeg third_party/ffmpeg
- ninja -C out/Default electron:electron_dist_zip
- >-
%SCCACHE_PATH% -s
test_script:
- ninja -C out/Default electron/build/node:headers
- ps: $env:npm_config_nodedir="$pwd/out/Default/gen/node_headers"
@ -44,7 +42,7 @@ test_script:
- npm install
- ps: Pop-Location
- ./out/Default/electron.exe electron/spec --ci
# TODO(nornagon): verify-ffmpeg step
- python src\electron\verify-ffmpeg.py -c Default --source-root "%pwd%\src" --ffmpeg-path "%pwd%\src\out\ffmpeg"
artifacts:
- path: test-results.xml
name: test-results.xml

3
build/args/ffmpeg.gn Normal file
Просмотреть файл

@ -0,0 +1,3 @@
import("release.gn")
proprietary_codecs = false
ffmpeg_branding = "Chromium"

Просмотреть файл

@ -0,0 +1,2 @@
import("release.gn")
v8_enable_i18n_support = false

Просмотреть файл

@ -1,6 +1,7 @@
import("all.gn")
is_debug = false
is_component_build = false
is_component_ffmpeg = true
is_official_build = false
dcheck_always_on = true
symbol_level = 1

Просмотреть файл

@ -1,5 +1,5 @@
#!/usr/bin/env python
import argparse
import os
import shutil
import subprocess
@ -17,14 +17,10 @@ PRODUCT_NAME = electron_gyp()['product_name%']
def main():
os.chdir(SOURCE_ROOT)
args = parse_args()
os.chdir(args.source_root)
if len(sys.argv) == 2 and sys.argv[1] == '-R':
config = 'R'
else:
config = 'D'
app_path = create_app_copy(config)
app_path = create_app_copy(args)
if sys.platform == 'darwin':
electron = os.path.join(app_path, 'Contents', 'MacOS', PRODUCT_NAME)
@ -42,11 +38,12 @@ def main():
ffmpeg_name = 'libffmpeg.so'
# Copy ffmpeg without proprietary codecs into app
shutil.copy(os.path.join(FFMPEG_LIBCC_PATH, ffmpeg_name), ffmpeg_app_path)
shutil.copy(os.path.join(args.ffmpeg_path, ffmpeg_name), ffmpeg_app_path)
returncode = 0
try:
test_path = os.path.join('spec', 'fixtures', 'no-proprietary-codecs.js')
test_path = os.path.join(SOURCE_ROOT, 'spec', 'fixtures',
'no-proprietary-codecs.js')
subprocess.check_call([electron, test_path] + sys.argv[1:])
except subprocess.CalledProcessError as e:
returncode = e.returncode
@ -57,9 +54,10 @@ def main():
# Create copy of app to install ffmpeg library without proprietary codecs into
def create_app_copy(config):
initial_app_path = os.path.join(SOURCE_ROOT, 'out', config)
app_path = os.path.join(SOURCE_ROOT, 'out', config + '-no-proprietary-codecs')
def create_app_copy(args):
initial_app_path = os.path.join(args.source_root, 'out', args.config)
app_path = os.path.join(args.source_root, 'out',
args.config + '-no-proprietary-codecs')
if sys.platform == 'darwin':
app_name = '{0}.app'.format(PRODUCT_NAME)
@ -70,6 +68,19 @@ def create_app_copy(config):
shutil.copytree(initial_app_path, app_path, symlinks=True)
return app_path
def parse_args():
parser = argparse.ArgumentParser(description='Test non-proprietary ffmpeg')
parser.add_argument('-c', '--config',
help='Test with Release or Debug configuration',
default='D',
required=False)
parser.add_argument('--source-root',
default=SOURCE_ROOT,
required=False)
parser.add_argument('--ffmpeg-path',
default=FFMPEG_LIBCC_PATH,
required=False)
return parser.parse_args()
if __name__ == '__main__':
sys.exit(main())

Просмотреть файл

@ -59,7 +59,7 @@ steps:
- bash: |
echo 'Verifying ffmpeg on build'
if [ "$ELECTRON_RELEASE" == "1" ]; then
script/verify-ffmpeg.py -R
script/verify-ffmpeg.py -c R
else
script/verify-ffmpeg.py
fi