Skip to content

Commit 150c964

Browse files
gregmagolanjelbourn
authored andcommitted
fix: bazel support for downstream apps (#13836)
1 parent 94c60d6 commit 150c964

File tree

22 files changed

+4321
-154
lines changed

22 files changed

+4321
-154
lines changed

WORKSPACE

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ http_archive(
1717
# Add Angular source and Bazel rules.
1818
http_archive(
1919
name = "angular",
20-
url = "https://github.com/angular/angular/archive/7.0.1.zip",
21-
strip_prefix = "angular-7.0.1",
20+
url = "https://github.com/angular/angular/archive/7.0.2.zip",
21+
strip_prefix = "angular-7.0.2",
2222
)
2323

2424
# Add RxJS as repository because those are needed in order to build Angular from source.
2525
# Also we cannot refer to the RxJS version from the node modules because self-managed
2626
# node modules are not guaranteed to be installed.
27+
# TODO(gmagolan): remove this once rxjs ships with an named UMD bundle and we
28+
# are no longer building it from source.
2729
http_archive(
2830
name = "rxjs",
2931
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
@@ -72,12 +74,14 @@ node_repositories(
7274
yarn_version = "1.9.4",
7375
)
7476

75-
# Use Bazel managed node modules. See more below:
76-
# https://github.com/bazelbuild/rules_nodejs#bazel-managed-vs-self-managed-dependencies
77+
# @npm is temporarily needed to build @rxjs from source since its ts_library
78+
# targets will depend on an @npm workspace by default.
79+
# TODO(gmagolan): remove this once rxjs ships with an named UMD bundle and we
80+
# are no longer building it from source.
7781
yarn_install(
7882
name = "npm",
79-
package_json = "//:package.json",
80-
yarn_lock = "//:yarn.lock",
83+
package_json = "//tools:npm/package.json",
84+
yarn_lock = "//tools:npm/yarn.lock",
8185
)
8286

8387
# Setup TypeScript Bazel workspace
@@ -88,6 +92,9 @@ ts_setup_workspace()
8892
load("@angular//:index.bzl", "ng_setup_workspace")
8993
ng_setup_workspace()
9094

95+
load("@angular_material//:index.bzl", "angular_material_setup_workspace")
96+
angular_material_setup_workspace()
97+
9198
# Setup Go toolchain (required for Bazel web testing rules)
9299
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
93100
go_rules_dependencies()

index.bzl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright Google LLC All Rights Reserved.
2+
#
3+
# Use of this source code is governed by an MIT-style license that can be
4+
# found in the LICENSE file at https://angular.io/license
5+
"""Public API surface is re-exported here.
6+
7+
This API is exported for users building Angular Material from source in
8+
downstream projects.
9+
"""
10+
11+
load("//tools:angular_material_setup_workspace.bzl",
12+
_angular_material_setup_workspace = "angular_material_setup_workspace")
13+
14+
angular_material_setup_workspace = _angular_material_setup_workspace

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"version": "7.0.2",
3030
"requiredAngularVersion": ">=7.0.0",
3131
"dependencies": {
32-
"@angular/animations": "^7.0.0",
33-
"@angular/common": "^7.0.0",
34-
"@angular/compiler": "^7.0.0",
35-
"@angular/core": "^7.0.0",
36-
"@angular/elements": "^7.0.0",
37-
"@angular/forms": "^7.0.0",
38-
"@angular/platform-browser": "^7.0.0",
32+
"@angular/animations": "^7.0.2",
33+
"@angular/common": "^7.0.2",
34+
"@angular/compiler": "^7.0.2",
35+
"@angular/core": "^7.0.2",
36+
"@angular/elements": "^7.0.2",
37+
"@angular/forms": "^7.0.2",
38+
"@angular/platform-browser": "^7.0.2",
3939
"@webcomponents/custom-elements": "^1.1.0",
4040
"core-js": "^2.4.1",
4141
"rxjs": "^6.3.3",
@@ -47,13 +47,13 @@
4747
"devDependencies": {
4848
"@angular-devkit/core": "^7.0.1",
4949
"@angular-devkit/schematics": "^7.0.1",
50-
"@angular/bazel": "7.0.1",
51-
"@angular/compiler-cli": "^7.0.0",
52-
"@angular/http": "^7.0.0",
53-
"@angular/platform-browser-dynamic": "^7.0.0",
54-
"@angular/platform-server": "^7.0.0",
55-
"@angular/router": "^7.0.0",
56-
"@angular/upgrade": "^7.0.0",
50+
"@angular/bazel": "^7.0.2",
51+
"@angular/compiler-cli": "^7.0.2",
52+
"@angular/http": "^7.0.2",
53+
"@angular/platform-browser-dynamic": "^7.0.2",
54+
"@angular/platform-server": "^7.0.2",
55+
"@angular/router": "^7.0.2",
56+
"@angular/upgrade": "^7.0.2",
5757
"@bazel/ibazel": "0.6.0",
5858
"@bazel/karma": "0.20.3",
5959
"@bazel/typescript": "0.20.3",

src/cdk/coercion/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ ts_library(
66
name = "coercion",
77
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
88
module_name = "@angular/cdk/coercion",
9-
deps = ["@npm//tslib"],
9+
deps = ["@matdeps//tslib"],
1010
)
1111

1212
ts_library(
1313
name = "coercion_test_sources",
1414
srcs = glob(["**/*.spec.ts"]),
1515
deps = [
16-
"@npm//@types/jasmine",
16+
"@matdeps//@types/jasmine",
1717
":coercion"
1818
],
1919
testonly = 1,

src/cdk/collections/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ts_library(
1616
name = "collections_test_sources",
1717
srcs = glob(["**/*.spec.ts"]),
1818
deps = [
19-
"@npm//@types/jasmine",
19+
"@matdeps//@types/jasmine",
2020
":collections"
2121
],
2222
testonly = 1,

src/cdk/keycodes/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ ts_library(
66
name = "keycodes",
77
module_name = "@angular/cdk/keycodes",
88
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9-
deps = ["@npm//tslib"],
9+
deps = ["@matdeps//tslib"],
1010
)

src/cdk/schematics/BUILD.bazel

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
43
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package")
54
load("//:packages.bzl", "VERSION_PLACEHOLDER_REPLACEMENTS")
6-
load("//tools:defaults.bzl", "jasmine_node_test")
5+
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
76

87
# TODO(devversion): remove when https://github.com/bazelbuild/rules_nodejs/issues/352 is fixed
98
exports_files(["#bazel_workaround.txt"])
@@ -24,15 +23,15 @@ ts_library(
2423
]),
2524
tsconfig = ":tsconfig.json",
2625
deps = [
27-
"@npm//@schematics/angular",
28-
"@npm//@angular-devkit/schematics",
26+
"@matdeps//@schematics/angular",
27+
"@matdeps//@angular-devkit/schematics",
2928
# TODO(devversion): Only include jasmine for test sources (See: tsconfig types).
30-
"@npm//@types/jasmine",
31-
"@npm//@types/node",
32-
"@npm//glob",
33-
"@npm//parse5",
34-
"@npm//tslint",
35-
"@npm//typescript"
29+
"@matdeps//@types/jasmine",
30+
"@matdeps//@types/node",
31+
"@matdeps//glob",
32+
"@matdeps//parse5",
33+
"@matdeps//tslint",
34+
"@matdeps//typescript"
3635
],
3736
)
3837

@@ -57,13 +56,13 @@ ts_library(
5756
srcs = glob(["**/*.spec.ts"], exclude = ["**/files/**/*.spec.ts"]),
5857
deps = [
5958
"//src/cdk/schematics/testing",
60-
"@npm//@schematics/angular",
61-
"@npm//@angular-devkit/schematics",
62-
"@npm//@types/jasmine",
63-
"@npm//@types/node",
64-
"@npm//mock-fs",
65-
"@npm//tslint",
66-
"@npm//typescript",
59+
"@matdeps//@schematics/angular",
60+
"@matdeps//@angular-devkit/schematics",
61+
"@matdeps//@types/jasmine",
62+
"@matdeps//@types/node",
63+
"@matdeps//mock-fs",
64+
"@matdeps//tslint",
65+
"@matdeps//typescript",
6766
":schematics",
6867
],
6968
tsconfig = ":tsconfig.json",

src/cdk/schematics/testing/BUILD.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ ts_library(
77
module_name = "@angular/cdk/schematics/testing",
88
srcs = glob(["**/*.ts"]),
99
deps = [
10-
"@npm//@angular-devkit/core",
11-
"@npm//@angular-devkit/schematics",
12-
"@npm//@schematics/angular",
13-
"@npm//@types/node",
14-
"@npm//@types/fs-extra",
15-
"@npm//fs-extra",
16-
"@npm//rxjs",
10+
"@matdeps//@angular-devkit/core",
11+
"@matdeps//@angular-devkit/schematics",
12+
"@matdeps//@schematics/angular",
13+
"@matdeps//@types/node",
14+
"@matdeps//@types/fs-extra",
15+
"@matdeps//fs-extra",
16+
"@matdeps//rxjs",
1717
],
1818
)

src/lib/form-field/BUILD.bazel

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ ng_module(
1010
assets = [
1111
":form-field.css",
1212
":form-field-fill.css",
13+
":form-field-input.css",
1314
":form-field-legacy.css",
1415
":form-field-outline.css",
1516
":form-field-standard.css",
16-
"//src/lib/input:input.css"
1717
] + glob(["**/*.html"]),
1818
deps = [
1919
"@angular//packages/animations",
@@ -49,6 +49,12 @@ sass_binary(
4949
deps = ["//src/lib/core:core_scss_lib"],
5050
)
5151

52+
sass_binary(
53+
name = "form_field_input_scss",
54+
src = "form-field-input.scss",
55+
deps = ["//src/lib/core:core_scss_lib"],
56+
)
57+
5258
sass_binary(
5359
name = "form_field_legacy_scss",
5460
src = "form-field-legacy.scss",
File renamed without changes.

0 commit comments

Comments
 (0)