Add job for building PathKit to WASM using Docker
This creates a new named cache docker for this and future docker-based jobs to use, to avoid permission snafus with the normal "work" named cache. Remove old WASM build, which was using the janky CIPD emsdk asset and wasn't really exercising what we needed. Bug: skia:8216 Change-Id: I993bba38b4978ca5eebb97e5b5b21729d55a072d Reviewed-on: https://skia-review.googlesource.com/145140 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Eric Boren <borenet@google.com>
This commit is contained in:
parent
9047c066be
commit
30cc00c642
@ -7,7 +7,7 @@
|
||||
|
||||
BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
|
||||
HTML_SHELL=$BASE_DIR/shell.html
|
||||
BUILD_DIR="out/pathkit"
|
||||
BUILD_DIR=${BUILD_DIR:="out/pathkit"}
|
||||
|
||||
# This expects the environment variable EMSDK to be set
|
||||
if [[ ! -d $EMSDK ]]; then
|
||||
@ -18,6 +18,8 @@ fi
|
||||
# Navigate to SKIA_HOME from where this file is located.
|
||||
pushd $BASE_DIR/../..
|
||||
|
||||
echo "Putting output in $BUILD_DIR (pwd = `pwd`)"
|
||||
|
||||
# Run this from $SKIA_HOME, not from the directory this file is in.
|
||||
if [[ ! -d ./src ]]; then
|
||||
echo "Cannot locate Skia source. Is the source checkout okay? Exiting."
|
||||
@ -27,9 +29,11 @@ fi
|
||||
if [[ $@ == *help* ]]; then
|
||||
echo "By default, this script builds a production WASM build of PathKit."
|
||||
echo ""
|
||||
echo "It is put in ${BUILD_DIR}, configured by the BUILD_DIR environment"
|
||||
echo "variable. Additionally, the EMSDK environment variable must be set."
|
||||
echo "This script takes several optional parameters:"
|
||||
echo " dev = Make a build suitable for running tests or debugging"
|
||||
echo " asm.js = Build for asm.js instead of WASM"
|
||||
echo " asm.js = Build for asm.js instead of WASM (very experimental)"
|
||||
echo " serve = starts a webserver allowing a user to navigate to"
|
||||
echo " localhost:8000/pathkit.html to view the demo page."
|
||||
exit 0
|
||||
@ -51,7 +55,6 @@ if [[ $@ == *asm.js* ]]; then
|
||||
fi
|
||||
|
||||
OUTPUT="-o $BUILD_DIR/pathkit.js"
|
||||
|
||||
source $EMSDK/emsdk_env.sh
|
||||
|
||||
echo "Compiling"
|
||||
|
15
experimental/pathkit/docker/build_pathkit.sh
Executable file
15
experimental/pathkit/docker/build_pathkit.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2018 Google LLC
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This assumes it is being run inside a docker container of emsdk-base
|
||||
# and a Skia checkout has been mounted at /SRC and the output directory
|
||||
# is mounted at /OUT
|
||||
|
||||
# For example:
|
||||
# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/dockerpathkit:/OUT gcr.io/skia-public/emsdk-release:1.38.6 /SRC/experimental/pathkit/docker/build_pathkit.sh
|
||||
|
||||
BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
|
||||
BUILD_DIR=/OUT $BASE_DIR/../compile.sh
|
24
experimental/pathkit/docker/emsdk-base/Dockerfile
Normal file
24
experimental/pathkit/docker/emsdk-base/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
# A Docker image that has the Emscripten SDK installed to /opt/emsdk
|
||||
# Use this image to compile C/C++ code to WASM.
|
||||
|
||||
FROM launcher.gcr.io/google/clang-debian9 AS build
|
||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||
git \
|
||||
python \
|
||||
nodejs
|
||||
|
||||
RUN cd /opt \
|
||||
&& git clone https://github.com/juj/emsdk.git
|
||||
|
||||
WORKDIR /opt/emsdk
|
||||
|
||||
# These versions were available and worked on my local desktop as of Aug 2 2018.
|
||||
RUN ./emsdk install emscripten-1.38.6 node-8.9.1-64bit clang-e1.38.6-64bit
|
||||
|
||||
RUN ./emsdk activate emscripten-1.38.6 node-8.9.1-64bit clang-e1.38.6-64bit
|
||||
|
||||
RUN /bin/bash -c "source ./emsdk_env.sh"
|
||||
|
||||
ENV EMSDK=/opt/emsdk
|
||||
|
||||
RUN mkdir -p /OUT /SRC
|
@ -51,4 +51,4 @@ Then, add the following configuration change to the node section of the config:
|
||||
|
||||
config.node = {
|
||||
fs: 'empty'
|
||||
};
|
||||
};
|
||||
|
@ -1,7 +0,0 @@
|
||||
Checkout and build the emscripten_sdk following the instructions here:
|
||||
http://webassembly.org/getting-started/developers-guide/
|
||||
|
||||
Then, run
|
||||
infra/bots/assets/emscripten_sdk/create_and_upload.py -s /path/to/dir/emsdk
|
||||
|
||||
It will take a while because the emsdk dir is > 26GB.
|
@ -1 +0,0 @@
|
||||
2
|
@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2017 Google Inc.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
||||
"""Common vars used by scripts in this directory."""
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
|
||||
|
||||
sys.path.insert(0, INFRA_BOTS_DIR)
|
||||
from assets import assets
|
||||
|
||||
ASSET_NAME = os.path.basename(FILE_DIR)
|
||||
|
||||
|
||||
def run(cmd):
|
||||
"""Run a command, eg. "upload" or "download". """
|
||||
assets.main([cmd, ASSET_NAME] + sys.argv[1:])
|
@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2017 Google Inc.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
||||
"""Create the asset and upload it."""
|
||||
|
||||
|
||||
import argparse
|
||||
import common
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import utils
|
||||
|
||||
|
||||
def main():
|
||||
if 'linux' not in sys.platform:
|
||||
print >> sys.stderr, 'This script only runs on Linux.'
|
||||
sys.exit(1)
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--gsutil')
|
||||
parser.add_argument('--sdk_path', '-s', required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
upload_script = os.path.join(common.FILE_DIR, 'upload.py')
|
||||
|
||||
try:
|
||||
# Remove large directories that we don't need to use the sdk
|
||||
# (e.g. intermediate build products)
|
||||
rmpath = os.path.join(args.sdk_path, 'clang', 'fastcomp',
|
||||
'build_incoming_64')
|
||||
# We can ignore errors, for example, if the folders were already deleted.
|
||||
shutil.rmtree(os.path.join(rmpath, 'lib'), ignore_errors=True)
|
||||
shutil.rmtree(os.path.join(rmpath, 'tools') , ignore_errors=True)
|
||||
|
||||
# Remove the source code, which has lots of small files which slows
|
||||
# extraction. We don't need the source code - we mostly care about the
|
||||
# binaries in $SDK/clang/fastcomp/build_incoming_64/bin.
|
||||
src = os.path.join(args.sdk_path, 'clang', 'fastcomp', 'src')
|
||||
for name in os.listdir(src):
|
||||
p = os.path.join(src, name)
|
||||
# Purposely don't delete src/emscripten-version.txt, which can cause
|
||||
# compilation warnings about "can't verify version".
|
||||
if os.path.isdir(p):
|
||||
shutil.rmtree(p)
|
||||
|
||||
cmd = ['python', upload_script, '-t', args.sdk_path]
|
||||
if args.gsutil:
|
||||
cmd.extend(['--gsutil', args.gsutil])
|
||||
subprocess.check_call(cmd)
|
||||
except subprocess.CalledProcessError:
|
||||
# Trap exceptions to avoid printing two stacktraces.
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2017 Google Inc.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
||||
"""Download the current version of the asset."""
|
||||
|
||||
|
||||
import common
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.run('download')
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2017 Google Inc.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
||||
"""Upload a new version of the asset."""
|
||||
|
||||
|
||||
import common
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
common.run('upload')
|
@ -135,7 +135,12 @@ var (
|
||||
Path: "cache/work",
|
||||
},
|
||||
}
|
||||
|
||||
CACHES_DOCKER = []*specs.Cache{
|
||||
&specs.Cache{
|
||||
Name: "docker",
|
||||
Path: "cache/docker",
|
||||
},
|
||||
}
|
||||
// Versions of the following copied from
|
||||
// https://chrome-internal.googlesource.com/infradata/config/+/master/configs/cr-buildbucket/swarming_task_template_canary.json#42
|
||||
// to test the fix for chromium:836196.
|
||||
@ -744,6 +749,14 @@ func usesGit(t *specs.TaskSpec, name string) {
|
||||
t.CipdPackages = append(t.CipdPackages, CIPD_PKGS_GIT...)
|
||||
}
|
||||
|
||||
// usesDocker adds attributes to tasks which use docker.
|
||||
func usesDocker(t *specs.TaskSpec, name string) {
|
||||
// currently, just the WASM (using EMCC) builder uses Docker.
|
||||
if strings.Contains(name, "EMCC") {
|
||||
t.Caches = append(t.Caches, CACHES_DOCKER...)
|
||||
}
|
||||
}
|
||||
|
||||
// timeout sets the timeout(s) for this task.
|
||||
func timeout(task *specs.TaskSpec, timeout time.Duration) {
|
||||
task.ExecutionTimeout = timeout
|
||||
@ -755,6 +768,7 @@ func timeout(task *specs.TaskSpec, timeout time.Duration) {
|
||||
func compile(b *specs.TasksCfgBuilder, name string, parts map[string]string) string {
|
||||
task := kitchenTask(name, "compile", "swarm_recipe.isolate", SERVICE_ACCOUNT_COMPILE, swarmDimensions(parts), nil, OUTPUT_BUILD)
|
||||
usesGit(task, name)
|
||||
usesDocker(task, name)
|
||||
|
||||
// Android bots require a toolchain.
|
||||
if strings.Contains(name, "Android") {
|
||||
@ -793,9 +807,6 @@ func compile(b *specs.TasksCfgBuilder, name string, parts map[string]string) str
|
||||
if strings.Contains(name, "Vulkan") {
|
||||
task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("linux_vulkan_sdk"))
|
||||
}
|
||||
if strings.Contains(name, "EMCC") {
|
||||
task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("emscripten_sdk"))
|
||||
}
|
||||
if parts["target_arch"] == "mips64el" || parts["target_arch"] == "loongson3a" {
|
||||
if parts["compiler"] != "GCC" {
|
||||
glog.Fatalf("mips64el toolchain is GCC, but compiler is %q in %q", parts["compiler"], name)
|
||||
|
@ -55,7 +55,7 @@
|
||||
"Build-Debian9-Clang-x86_64-Release-TSAN",
|
||||
"Build-Debian9-Clang-x86_64-Release-TSAN_Vulkan",
|
||||
"Build-Debian9-Clang-x86_64-Release-Vulkan",
|
||||
"Build-Debian9-EMCC-wasm-Release",
|
||||
"Build-Debian9-EMCC-wasm-Release-PathKit",
|
||||
"Build-Debian9-GCC-loongson3a-Debug",
|
||||
"Build-Debian9-GCC-loongson3a-Release",
|
||||
"Build-Debian9-GCC-mips64el-Debug",
|
||||
|
@ -14,6 +14,7 @@ from . import chromecast
|
||||
from . import default
|
||||
from . import flutter
|
||||
from . import util
|
||||
from . import wasm
|
||||
|
||||
|
||||
class BuildApi(recipe_api.RecipeApi):
|
||||
@ -31,6 +32,9 @@ class BuildApi(recipe_api.RecipeApi):
|
||||
elif 'Flutter' in b:
|
||||
self.compile_fn = flutter.compile_fn
|
||||
self.copy_fn = flutter.copy_extra_build_products
|
||||
elif 'EMCC' in b:
|
||||
self.compile_fn = wasm.compile_fn
|
||||
self.copy_fn = wasm.copy_extra_build_products
|
||||
else:
|
||||
self.compile_fn = default.compile_fn
|
||||
self.copy_fn = default.copy_extra_build_products
|
||||
|
@ -49,7 +49,6 @@ def compile_fn(api, checkout_root, out_dir):
|
||||
target_arch = api.vars.builder_cfg.get('target_arch', '')
|
||||
|
||||
clang_linux = str(api.vars.slave_dir.join('clang_linux'))
|
||||
emscripten_sdk = str(api.vars.slave_dir.join('emscripten_sdk'))
|
||||
linux_vulkan_sdk = str(api.vars.slave_dir.join('linux_vulkan_sdk'))
|
||||
win_toolchain = str(api.vars.slave_dir.join(
|
||||
't', 'depot_tools', 'win_toolchain', 'vs_files',
|
||||
@ -109,12 +108,7 @@ def compile_fn(api, checkout_root, out_dir):
|
||||
})
|
||||
else:
|
||||
cc, cxx = 'gcc', 'g++'
|
||||
elif compiler == 'EMCC':
|
||||
cc = emscripten_sdk + '/emscripten/incoming/emcc'
|
||||
cxx = emscripten_sdk + '/emscripten/incoming/em++'
|
||||
extra_cflags.append('-Wno-unknown-warning-option')
|
||||
extra_cflags.append('-DDUMMY_emscripten_sdk_version=%s' %
|
||||
api.run.asset_version('emscripten_sdk', skia_dir))
|
||||
|
||||
if 'Coverage' in extra_tokens:
|
||||
# See https://clang.llvm.org/docs/SourceBasedCodeCoverage.html for
|
||||
# more info on using llvm to gather coverage information.
|
||||
@ -229,14 +223,6 @@ def compile_fn(api, checkout_root, out_dir):
|
||||
args['clang_win'] = '"%s"' % api.vars.slave_dir.join('clang_win')
|
||||
extra_cflags.append('-DDUMMY_clang_win_version=%s' %
|
||||
api.run.asset_version('clang_win', skia_dir))
|
||||
if target_arch == 'wasm':
|
||||
args.update({
|
||||
'skia_use_freetype': 'false',
|
||||
'skia_use_fontconfig': 'false',
|
||||
'skia_use_dng_sdk': 'false',
|
||||
'skia_use_icu': 'false',
|
||||
'skia_enable_gpu': 'false',
|
||||
})
|
||||
|
||||
sanitize = ''
|
||||
for t in extra_tokens:
|
||||
@ -276,9 +262,6 @@ def compile_fn(api, checkout_root, out_dir):
|
||||
'fetch-clang-format',
|
||||
script=skia_dir.join('bin', 'fetch-clang-format'),
|
||||
infra_step=True)
|
||||
if target_arch == 'wasm':
|
||||
fastcomp = emscripten_sdk + '/clang/fastcomp/build_incoming_64/bin'
|
||||
env['PATH'] = '%s:%%(PATH)s' % fastcomp
|
||||
|
||||
with api.env(env):
|
||||
api.run(api.step, 'gn gen',
|
||||
|
@ -6,62 +6,38 @@
|
||||
"RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
|
||||
"--json-output",
|
||||
"/path/to/tmp/json",
|
||||
"copy",
|
||||
"[START_DIR]/cache/work/skia/infra/bots/assets/emscripten_sdk/VERSION",
|
||||
"/path/to/tmp/"
|
||||
"ensure-directory",
|
||||
"--mode",
|
||||
"0777",
|
||||
"[START_DIR]/cache/docker/wasm"
|
||||
],
|
||||
"infra_step": true,
|
||||
"name": "Get emscripten_sdk VERSION"
|
||||
"name": "mkdirs out_dir"
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"python",
|
||||
"-u",
|
||||
"[START_DIR]/cache/work/skia/bin/fetch-gn"
|
||||
"docker",
|
||||
"run",
|
||||
"--rm",
|
||||
"-v",
|
||||
"[START_DIR]/cache/work:/SRC",
|
||||
"-v",
|
||||
"[START_DIR]/cache/docker/wasm:/OUT",
|
||||
"gcr.io/skia-public/emsdk-release:1.38.6",
|
||||
"/SRC/skia/experimental/pathkit/docker/build_pathkit.sh"
|
||||
],
|
||||
"cwd": "[START_DIR]/cache/work/skia",
|
||||
"env": {
|
||||
"CHROME_HEADLESS": "1",
|
||||
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"
|
||||
},
|
||||
"infra_step": true,
|
||||
"name": "fetch-gn"
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"[START_DIR]/cache/work/skia/bin/gn",
|
||||
"gen",
|
||||
"[START_DIR]/cache/work/skia/out/Build-Debian9-EMCC-wasm-Release/Release",
|
||||
"--args=cc=\"[START_DIR]/emscripten_sdk/emscripten/incoming/emcc\" cxx=\"[START_DIR]/emscripten_sdk/emscripten/incoming/em++\" extra_cflags=[\"-Wno-unknown-warning-option\", \"-DDUMMY_emscripten_sdk_version=42\"] is_debug=false skia_enable_gpu=false skia_use_dng_sdk=false skia_use_fontconfig=false skia_use_freetype=false skia_use_icu=false target_cpu=\"wasm\""
|
||||
],
|
||||
"cwd": "[START_DIR]/cache/work/skia",
|
||||
"env": {
|
||||
"CHROME_HEADLESS": "1",
|
||||
"PATH": "[START_DIR]/emscripten_sdk/clang/fastcomp/build_incoming_64/bin:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"
|
||||
},
|
||||
"name": "gn gen"
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"ninja",
|
||||
"-k",
|
||||
"0",
|
||||
"-C",
|
||||
"[START_DIR]/cache/work/skia/out/Build-Debian9-EMCC-wasm-Release/Release"
|
||||
],
|
||||
"cwd": "[START_DIR]/cache/work/skia",
|
||||
"env": {
|
||||
"CHROME_HEADLESS": "1",
|
||||
"PATH": "[START_DIR]/emscripten_sdk/clang/fastcomp/build_incoming_64/bin:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"
|
||||
},
|
||||
"name": "ninja"
|
||||
"name": "Build PathKit with Docker"
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"python",
|
||||
"-u",
|
||||
"import errno\nimport glob\nimport os\nimport shutil\nimport sys\n\nsrc = sys.argv[1]\ndst = sys.argv[2]\nbuild_products_whitelist = ['bookmaker', 'dm', 'dm.exe', 'dm.app', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'hello-opencl', 'hello-opencl.exe', 'nanobench', 'nanobench.exe', 'skpbench', 'skpbench.exe', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'skiaserve', 'lib/*.so', 'run_testlab', 'skqp-universal-debug.apk', 'whitelist_devices.json']\n\ntry:\n os.makedirs(dst)\nexcept OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\nfor pattern in build_products_whitelist:\n path = os.path.join(src, pattern)\n for f in glob.glob(path):\n dst_path = os.path.join(dst, os.path.relpath(f, src))\n if not os.path.isdir(os.path.dirname(dst_path)):\n os.makedirs(os.path.dirname(dst_path))\n print 'Copying build product %s to %s' % (f, dst_path)\n shutil.move(f, dst_path)\n",
|
||||
"[START_DIR]/cache/work/skia/out/Build-Debian9-EMCC-wasm-Release/Release",
|
||||
"[START_DIR]/cache/work/skia/out/Build-Debian9-EMCC-wasm-Release-PathKit/Release",
|
||||
"[START_DIR]/[SWARM_OUT_DIR]/out/Release"
|
||||
],
|
||||
"infra_step": true,
|
||||
@ -94,6 +70,47 @@
|
||||
"@@@STEP_LOG_END@python.inline@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"python",
|
||||
"-u",
|
||||
"import errno\nimport glob\nimport os\nimport shutil\nimport sys\n\nsrc = sys.argv[1]\ndst = sys.argv[2]\nbuild_products_whitelist = ['pathkit.*']\n\ntry:\n os.makedirs(dst)\nexcept OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\nfor pattern in build_products_whitelist:\n path = os.path.join(src, pattern)\n for f in glob.glob(path):\n dst_path = os.path.join(dst, os.path.relpath(f, src))\n if not os.path.isdir(os.path.dirname(dst_path)):\n os.makedirs(os.path.dirname(dst_path))\n print 'Copying build product %s to %s' % (f, dst_path)\n # Because Docker usually has some strange permissions (like root\n # ownership), we'd rather not keep those around. copyfile doesn't\n # keep the metadata around, so that helps us.\n shutil.copyfile(f, dst_path)\n",
|
||||
"[START_DIR]/cache/docker/wasm",
|
||||
"[START_DIR]/[SWARM_OUT_DIR]/out/Release"
|
||||
],
|
||||
"infra_step": true,
|
||||
"name": "copy wasm output",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_LOG_LINE@python.inline@import errno@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@import glob@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@import os@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@import shutil@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@src = sys.argv[1]@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@dst = sys.argv[2]@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@build_products_whitelist = ['pathkit.*']@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@try:@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ os.makedirs(dst)@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@except OSError as e:@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ if e.errno != errno.EEXIST:@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ raise@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@for pattern in build_products_whitelist:@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ path = os.path.join(src, pattern)@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ for f in glob.glob(path):@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ dst_path = os.path.join(dst, os.path.relpath(f, src))@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ if not os.path.isdir(os.path.dirname(dst_path)):@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ os.makedirs(os.path.dirname(dst_path))@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ print 'Copying build product %s to %s' % (f, dst_path)@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ # Because Docker usually has some strange permissions (like root@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ # ownership), we'd rather not keep those around. copyfile doesn't@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ # keep the metadata around, so that helps us.@@@",
|
||||
"@@@STEP_LOG_LINE@python.inline@ shutil.copyfile(f, dst_path)@@@",
|
||||
"@@@STEP_LOG_END@python.inline@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "$result",
|
||||
"recipe_result": null,
|
@ -42,7 +42,7 @@ TEST_BUILDERS = [
|
||||
'Build-Debian9-Clang-x86_64-Release-Static',
|
||||
'Build-Debian9-Clang-x86_64-Release-SwiftShader',
|
||||
'Build-Debian9-Clang-x86_64-Release-Vulkan',
|
||||
'Build-Debian9-EMCC-wasm-Release',
|
||||
'Build-Debian9-EMCC-wasm-Release-PathKit',
|
||||
'Build-Debian9-GCC-arm-Release-Chromecast',
|
||||
'Build-Debian9-GCC-loongson3a-Release',
|
||||
'Build-Debian9-GCC-x86_64-Release-ANGLE',
|
||||
|
83
infra/bots/recipe_modules/build/wasm.py
Normal file
83
infra/bots/recipe_modules/build/wasm.py
Normal file
@ -0,0 +1,83 @@
|
||||
# Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-release:1.38.6'
|
||||
INNER_BUILD_SCRIPT = '/SRC/skia/experimental/pathkit/docker/build_pathkit.sh'
|
||||
|
||||
BUILD_PRODUCTS_ISOLATE_WHITELIST_WASM = [
|
||||
'pathkit.*'
|
||||
]
|
||||
|
||||
|
||||
def compile_fn(api, checkout_root, _ignore):
|
||||
out_dir = api.vars.cache_dir.join('docker', 'wasm')
|
||||
|
||||
# We want to make sure the directories exist and were created by chrome-bot,
|
||||
# because if that isn' the case, docker will make them and they will be
|
||||
# owned by root, which causes mysterious failures. To mitigate this risk
|
||||
# further, we don't use the same out_dir as everyone else (thus the _ignore)
|
||||
# param. Instead, we use a "wasm" subdirectory in the "docker" named_cache.
|
||||
api.file.ensure_directory('mkdirs out_dir', out_dir)
|
||||
|
||||
# This uses the emscriptem sdk docker image and says "run the
|
||||
# build_pathkit.sh helper script in there". Additionally, it binds two
|
||||
# folders: the skia checkout to /SRC and the output directory to /OUT
|
||||
# The called helper script will make the compile happen and put the
|
||||
# output in the right spot. The neat thing is that since the Skia checkout
|
||||
# (and, by extension, the build script) is not a part of the image, but
|
||||
# bound in at runtime, we don't have to re-build the image, except when the
|
||||
# toolchain changes.
|
||||
# Of note, the wasm build doesn't re-use any intermediate steps from the
|
||||
# previous builds, so it's essentially a build from scratch every time.
|
||||
api.run(
|
||||
api.step,
|
||||
'Build PathKit with Docker',
|
||||
cmd=['docker', 'run', '--rm', '-v', '%s:/SRC' % checkout_root,
|
||||
'-v', '%s:/OUT' % out_dir,
|
||||
DOCKER_IMAGE, INNER_BUILD_SCRIPT]
|
||||
)
|
||||
|
||||
|
||||
def copy_extra_build_products(api, _ignore, dst):
|
||||
out_dir = api.vars.cache_dir.join('docker', 'wasm')
|
||||
# We don't use the normal copy_build_products because it uses
|
||||
# shutil.move, which attempts to delete the previous file, which
|
||||
# doesn't work because the docker created outputs are read-only and
|
||||
# owned by root (aka only docker images). It's likely safe to change
|
||||
# the shutil.move in the original script to a non-deleting thing
|
||||
# (like copy or copyfile), but there's some subtle behavior differences
|
||||
# especially with directories, that kjlubick felt it best not to risk it.
|
||||
api.python.inline(
|
||||
name='copy wasm output',
|
||||
program='''import errno
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
src = sys.argv[1]
|
||||
dst = sys.argv[2]
|
||||
build_products_whitelist = %s
|
||||
|
||||
try:
|
||||
os.makedirs(dst)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
for pattern in build_products_whitelist:
|
||||
path = os.path.join(src, pattern)
|
||||
for f in glob.glob(path):
|
||||
dst_path = os.path.join(dst, os.path.relpath(f, src))
|
||||
if not os.path.isdir(os.path.dirname(dst_path)):
|
||||
os.makedirs(os.path.dirname(dst_path))
|
||||
print 'Copying build product %%s to %%s' %% (f, dst_path)
|
||||
# Because Docker usually has some strange permissions (like root
|
||||
# ownership), we'd rather not keep those around. copyfile doesn't
|
||||
# keep the metadata around, so that helps us.
|
||||
shutil.copyfile(f, dst_path)
|
||||
''' % str(BUILD_PRODUCTS_ISOLATE_WHITELIST_WASM),
|
||||
args=[out_dir, dst],
|
||||
infra_step=True)
|
||||
|
@ -281,9 +281,9 @@
|
||||
"Build-Debian9-Clang-x86_64-Release-Vulkan"
|
||||
]
|
||||
},
|
||||
"Build-Debian9-EMCC-wasm-Release": {
|
||||
"Build-Debian9-EMCC-wasm-Release-PathKit": {
|
||||
"tasks": [
|
||||
"Build-Debian9-EMCC-wasm-Release"
|
||||
"Build-Debian9-EMCC-wasm-Release-PathKit"
|
||||
]
|
||||
},
|
||||
"Build-Debian9-GCC-loongson3a-Debug": {
|
||||
@ -10114,7 +10114,7 @@
|
||||
],
|
||||
"service_account": "skia-external-compile-tasks@skia-swarming-bots.iam.gserviceaccount.com"
|
||||
},
|
||||
"Build-Debian9-EMCC-wasm-Release": {
|
||||
"Build-Debian9-EMCC-wasm-Release-PathKit": {
|
||||
"caches": [
|
||||
{
|
||||
"name": "vpython",
|
||||
@ -10131,6 +10131,10 @@
|
||||
{
|
||||
"name": "work",
|
||||
"path": "cache/work"
|
||||
},
|
||||
{
|
||||
"name": "docker",
|
||||
"path": "cache/docker"
|
||||
}
|
||||
],
|
||||
"cipd_packages": [
|
||||
@ -10163,11 +10167,6 @@
|
||||
"name": "infra/tools/luci/git-credential-luci/${platform}",
|
||||
"path": "cipd_bin_packages",
|
||||
"version": "git_revision:e1abc57be62d198b5c2f487bfb2fa2d2eb0e867c"
|
||||
},
|
||||
{
|
||||
"name": "skia/bots/emscripten_sdk",
|
||||
"path": "emscripten_sdk",
|
||||
"version": "version:2"
|
||||
}
|
||||
],
|
||||
"command": [
|
||||
@ -10208,7 +10207,7 @@
|
||||
"-recipe",
|
||||
"compile",
|
||||
"-properties",
|
||||
"{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Build-Debian9-EMCC-wasm-Release\",\"patch_issue\":\"<(ISSUE)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"revision\":\"<(REVISION)\",\"swarm_out_dir\":\"build\"}",
|
||||
"{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Build-Debian9-EMCC-wasm-Release-PathKit\",\"patch_issue\":\"<(ISSUE)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"revision\":\"<(REVISION)\",\"swarm_out_dir\":\"build\"}",
|
||||
"-logdog-annotation-url",
|
||||
"logdog://logs.chromium.org/skia/<(TASK_ID)/+/annotations"
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user