Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "devinfra",
commit = "cc73dde52b557f831cc3b6e48daf8c3b542a33df",
commit = "b3b3466509babc50fd7f00b90e8bc607e7fe41aa",
remote = "https://github.com/angular/dev-infra.git",
)

Expand Down
30 changes: 19 additions & 11 deletions material.angular.io/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

http_archive(
name = "aspect_bazel_lib",
Expand Down Expand Up @@ -44,17 +45,6 @@ http_archive(
urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"],
)

http_archive(
name = "dev-infra",
strip_prefix = "dev-infra-8a438a3bdc519880d78b5ac92b62bfe688deb058",
sha256 = "2e75c26ba9f678de8496f05a10470d62a398bad05f6b64864bbed5dc304a6f4e",
url = "https://github.com/angular/dev-infra/archive/8a438a3bdc519880d78b5ac92b62bfe688deb058/8a438a3bdc519880d78b5ac92b62bfe688deb058.tar.gz",
)

load("@dev-infra//bazel/browsers:browser_repositories.bzl", "browser_repositories")

browser_repositories()

load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")

web_test_repositories()
Expand All @@ -76,3 +66,21 @@ npm_translate_lock(
load("@npm//:repositories.bzl", "npm_repositories")

npm_repositories()

git_repository(
name = "devinfra",
commit = "b3b3466509babc50fd7f00b90e8bc607e7fe41aa",
remote = "https://github.com/angular/dev-infra.git",
)

load("@devinfra//bazel:setup_dependencies_1.bzl", "setup_dependencies_1")

setup_dependencies_1()

load("@devinfra//bazel:setup_dependencies_2.bzl", "setup_dependencies_2")

setup_dependencies_2()

load("@devinfra//bazel/browsers:browser_repositories.bzl", "browser_repositories")

browser_repositories()
98 changes: 48 additions & 50 deletions material.angular.io/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ APPLICATION_CONFIG = COMMON_CONFIG + [

# Common dependencies of Angular CLI test suites
TEST_CONFIG = COMMON_CONFIG + [
"@dev-infra//bazel/browsers/chromium",
"@dev-infra//bazel/browsers/firefox",

"@devinfra//bazel/browsers/chromium",
"@devinfra//bazel/browsers/firefox",
"//:ng-base-test-config",
":ng-test-config",
"//:node_modules/karma",
Expand All @@ -74,9 +73,8 @@ TEST_DEPS = [

# Common dependencies of Angular CLI e2e tests
E2E_CONFIG = COMMON_CONFIG + [
"@dev-infra//bazel/browsers/chromium",
"@dev-infra//bazel/browsers/firefox",

"@devinfra//bazel/browsers/chromium",
"@devinfra//bazel/browsers/firefox",
"//:ng-base-test-config",
":ng-e2e-config",
"//:node_modules/jasmine-spec-reporter",
Expand All @@ -89,28 +87,28 @@ E2E_DEPS = [
]

LINT_CONFIG = COMMON_CONFIG + [
# Lint uses the e2e config
"//:ng-base-test-config",
":ng-e2e-config",
"//:ng-base-lint-config",
"//:node_modules/@angular-eslint/builder",
"//:node_modules/@angular-eslint/eslint-plugin",
"//:node_modules/@angular-eslint/eslint-plugin-template",
"//:node_modules/@angular-eslint/template-parser",
"//:node_modules/eslint-plugin-ban",
"//:node_modules/eslint-plugin-import",
"//:node_modules/eslint-plugin-jsdoc",
"//:node_modules/eslint-plugin-prefer-arrow",
"//:node_modules/@typescript-eslint/eslint-plugin",
"//:node_modules/@typescript-eslint/parser",
"//:node_modules/@stylistic/eslint-plugin",
# Lint uses the e2e config
"//:ng-base-test-config",
":ng-e2e-config",
"//:ng-base-lint-config",
"//:node_modules/@angular-eslint/builder",
"//:node_modules/@angular-eslint/eslint-plugin",
"//:node_modules/@angular-eslint/eslint-plugin-template",
"//:node_modules/@angular-eslint/template-parser",
"//:node_modules/eslint-plugin-ban",
"//:node_modules/eslint-plugin-import",
"//:node_modules/eslint-plugin-jsdoc",
"//:node_modules/eslint-plugin-prefer-arrow",
"//:node_modules/@typescript-eslint/eslint-plugin",
"//:node_modules/@typescript-eslint/parser",
"//:node_modules/@stylistic/eslint-plugin",
]
LINT_DEPS = [
# TODO(bazel): this should be included as a transitive of @angular-devkit/architect-cli!?
"//:node_modules/@angular-devkit/architect",
# TODO(bazel): this should be included as a transitive of @angular-devkit/architect-cli!?
"//:node_modules/@angular-devkit/architect",
]


# buildifier: disable=unused-variable
def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [], **kwargs):
"""
Macro for Angular applications, creating various targets aligning with the Angular CLI.
Expand All @@ -137,44 +135,44 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],

test_srcs = native.glob(["src/test.ts", "src/**/*.spec.ts"])

e2e_srcs = native.glob(["e2e/src/**/*.ts"])
e2e_srcs = native.glob(["e2e/src/**/*.ts"])

tags = kwargs.pop("tags", [])

# config files
copy_to_bin(
name = "ng-app-config",
srcs = [
"tsconfig.app.json",
"tsconfig.app.json",
],
visibility = ["//visibility:private"],
)
copy_to_bin(
name = "ng-test-config",
srcs = [
"karma.conf.js",
"tsconfig.spec.json",
"karma.conf.js",
"tsconfig.spec.json",
],
visibility = ["//visibility:private"],
)
copy_to_bin(
name = "ng-e2e-config",
srcs = [
"e2e/tsconfig.json",
"e2e/protractor.conf.js",
"e2e/tsconfig.json",
"e2e/protractor.conf.js",
],
visibility = ["//visibility:private"],
)

# Lint config files in addition to the root
if native.package_name() != '':
copy_to_bin(
name = "lint-config",
srcs = [
".eslintrc.json",
],
visibility = ["//visibility:private"],
)
if native.package_name() != "":
copy_to_bin(
name = "lint-config",
srcs = [
".eslintrc.json",
],
visibility = ["//visibility:private"],
)

project_name = project_name if project_name else name

Expand Down Expand Up @@ -239,7 +237,7 @@ def ng_app(name, project_name = None, deps = [], test_deps = [], e2e_deps = [],
_architect_test(
project_name,
"lint",
srcs = srcs + test_srcs + e2e_srcs + deps + test_deps + NG_COMMON_DEPS + LINT_DEPS + LINT_CONFIG + ([":lint-config"] if native.package_name() != '' else []),
srcs = srcs + test_srcs + e2e_srcs + deps + test_deps + NG_COMMON_DEPS + LINT_DEPS + LINT_CONFIG + ([":lint-config"] if native.package_name() != "" else []),
tags = tags + ["lint"],
**kwargs
)
Expand All @@ -248,8 +246,9 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
output_dir = "%s%s" % (project_name, ".%s" % configuration if configuration else "")

args = [
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
"--output-path", output_dir
"%s:build%s" % (project_name, ":%s" % configuration if configuration else ""),
"--output-path",
output_dir,
] + args

architect_cli.architect(
Expand All @@ -258,13 +257,13 @@ def _architect_build(project_name, configuration = None, args = [], srcs = [], *
args = args,
out_dirs = [output_dir],
srcs = srcs,
**kwargs,
**kwargs
)

def _architect_test(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
to_root = ""
if native.package_name() != "":
to_root = "".join(["../" for _ in native.package_name().split("/")])
to_root = "".join(["../" for _ in native.package_name().split("/")])

env = {
"CHROME_BIN": to_root + "$(CHROMIUM)",
Expand All @@ -275,25 +274,24 @@ def _architect_test(project_name, command, configuration = None, args = [], srcs
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
chdir = native.package_name(),
args = [
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
] + args,
data = srcs,
env = env,
toolchains = [
"@dev-infra//bazel/browsers/chromium:toolchain_alias",
"@dev-infra//bazel/browsers/firefox:toolchain_alias",
"@devinfra//bazel/browsers/chromium:toolchain_alias",
"@devinfra//bazel/browsers/firefox:toolchain_alias",
],
**kwargs,
**kwargs
)

def _architect_binary(project_name, command, configuration = None, args = [], srcs = [], **kwargs):
architect_cli.architect_binary(
name = "%s%s" % (command, ".%s" % configuration if configuration else ""),
chdir = native.package_name(),
args = [
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else "")
"%s:%s%s" % (project_name, command, ":%s" % configuration if configuration else ""),
] + args,
data = srcs,
**kwargs,
**kwargs
)

Loading