Skip to content

feat(schematics): CDK support for ng add #13319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2018
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
12 changes: 4 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
# To validate changes, use an online parser, eg.
# http://yaml-online-parser.appspot.com/

## IMPORTANT
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
var_1: &docker_image angular/ngcontainer:0.3.3
var_2: &cache_key v2-ng-mat-{{ .Branch }}-{{ checksum "package-lock.json" }}-0.3.3
var_1: &docker_image angular/ngcontainer:0.6.0
var_2: &cache_key v2-ng-mat-{{ .Branch }}-{{ checksum "package-lock.json" }}-0.6.0

# Define common ENV vars
var_3: &define_env_vars
Expand Down Expand Up @@ -48,9 +45,8 @@ jobs:
- restore_cache:
key: *cache_key

- run: bazel run @nodejs//:npm install
# TODO(jelbourn): Update this command to run all tests if the Bazel issues have been fixed.
- run: bazel test src/lib/schematics:unit_tests
# TODO(jelbourn): Update this command to run all tests if the Bazel issues have been fixed.
- run: bazel test src/{cdk,lib}/schematics:unit_tests

- save_cache:
key: *cache_key
Expand Down
44 changes: 4 additions & 40 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,13 @@ package(default_visibility = ["//visibility:public"])

# TODO(jelbourn): figure out if these workarounds are still needed

# This rule belongs in node_modules/BUILD
# It's here as a workaround for
# https://github.com/bazelbuild/bazel/issues/374#issuecomment-296217940
filegroup(
# TODO: Replace with fine-grained node_modules using `npm_install` / `yarn_install`.
# TODO: See https://github.com/bazelbuild/rules_nodejs/wiki#migrating-to-rules_nodejs-013
alias(
name = "node_modules",
# Performance workaround: list individual files
# Reduces the number of files as inputs to nodejs_binary:
# bazel query "deps(:node_modules)" | wc -l
# This won't scale in the general case.
# TODO(alexeagle): figure out what to do
srcs = glob(["/".join(["node_modules", pkg, "**", ext]) for pkg in [
"@angular",
"@angular-devkit",
"@schematics",
"@types",
"bytebuffer",
"hammerjs",
"jasmine",
"minimist",
"moment",
"parse5",
"protobufjs",
"protractor",
"reflect-metadata",
"rxjs",
"tsickle",
"tslib",
"tslint",
"typescript",
"zone.js",
] for ext in [
"*.js",
"*.json",
"*.d.ts",
]] + [
"node_modules/http-server/**",
# Reference all files of the "@schematics/angular" package because the schematic
# tests depend on the template files of the angular schematics.
"node_modules/@schematics/angular/**",
]),
actual = "@npm//:node_modules",
)


# Glob pattern that matches all Angular testing bundles.
ANGULAR_TESTING = [
"node_modules/@angular/*/bundles/*-testing.umd.js",
Expand Down
62 changes: 32 additions & 30 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,44 +1,52 @@
workspace(name = "angular_material")

# Add nodejs rules
# Load NodeJS rules. Note that this is technically not needed because
# `rules_typescript_dependencies()` would also load the NodeJS rules, but we specifically need
# at least v0.14.1 which includes: https://github.com/bazelbuild/rules_nodejs/pull/341
http_archive(
name = "build_bazel_rules_nodejs",
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.10.1.zip",
strip_prefix = "rules_nodejs-0.10.1",
sha256 = "634206524d90dc03c52392fa3f19a16637d2bcf154910436fe1d669a0d9d7b9c",
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.14.1.zip",
strip_prefix = "rules_nodejs-0.14.1",
sha256 = "813eb51733d3632f456f3bb581d940ed64e80dab417595c93bf5ad19079898e2"
)

# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
# your npm dependencies. You must still run the package manager.
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
# Add TypeScript rules
http_archive(
name = "build_bazel_rules_typescript",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.18.0.zip",
strip_prefix = "rules_typescript-0.18.0",
sha256 = "4726e07a2f8d23b5e3af166f3b2a6e8aa75adad94b35ab4d959e8fe875f90272",
)

check_bazel_version("0.15.0")
node_repositories(package_json = ["//:package.json"])
# Fetch transient dependencies of the TypeScript bazel rules.
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()

# Add sass rules
http_archive(
name = "io_bazel_rules_sass",
url = "https://github.com/bazelbuild/rules_sass/archive/0.1.0.zip",
strip_prefix = "rules_sass-0.1.0",
sha256 = "b243c4d64f054c174051785862ab079050d90b37a1cef7da93821c6981cb9ad4",
url = "https://github.com/bazelbuild/rules_sass/archive/1.13.4.zip",
strip_prefix = "rules_sass-1.13.4",
sha256 = "5ddde0d3df96978fa537f76e766538c031dee4d29f91a895f4b1345b5e3f9b16",
)

load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories()

# Add TypeScript rules
http_archive(
name = "build_bazel_rules_typescript",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.15.1.zip",
strip_prefix = "rules_typescript-0.15.1",
sha256 = "3792cc20ef13bb1d1d8b1760894c3320f02a87843e3a04fed7e8e454a75328b6",
)
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
# your npm dependencies. You must still run the package manager.
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories",
"npm_install")

http_archive(
name = "io_bazel_rules_webtesting",
url = "https://github.com/bazelbuild/rules_webtesting/archive/7ffe970bbf380891754487f66c3d680c087d67f2.zip",
strip_prefix = "rules_webtesting-7ffe970bbf380891754487f66c3d680c087d67f2",
sha256 = "4fb0dca8c9a90547891b7ef486592775a523330fc4555c88cd8f09270055c2ce",
check_bazel_version("0.15.0")
node_repositories()

# Use Bazel managed node modules. See more below:
# https://github.com/bazelbuild/rules_nodejs#bazel-managed-vs-self-managed-dependencies
npm_install(
name = "npm",
package_json = "//:package.json",
package_lock_json = "//:package-lock.json",
)

# Setup TypeScript Bazel workspace
Expand All @@ -56,9 +64,3 @@ local_repository(
name = "rxjs",
path = "node_modules/rxjs/src",
)


# This commit matches the version of buildifier in angular/ngcontainer
# If you change this, also check if it matches the version in the angular/ngcontainer
# version in /.circleci/config.yml
BAZEL_BUILDTOOLS_VERSION = "82b21607e00913b16fe1c51bec80232d9d6de31c"
Loading