build: build cdk with angular from source (#13541)

* build: build cdk with angular from source

* Continues the long-term Bazel goal by fixing the CDK bazel build
targets. Also builds the CDK targets with Angular from source.

Follow up's will try to make serving, and testing possible.

* Build package on CI

* No longer compile with AOT compiler that generates factory files that cannot be packaged into "ng_package"
This commit is contained in:
Paul Gschwendtner
2018-10-11 19:00:40 +02:00
committed by Andrew Seguin
parent a2c23a45be
commit 282736f8be
31 changed files with 199 additions and 162 deletions
+7 -4
View File
@@ -1,18 +1,21 @@
package(default_visibility=["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@angular//:index.bzl", "ng_package")
load("//:packages.bzl", "CDK_TARGETS", "ROLLUP_GLOBALS", "VERSION_PLACEHOLDER_REPLACEMENTS")
load("//tools:defaults.bzl", "ng_module")
# Export the CDK tsconfig so that subpackages can reference it directly.
exports_files(["tsconfig-build.json"])
# Root "@angular/cdk" entry-point that does not re-export individual entry-points.
ts_library(
ng_module(
name = "cdk",
srcs = glob(["*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk",
deps = [],
tsconfig = "//src/lib:tsconfig-build.json",
deps = [
"@angular//packages/core",
],
tsconfig = ":tsconfig-build.json",
)
# Creates the @angular/cdk package published to npm.
+6 -3
View File
@@ -1,19 +1,22 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "a11y",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/a11y",
deps = [
"@angular//packages/common",
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/coercion",
"//src/cdk/keycodes",
"//src/cdk/observers",
"//src/cdk/platform",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+4 -3
View File
@@ -1,16 +1,17 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "accordion",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/accordion",
deps = [
"@angular//packages/core",
"@rxjs",
"//src/cdk/coercion",
"//src/cdk/collections",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+7 -7
View File
@@ -1,13 +1,16 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "bidi",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/bidi",
deps = ["@rxjs"],
deps = [
"@angular//packages/common",
"@angular//packages/core",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
@@ -15,10 +18,7 @@ ts_library(
name = "bidi_test_sources",
testonly = 1,
srcs = glob(["**/*.spec.ts"]),
deps = [
":bidi",
"@rxjs",
],
deps = [":bidi"],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+3 -5
View File
@@ -1,14 +1,12 @@
package(default_visibility=["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@angular//:index.bzl", "ng_module")
ng_module(
ts_library(
name = "coercion",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/coercion",
deps = ["@rxjs"],
deps = ["@npm//tslib"],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+6 -3
View File
@@ -1,13 +1,16 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "collections",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/collections",
deps = ["@rxjs"],
deps = [
"@angular//packages/core",
"@rxjs"
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+5 -2
View File
@@ -1,15 +1,18 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "drag-drop",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/drag-drop",
deps = [
"@angular//packages/common",
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/platform",
"//src/cdk/overlay",
"//src/cdk/bidi",
+3 -4
View File
@@ -1,12 +1,11 @@
package(default_visibility=["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@angular//:index.bzl", "ng_module")
ng_module(
ts_library(
name = "keycodes",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/keycodes",
deps = ["@rxjs"],
deps = ["@npm//tslib"],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+5 -3
View File
@@ -1,16 +1,18 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "layout",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/layout",
deps = [
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/coercion",
"//src/cdk/platform",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+4 -2
View File
@@ -1,14 +1,16 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "observers",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/observers",
deps = [
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/coercion",
],
tsconfig = "//src/cdk:tsconfig-build.json",
+6 -2
View File
@@ -1,20 +1,24 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "overlay",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/overlay",
deps = [
"@angular//packages/common",
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/bidi",
"//src/cdk/coercion",
"//src/cdk/keycodes",
"//src/cdk/platform",
"//src/cdk/portal",
"//src/cdk/scrolling",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+6 -2
View File
@@ -1,10 +1,14 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "platform",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/platform",
deps = ["@rxjs"],
deps = [
"@angular//packages/common",
"@angular//packages/core",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+6 -7
View File
@@ -1,13 +1,15 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "portal",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/portal",
deps = ["@rxjs"],
deps = [
"@angular//packages/core",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
@@ -15,10 +17,7 @@ ts_library(
name = "portal_test_sources",
testonly = 1,
srcs = glob(["**/*.spec.ts"]),
deps = [
":portal",
"@rxjs",
],
deps = [":portal"],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+16 -16
View File
@@ -19,16 +19,16 @@ ts_library(
srcs = glob(["**/*.ts"], exclude=["**/files/**/*.ts", "**/*.spec.ts"]),
tsconfig = ":tsconfig.json",
deps = [
"@npm//:@schematics/angular",
"@npm//:@angular-devkit/schematics",
"@npm//@schematics/angular",
"@npm//@angular-devkit/schematics",
# TODO(devversion): Only include jasmine for test sources (See: tsconfig types).
"@npm//:@types/jasmine",
"@npm//:@types/node",
"@npm//:glob",
"@npm//:parse5",
"@npm//:rxjs",
"@npm//:tslint",
"@npm//:typescript"
"@npm//@types/jasmine",
"@npm//@types/node",
"@npm//glob",
"@npm//parse5",
"@npm//rxjs",
"@npm//tslint",
"@npm//typescript"
],
)
@@ -53,13 +53,13 @@ ts_library(
srcs = glob(["**/*.spec.ts"], exclude = ["**/files/**/*.spec.ts"]),
deps = [
":schematics",
"@npm//:@schematics/angular",
"@npm//:@angular-devkit/schematics",
"@npm//:@types/jasmine",
"@npm//:@types/node",
"@npm//:mock-fs",
"@npm//:tslint",
"@npm//:typescript",
"@npm//@schematics/angular",
"@npm//@angular-devkit/schematics",
"@npm//@types/jasmine",
"@npm//@types/node",
"@npm//mock-fs",
"@npm//tslint",
"@npm//typescript",
],
tsconfig = ":tsconfig.json",
testonly = True,
+5 -3
View File
@@ -1,8 +1,8 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "scrolling",
@@ -10,11 +10,13 @@ ng_module(
module_name = "@angular/cdk/scrolling",
assets = [":virtual-scroll-viewport.css"] + glob(["**/*.html"]),
deps = [
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/bidi",
"//src/cdk/coercion",
"//src/cdk/collections",
"//src/cdk/platform",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+7 -2
View File
@@ -1,16 +1,21 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "stepper",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/stepper",
deps = [
"@angular//packages/common",
"@angular//packages/core",
"@angular//packages/forms",
"@rxjs",
"@rxjs//operators",
"//src/cdk/a11y",
"//src/cdk/bidi",
"//src/cdk/coercion",
"//src/cdk/keycodes",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+6 -3
View File
@@ -1,18 +1,21 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "table",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/table",
deps = [
"@angular//packages/common",
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/bidi",
"//src/cdk/collections",
"//src/cdk/coercion",
"//src/cdk/platform",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+6 -3
View File
@@ -1,10 +1,13 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "testing",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/testing",
tsconfig = ":tsconfig-test.json",
deps = ["@rxjs"],
tsconfig = ":tsconfig-bazel.json",
deps = [
"@angular//packages/core",
],
)
@@ -1,4 +1,5 @@
// This file exists to be consumed by bazel
// This file exists to be consumed by Bazel
// Note that there is no build tsconfig because the cdk/testing entry-point is internal-only.
{
"extends": "../tsconfig-build",
"files": [
+4 -1
View File
@@ -1,13 +1,16 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "text-field",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/text-field",
deps = [
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/coercion",
"//src/cdk/platform",
],
+6 -3
View File
@@ -1,18 +1,21 @@
package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "tree",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/tree",
deps = [
"@angular//packages/common",
"@angular//packages/core",
"@rxjs",
"@rxjs//operators",
"//src/cdk/a11y",
"//src/cdk/bidi",
"//src/cdk/coercion",
"//src/cdk/collections",
"@rxjs",
],
tsconfig = "//src/cdk:tsconfig-build.json",
)
+1 -1
View File
@@ -24,7 +24,7 @@
"target": "es2015",
"lib": ["es2015", "dom"],
"skipLibCheck": true,
"types": ["jasmine", "tslib"],
"types": ["tslib"],
"paths": {
"@angular/cdk/*": ["../../dist/packages/cdk/*"]
}
+12 -12
View File
@@ -20,14 +20,14 @@ ts_library(
]),
deps = [
"//src/cdk/schematics",
"@npm//:@angular-devkit/schematics",
"@npm//:@schematics/angular",
"@npm//@angular-devkit/schematics",
"@npm//@schematics/angular",
# TODO(devversion): Only include jasmine for test sources (See: tsconfig types).
"@npm//:@types/jasmine",
"@npm//:@types/node",
"@npm//:parse5",
"@npm//:tslint",
"@npm//:typescript",
"@npm//@types/jasmine",
"@npm//@types/node",
"@npm//parse5",
"@npm//tslint",
"@npm//typescript",
],
tsconfig = ":tsconfig.json",
)
@@ -54,11 +54,11 @@ ts_library(
deps = [
":schematics",
"//src/cdk/schematics",
"@npm//:@schematics/angular",
"@npm//:@angular-devkit/schematics",
"@npm//:@types/jasmine",
"@npm//:@types/node",
"@npm//:fs-extra",
"@npm//@schematics/angular",
"@npm//@angular-devkit/schematics",
"@npm//@types/jasmine",
"@npm//@types/node",
"@npm//fs-extra",
],
tsconfig = ":tsconfig.json",
testonly = True,