Fix usage of depot_tools in containers.
depot_tools w/vpython now seems to require the depot_tools dir
to be on PATH, and also python and curl need to be installed.
* Creates a new base image that has all the build tools we need for
building Skia: skia-build-tools.
* Moves skia-release to use that new base image.
* Moves both the skia-release and wasm builds to use fetch and gclient sync.
* Changes gcr.io/skia-public/emsdk-base:prod to depend on skia-build-tools.
Bug: skia:993053
Change-Id: Ib6218d8c18dd59d43de84dcf063f204cfc8556d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248556
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
diff --git a/docker/Makefile b/docker/Makefile
new file mode 100644
index 0000000..37270b9
--- /dev/null
+++ b/docker/Makefile
@@ -0,0 +1,6 @@
+# Build gcr.io/skia-public/skia-build-tools:latest, the image used to compile
+# Skia in Google Cloud Build.
+push-skia-build-tools:
+ docker build -t skia-build-tools ./skia-build-tools
+ docker tag skia-build-tools gcr.io/skia-public/skia-build-tools:latest
+ docker push gcr.io/skia-public/skia-build-tools:latest
\ No newline at end of file
diff --git a/docker/README.md b/docker/README.md
index aa310d5..eddac2b 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,10 +1,8 @@
-Docker
-======
+# Docker
Docker files for building different Skia targets.
-skia-release
-------
+## skia-release
This image is used to build Skia at TOT with SwiftShader.
@@ -15,8 +13,7 @@
docker tag skia-release gcr.io/skia-public/skia-release:prod
docker push gcr.io/skia-public/skia-release:prod
-skia-wasm-release
-------
+## skia-wasm-release
This image is used to build the Web Assembly (WASM) libraries of Skia
at TOT.
@@ -29,8 +26,7 @@
docker push gcr.io/skia-public/skia-wasm-release:prod
-skia-with-swift-shader-base
-------
+## skia-with-swift-shader-base
This image is used to build a local checkout of Skia with SwiftShader and run the built
executables without requiring the SwiftShader be installed on the host.
@@ -49,8 +45,7 @@
docker tag skia-with-swift-shader-base gcr.io/skia-public/skia-with-swift-shader-base:prod
docker push gcr.io/skia-public/skia-with-swift-shader-base:prod
-cmake-release
-------
+## cmake-release
This image is used to build Skia using CMake.
@@ -70,8 +65,7 @@
# Compile Skia in a local checkout with the local image
docker run -v $SKIA_ROOT:/SRC -v /tmp/output:/OUT cmake-release /SRC/infra/docker/cmake/build_skia.sh
-binary-size
-------
+## binary-size
This image is used to build code size tree-maps of Skia
@@ -89,4 +83,12 @@
# installed and configured.
docker run -it binary-size /bin/sh
# analyze exe "skottie_tool" in build directory out/Release
- docker run -v $SKIA_ROOT/out/Release:/IN -v /tmp/output:/OUT binary-size /opt/binary_size/src/run_binary_size_analysis.py --library /IN/skottie_tool --destdir /OUT
\ No newline at end of file
+ docker run -v $SKIA_ROOT/out/Release:/IN -v /tmp/output:/OUT binary-size /opt/binary_size/src/run_binary_size_analysis.py --library /IN/skottie_tool --destdir /OUT
+
+## skia-build-tools
+
+This image contains all the tools needed to build Skia.
+
+To push a new version run:
+
+ make push-skia-build-tools
\ No newline at end of file
diff --git a/docker/cloudbuild.yaml b/docker/cloudbuild.yaml
index 565aa07..22677d8 100644
--- a/docker/cloudbuild.yaml
+++ b/docker/cloudbuild.yaml
@@ -2,7 +2,9 @@
# Builder: https://cloud.google.com/container-builder/docs/
#
steps:
- # To test locally, first uncomment the last two lines of this comment block, then submit with:
+ # To test locally, first uncomment the last 8 lines of this comment block,
+ # update the /refs/changes/... value to reflect the CL you are testing and
+ # then run:
#
# gcloud builds submit --config cloudbuild.yaml --no-source --substitutions=COMMIT_SHA=b2acf0a93927a57cc1fa9323839e788379ae3366
#
@@ -10,12 +12,18 @@
#
#- name: 'gcr.io/cloud-builders/git'
# args: ['clone', 'https://github.com/google/skia.git', '.']
+ #
+ #- name: 'gcr.io/cloud-builders/git'
+ # args: ['fetch', 'https://skia.googlesource.com/skia','refs/changes/56/248556/18']
+ #
+ #- name: 'gcr.io/cloud-builders/git'
+ # args: ['checkout', 'FETCH_HEAD']
- name: 'debian:testing-slim'
- args: ['mkdir', '-p', '--mode=0777', '/workspace/__doxygen_staging']
+ args: ['mkdir', '-p', '--mode=0777', './__doxygen_staging']
- name: 'debian:testing-slim'
- args: ['mkdir', '-p', '--mode=0777', '/workspace/__cache']
+ args: ['ls', '-al', '/']
- name: 'gcr.io/skia-public/doxygen:testing-slim'
dir: './tools/doxygen'
@@ -142,7 +150,4 @@
- 'gcr.io/$PROJECT_ID/skia-wasm-release:prod'
timeout: 7200s
options:
- machineType: 'N1_HIGHCPU_32'
- env: # https://bugs.chromium.org/p/chromium/issues/detail?id=993053#c3
- - 'VPYTHON_VIRTUALENV_ROOT=/workspace/__cache'
- - 'CIPD_CACHE_DIR=/workspace/__cache'
+ machineType: 'N1_HIGHCPU_32'
\ No newline at end of file
diff --git a/docker/skia-build-tools/Dockerfile b/docker/skia-build-tools/Dockerfile
new file mode 100644
index 0000000..085095a
--- /dev/null
+++ b/docker/skia-build-tools/Dockerfile
@@ -0,0 +1,20 @@
+# Dockerfile for building an image with all the tools needed to checkout and build Skia.
+FROM launcher.gcr.io/google/clang-debian9 AS build
+RUN apt-get update && apt-get upgrade -y && apt-get install -y \
+ git \
+ python \
+ curl \
+ build-essential \
+ libfontconfig-dev \
+ libgl1-mesa-dev \
+ libglu1-mesa-dev \
+ && groupadd -g 2000 skia \
+ && useradd -u 2000 -g 2000 skia
+
+RUN cd /tmp \
+ && git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
+
+ENV PATH=${PATH}:/tmp/depot_tools
+
+ADD --chown=skia:skia https://storage.googleapis.com/swiftshader-binaries/OpenGL_ES/Latest/Linux/libGLESv2.so /usr/local/lib/libGLESv2.so
+ADD --chown=skia:skia https://storage.googleapis.com/swiftshader-binaries/OpenGL_ES/Latest/Linux/libEGL.so /usr/local/lib/libEGL.so
\ No newline at end of file
diff --git a/docker/skia-release/Dockerfile b/docker/skia-release/Dockerfile
index e59e248..41049a2 100644
--- a/docker/skia-release/Dockerfile
+++ b/docker/skia-release/Dockerfile
@@ -1,26 +1,18 @@
# Dockerfile for building Skia in release mode, using 3rd party libs from DEPS, with SwiftShader.
-FROM launcher.gcr.io/google/clang-debian9 AS build
-RUN apt-get update && apt-get upgrade -y && apt-get install -y \
- git \
- python \
- curl \
- build-essential \
- libfontconfig-dev \
- libgl1-mesa-dev \
- libglu1-mesa-dev \
- && groupadd -g 2000 skia \
- && useradd -u 2000 -g 2000 --home-dir /workspace/__cache skia
+FROM gcr.io/skia-public/skia-build-tools:latest
-ADD --chown=skia:skia https://storage.googleapis.com/swiftshader-binaries/OpenGL_ES/Latest/Linux/libGLESv2.so /usr/local/lib/libGLESv2.so
-ADD --chown=skia:skia https://storage.googleapis.com/swiftshader-binaries/OpenGL_ES/Latest/Linux/libEGL.so /usr/local/lib/libEGL.so
RUN cd /tmp \
- && git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' \
- && git clone https://swiftshader.googlesource.com/SwiftShader swiftshader \
- && mkdir -p /tmp/skia \
- && cd /tmp/skia \
- && /tmp/depot_tools/fetch skia \
- && cd skia
+ && git clone https://swiftshader.googlesource.com/SwiftShader swiftshader
+# Checkout Skia.
+RUN mkdir -p /tmp/skia \
+ && cd /tmp/skia \
+ && fetch skia \
+ && cd skia \
+ && gclient sync \
+ && ./bin/fetch-gn
+
+# Write args.gn.
RUN mkdir -p /tmp/skia/skia/out/Static
RUN echo ' \n\
cc = "clang" \n\
@@ -39,9 +31,8 @@
"-Wl,/usr/local/lib" \n\
] ' > /tmp/skia/skia/out/Static/args.gn
+# Build Skia.
RUN cd /tmp/skia/skia \
- && python tools/git-sync-deps \
- && ./bin/fetch-gn \
&& ./bin/gn gen out/Static \
&& git rev-parse HEAD > VERSION \
&& /tmp/depot_tools/ninja -C out/Static \
diff --git a/docker/skia-wasm-release/Dockerfile b/docker/skia-wasm-release/Dockerfile
index 5dac8fc..53125d5 100644
--- a/docker/skia-wasm-release/Dockerfile
+++ b/docker/skia-wasm-release/Dockerfile
@@ -1,14 +1,12 @@
# Dockerfile for building the WASM libraries used by jsfiddle.skia.org and debugger.skia.org
FROM gcr.io/skia-public/emsdk-base:prod as builder
-RUN cd /tmp \
- && git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' \
- && mkdir -p /tmp/skia \
+# Checkout Skia.
+RUN mkdir -p /tmp/skia \
&& cd /tmp/skia \
- && /tmp/depot_tools/fetch skia
-
-RUN cd /tmp/skia/skia \
- && python tools/git-sync-deps \
+ && fetch skia \
+ && cd skia \
+ && gclient sync \
&& ./bin/fetch-gn
# PathKit should be in /tmp/skia/skia/out/pathkit/
diff --git a/infra/wasm-common/docker/emsdk-base/Dockerfile b/infra/wasm-common/docker/emsdk-base/Dockerfile
index 360691b..e0e9a7a 100644
--- a/infra/wasm-common/docker/emsdk-base/Dockerfile
+++ b/infra/wasm-common/docker/emsdk-base/Dockerfile
@@ -1,10 +1,8 @@
# 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
+FROM gcr.io/skia-public/skia-build-tools:latest
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
- git \
- python \
nodejs \
default-jre