blob: c8b11f3829dd16961e7cdc9665d1ef83df8648b2 [file] [log] [blame]
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@bazel_gazelle//:def.bzl", "gazelle")
# gazelle:prefix go.skia.org/infra
gazelle(name = "gazelle")
exports_files(["tsconfig.json"], visibility = ["//visibility:public"])
############################################
# Custom Remote Build Execution toolchain. #
############################################
load(
"@io_bazel_rules_docker//docker/toolchain_container:toolchain_container.bzl",
"toolchain_container",
)
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
# Generates a custom toolchain container for Remote Build Execution which extends the default RBE
# ubuntu16-04 container with any extra dependencies needed for Skia Infrastructure build targets.
#
# Reference:
# https://cloud.google.com/remote-build-execution/docs/create-custom-toolchain#creating_a_custom_toolchain_container
toolchain_container(
name = "rbe_container_skia_infra",
base = "@rbe_ubuntu1604//image",
packages = [
# Install Chrome and fonts to support major charsets.
#
# This is necessary for the karma_mocha_test rule to work, which runs web tests on a
# headless Chrome, and also for the bundled version of Chromium that Puppeteer installs to
# render fonts properly.
#
# Adapted from:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
"google-chrome-stable",
"fonts-ipafont-gothic",
"fonts-wqy-zenhei",
"fonts-thai-tlwg",
"fonts-kacst",
"fonts-freefont-ttf",
# Prevent "error while loading shared libraries: libXss.so.1" in Puppeteer tests.
# See https://github.com/puppeteer/puppeteer/issues/6192.
"libxss1",
],
additional_repos = [
"deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main",
],
keys = [
"@chrome_gpg//file",
],
stamp = True,
)
container_push(
name = "push_rbe_container_skia_infra",
image = ":rbe_container_skia_infra",
format = "Docker",
registry = "gcr.io",
repository = "skia-public/rbe-container-skia-infra",
tag = "{STABLE_DOCKER_TAG}"
)
####################################################################################################
# Support for "~"-prefixed Sass imports of elements-sk styles, e.g.: #
# #
# @import '~elements-sk/themes/themes'; #
# #
# This hack is necessary to maintain compatibility with the Webpack build, which uses the #
# css-loader plugin to inline CSS imports. Said plugin adds all NPM packages to the Sass compiler #
# import path with the "~" prefix. See https://webpack.js.org/loaders/css-loader/#import for more. #
####################################################################################################
ELEMENTS_SK_SCSS = [
# To regenerate this list, please run the following Bash command:
#
# $ find infra-sk/node_modules/elements-sk -name "*.scss" \
# | sed -E "s/infra-sk\//\/\/infra-sk:/" | sort
"//infra-sk:node_modules/elements-sk/checkbox-sk/checkbox-sk.scss",
"//infra-sk:node_modules/elements-sk/collapse-sk/collapse-sk.scss",
"//infra-sk:node_modules/elements-sk/colors.scss",
"//infra-sk:node_modules/elements-sk/icon/icon-sk.scss",
"//infra-sk:node_modules/elements-sk/multi-select-sk/multi-select-sk.scss",
"//infra-sk:node_modules/elements-sk/nav-links-sk/nav-links-sk.scss",
"//infra-sk:node_modules/elements-sk/radio-sk/radio-sk.scss",
"//infra-sk:node_modules/elements-sk/select-sk/select-sk.scss",
"//infra-sk:node_modules/elements-sk/spinner-sk/spinner-sk.scss",
"//infra-sk:node_modules/elements-sk/styles/buttons/buttons.scss",
"//infra-sk:node_modules/elements-sk/styles/select/select.scss",
"//infra-sk:node_modules/elements-sk/styles/table/table.scss",
"//infra-sk:node_modules/elements-sk/tabs-panel-sk/tabs-panel-sk.scss",
"//infra-sk:node_modules/elements-sk/tabs-sk/tabs-sk.scss",
"//infra-sk:node_modules/elements-sk/themes/color-palette.scss",
"//infra-sk:node_modules/elements-sk/themes/themes.scss",
"//infra-sk:node_modules/elements-sk/toast-sk/toast-sk.scss",
]
TILDE_ELEMENTS_SK_SCSS = [f.replace("//infra-sk:node_modules/", "~") for f in ELEMENTS_SK_SCSS]
# Recursively copies all *.scss files from //infra-sk/node_modules/elements-sk to //~elements-sk.
genrule(
name = "~elements-sk_generator",
srcs = ELEMENTS_SK_SCSS,
outs = TILDE_ELEMENTS_SK_SCSS,
cmd =
"for FILENAME in $(SRCS); do " +
" TILDE_FILENAME=`echo $$FILENAME | sed -E 's/infra-sk\\/node_modules\\/(.*)/~\\1/'`; " +
" TILDE_DIR=$$(dirname $$TILDE_FILENAME); " +
" mkdir -p $(RULEDIR)/$$TILDE_DIR; " +
" cp $$FILENAME $(RULEDIR)/$$TILDE_FILENAME; " +
"done",
)
# Do not use directly. Use //infra-sk:elements-sk_scss instead, which includes these files as well.
filegroup(
name = "~elements-sk",
srcs = TILDE_ELEMENTS_SK_SCSS,
visibility = ["//infra-sk:__pkg__"],
)