build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871)

PR Close #28871
This commit is contained in:
Greg Magolan
2019-02-20 09:54:42 -08:00
committed by Andrew Kushnir
parent cd83a43462
commit ea09430039
220 changed files with 660 additions and 781 deletions

View File

@ -21,8 +21,6 @@ npm_package(
replacements = {
"(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "",
"//packages/bazel/": "//",
"@ngdeps//": "@npm//",
"@angular//:@angular/bazel/ngc-wrapped": "@npm//@angular/bazel/bin:ngc-wrapped",
"angular/packages/bazel/": "npm_angular_bazel/",
},
tags = ["release-with-framework"],

View File

@ -5,7 +5,6 @@ skylark_doc(
srcs = [
"//packages/bazel/src:ng_module.bzl",
"//packages/bazel/src:ng_rollup_bundle.bzl",
"//packages/bazel/src:ng_setup_workspace.bzl",
"//packages/bazel/src/ng_package:ng_package.bzl",
"//packages/bazel/src/protractor:protractor_web_test.bzl",
],

View File

@ -14,12 +14,17 @@ load(
_protractor_web_test_suite = "protractor_web_test_suite",
)
load("//packages/bazel/src:ng_module.bzl", _ng_module = "ng_module")
load("//packages/bazel/src:ng_setup_workspace.bzl", _ng_setup_workspace = "ng_setup_workspace")
ng_module = _ng_module
ng_package = _ng_package
protractor_web_test = _protractor_web_test
protractor_web_test_suite = _protractor_web_test_suite
ng_setup_workspace = _ng_setup_workspace
# DO NOT ADD PUBLIC API without including in the documentation generation
# Run `yarn bazel build //packages/bazel/docs` to verify
def ng_setup_workspace():
print("""DEPRECATION WARNING:
ng_setup_workspace is no longer needed, and will be removed in a future release.
We assume you will fetch rules_nodejs in your WORKSPACE file, and no other dependencies remain here.
Simply remove any calls to this function and the corresponding load statement.
""")

View File

@ -21,7 +21,7 @@
"@angular-devkit/architect": "^0.10.6",
"@angular-devkit/core": "^7.0.4",
"@angular-devkit/schematics": "^7.3.0-rc.0",
"@bazel/typescript": "^0.26.0-beta.0",
"@bazel/typescript": "^0.26.0",
"@microsoft/api-extractor": "^7.0.17",
"@schematics/angular": "^7.0.4",
"@types/node": "6.0.84",

View File

@ -13,13 +13,13 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
nodejs_binary(
name = "rollup_with_build_optimizer",
data = [
"@ngdeps//@angular-devkit/build-optimizer",
"@ngdeps//is-builtin-module",
"@ngdeps//rollup",
"@ngdeps//rollup-plugin-node-resolve",
"@ngdeps//rollup-plugin-sourcemaps",
"@npm//@angular-devkit/build-optimizer",
"@npm//is-builtin-module",
"@npm//rollup",
"@npm//rollup-plugin-node-resolve",
"@npm//rollup-plugin-sourcemaps",
],
entry_point = "ngdeps/node_modules/rollup/bin/rollup",
entry_point = "npm/node_modules/rollup/bin/rollup",
install_source_map_support = False,
visibility = ["//visibility:public"],
)

View File

@ -11,9 +11,9 @@ ts_library(
"index.ts",
],
deps = [
"@ngdeps//@bazel/typescript",
"@ngdeps//@microsoft/api-extractor",
"@ngdeps//@types/node",
"@npm//@bazel/typescript",
"@npm//@microsoft/api-extractor",
"@npm//@types/node",
],
)
@ -22,8 +22,8 @@ nodejs_binary(
name = "api_extractor",
data = [
":lib",
"@ngdeps//@bazel/typescript",
"@ngdeps//@microsoft/api-extractor",
"@npm//@bazel/typescript",
"@npm//@microsoft/api-extractor",
],
entry_point = "angular/packages/bazel/src/api-extractor/index.js",
visibility = ["//visibility:public"],

View File

@ -22,9 +22,9 @@ ts_library(
],
module_name = "@angular/bazel/src/builders",
deps = [
"@ngdeps//@angular-devkit/architect",
"@ngdeps//@angular-devkit/core",
"@ngdeps//@types/node",
"@ngdeps//rxjs",
"@npm//@angular-devkit/architect",
"@npm//@angular-devkit/core",
"@npm//@types/node",
"@npm//rxjs",
],
)

View File

@ -33,7 +33,7 @@ compile_ts = _compile_ts
DEPS_ASPECTS = _DEPS_ASPECTS
ts_providers_dict_to_struct = _ts_providers_dict_to_struct
DEFAULT_NG_COMPILER = "@angular//:@angular/bazel/ngc-wrapped"
DEFAULT_NG_COMPILER = "@npm//@angular/bazel/bin:ngc-wrapped"
DEFAULT_NG_XI18N = "@npm//@angular/bazel/bin:xi18n"
FLAT_DTS_FILE_SUFFIX = ".bundle.d.ts"
TsConfigInfo = _TsConfigInfo

View File

@ -3,16 +3,16 @@ package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
# BEGIN-DEV-ONLY
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
ts_library(
name = "lib",
srcs = glob(["*.ts"]),
node_modules = "@ngdeps//typescript:typescript__typings",
node_modules = "@npm//typescript:typescript__typings",
tsconfig = ":tsconfig.json",
deps = [
"@ngdeps//@types/node",
"@ngdeps//@types/shelljs",
"@npm//@types/node",
"@npm//@types/shelljs",
],
)
@ -21,7 +21,7 @@ nodejs_binary(
name = "packager",
data = [
"lib",
"@ngdeps//shelljs",
"@npm//shelljs",
],
entry_point = "angular/packages/bazel/src/ng_package/packager.js",
install_source_map_support = False,

View File

@ -43,7 +43,7 @@ PACKAGES = [
PLUGIN_CONFIG = "{sideEffectFreeModules: [\n%s]}" % ",\n".join(
[" '.esm5/{0}'".format(p) for p in PACKAGES],
)
BO_ROLLUP = "ngdeps/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/rollup-plugin.js"
BO_ROLLUP = "npm/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/rollup-plugin.js"
BO_PLUGIN = "require('%s').default(%s)" % (BO_ROLLUP, PLUGIN_CONFIG)
def _use_plain_rollup(ctx):

View File

@ -1,13 +0,0 @@
# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.io/license
"Install toolchain dependencies"
def ng_setup_workspace():
"""This repository rule should be called from your WORKSPACE file.
It creates some additional Bazel external repositories that are used internally
by the Angular rules.
"""

View File

@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
ts_library(
name = "ngc_lib",
@ -8,7 +8,7 @@ ts_library(
"index.ts",
],
module_name = "@angular/bazel",
node_modules = "@ngdeps//typescript:typescript__typings",
node_modules = "@npm//typescript:typescript__typings",
tsconfig = ":tsconfig.json",
visibility = [
"//packages/bazel:__pkg__",
@ -20,10 +20,10 @@ ts_library(
# Users will get this dependency from node_modules.
"//packages/compiler-cli",
# END-INTERNAL
"@ngdeps//@bazel/typescript",
"@ngdeps//@types/node",
"@ngdeps//tsickle",
"@ngdeps//typescript",
"@npm//@bazel/typescript",
"@npm//@types/node",
"@npm//tsickle",
"@npm//typescript",
],
)
@ -33,8 +33,8 @@ nodejs_binary(
data = [
":ngc_lib",
"//packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto",
"@ngdeps//source-map-support",
"@ngdeps//tslib",
"@npm//source-map-support",
"@npm//tslib",
],
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js",
visibility = ["//visibility:public"],
@ -44,7 +44,7 @@ nodejs_binary(
name = "xi18n",
data = [
":ngc_lib",
"@ngdeps//source-map-support",
"@npm//source-map-support",
],
entry_point = "angular/packages/bazel/src/ngc-wrapped/extract_i18n.js",
visibility = ["//visibility:public"],

View File

@ -1,12 +1,12 @@
package(default_visibility = ["//visibility:public"])
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
ts_library(
name = "utils",
srcs = ["index.ts"],
module_name = "@angular/bazel/protractor-utils",
node_modules = "@ngdeps//typescript:typescript__typings",
node_modules = "@npm//typescript:typescript__typings",
tsconfig = ":tsconfig.json",
deps = ["@ngdeps//@types/node"],
deps = ["@npm//@types/node"],
)

View File

@ -12,9 +12,9 @@ ts_library(
"schema.json",
],
deps = [
"@ngdeps//@angular-devkit/core",
"@ngdeps//@angular-devkit/schematics",
"@ngdeps//@schematics/angular",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@schematics/angular",
],
)
@ -29,6 +29,6 @@ ts_library(
],
deps = [
":bazel-workspace",
"@ngdeps//@angular-devkit/schematics",
"@npm//@angular-devkit/schematics",
],
)

View File

@ -55,11 +55,9 @@ web_test_repositories()
load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")
browser_repositories()
load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
ts_setup_workspace()
<% if (sass) { %>
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories()
<% } %>
load("@npm_angular_bazel//:index.bzl", "ng_setup_workspace")
ng_setup_workspace()

View File

@ -1,4 +1,4 @@
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite")
ts_library(

View File

@ -1,10 +1,10 @@
package(default_visibility = ["//visibility:public"])
load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm_bazel_karma//:defs.bzl", "ts_web_test_suite")
load("@npm_bazel_karma//:index.bzl", "ts_web_test_suite")
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "history_server")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_devserver", "ts_library")
<% if (sass) { %>load("@io_bazel_rules_sass//:defs.bzl", "multi_sass_binary")
multi_sass_binary(

View File

@ -57,8 +57,8 @@ export default function(options: BazelWorkspaceOptions): Rule {
}
const workspaceVersions = {
'RULES_NODEJS_VERSION': '0.18.6',
'RULES_NODEJS_SHA256': '1416d03823fed624b49a0abbd9979f7c63bbedfd37890ddecedd2fe25cccebc6',
'RULES_NODEJS_VERSION': '0.26.0',
'RULES_NODEJS_SHA256': '5c86b055c57e15bf32d9009a15bcd6d8e190c41b1ff2fb18037b75e0012e4e7c',
'RULES_SASS_VERSION': '1.17.2',
'RULES_SASS_SHA256': 'e5316ee8a09d1cbb732d3938b400836bf94dba91a27476e9e27706c4c0edae1f',
};

View File

@ -14,10 +14,10 @@ ts_library(
deps = [
"//packages/bazel/src/schematics/bazel-workspace",
"//packages/bazel/src/schematics/utility",
"@ngdeps//@angular-devkit/core",
"@ngdeps//@angular-devkit/schematics",
"@ngdeps//@schematics/angular",
"@ngdeps//typescript",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@schematics/angular",
"@npm//typescript",
],
)
@ -32,6 +32,6 @@ ts_library(
],
deps = [
":ng-add",
"@ngdeps//@angular-devkit/schematics",
"@npm//@angular-devkit/schematics",
],
)

View File

@ -46,7 +46,7 @@ function addDevDependenciesToPackageJson(options: Schema) {
'@angular/upgrade': angularCoreVersion,
'@bazel/bazel': '^0.22.1',
'@bazel/ibazel': '^0.9.0',
'@bazel/karma': '^0.25.1',
'@bazel/karma': '^0.26.0',
};
const recorder = host.beginUpdate(packageJson);

View File

@ -13,8 +13,8 @@ ts_library(
],
deps = [
"//packages/bazel/src/schematics/ng-add",
"@ngdeps//@angular-devkit/schematics",
"@ngdeps//@schematics/angular",
"@npm//@angular-devkit/schematics",
"@npm//@schematics/angular",
],
)
@ -29,6 +29,6 @@ ts_library(
],
deps = [
":ng-new",
"@ngdeps//@angular-devkit/schematics",
"@npm//@angular-devkit/schematics",
],
)

View File

@ -9,10 +9,10 @@ ts_library(
],
module_name = "@angular/bazel/src/schematics/utility",
deps = [
"@ngdeps//@angular-devkit/core",
"@ngdeps//@angular-devkit/schematics",
"@ngdeps//@schematics/angular",
"@ngdeps//typescript",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
"@npm//@schematics/angular",
"@npm//typescript",
],
)
@ -24,7 +24,7 @@ ts_library(
],
deps = [
":utility",
"@ngdeps//@angular-devkit/core",
"@ngdeps//@angular-devkit/schematics",
"@npm//@angular-devkit/core",
"@npm//@angular-devkit/schematics",
],
)

View File

@ -13,7 +13,7 @@ ts_library(
deps = [
"//packages:types",
"//packages/private/testing",
"@ngdeps//@types/shelljs",
"@npm//@types/shelljs",
],
)
@ -22,8 +22,8 @@ jasmine_node_test(
srcs = [":core_spec_lib"],
data = [
"//packages/core:npm_package",
"@ngdeps//@types/shelljs",
"@ngdeps//shelljs",
"@npm//@types/shelljs",
"@npm//shelljs",
],
)
@ -34,7 +34,7 @@ ts_library(
deps = [
"//packages:types",
"//packages/private/testing",
"@ngdeps//@types/shelljs",
"@npm//@types/shelljs",
],
)
@ -43,7 +43,7 @@ jasmine_node_test(
srcs = [":common_spec_lib"],
data = [
"//packages/common:npm_package",
"@ngdeps//shelljs",
"@npm//shelljs",
],
)
@ -53,7 +53,7 @@ ts_library(
srcs = ["example_package.spec.ts"],
deps = [
"//packages:types",
"@ngdeps//@types/diff",
"@npm//@types/diff",
],
)
@ -68,7 +68,7 @@ jasmine_node_test(
# file is based on non-ivy output and therefore won't work for ngc and Ivy at the same time.
# TODO: We should be able to have another golden for ivy-aot as well.
tags = ["no-ivy-aot"],
deps = ["@ngdeps//diff"],
deps = ["@npm//diff"],
)
nodejs_binary(
@ -78,7 +78,7 @@ nodejs_binary(
"example_package.golden",
":example_spec_lib",
"//packages/bazel/test/ng_package/example:npm_package",
"@ngdeps//diff",
"@npm//diff",
],
entry_point = "angular/packages/bazel/test/ng_package/example_package.spec.js",
templated_args = ["--accept"],

View File

@ -9,7 +9,7 @@ ng_module(
module_name = "example",
deps = [
"//packages/bazel/test/ng_package/example/secondary",
"@ngdeps//@types",
"@npm//@types",
],
)

View File

@ -9,6 +9,6 @@ ng_module(
module_name = "example/secondary",
deps = [
"//packages/core",
"@ngdeps//@types",
"@npm//@types",
],
)

View File

@ -12,7 +12,7 @@ ts_library(
deps = [
"//packages/bazel/src/ngc-wrapped:ngc_lib",
"//packages/compiler-cli",
"@ngdeps//typescript",
"@npm//typescript",
],
)

View File

@ -8,6 +8,6 @@ ng_module(
tsconfig = ":tsconfig.json",
deps = [
"//packages/core",
"@ngdeps//@types",
"@npm//@types",
],
)

View File

@ -71,7 +71,7 @@ export function createTsConfig(options: TsConfigOptions) {
'tsickleExternsPath': '',
// we don't copy the node_modules into our tmp dir, so we should look in
// the original workspace directory for it
'nodeModulesPrefix': '../ngdeps/node_modules',
'nodeModulesPrefix': '../npm/node_modules',
},
'files': options.files,
'angularCompilerOptions': {

View File

@ -1,5 +1,5 @@
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")
load("@build_bazel_rules_nodejs//:defs.bzl", "http_server", "rollup_bundle")
load("//tools:defaults.bzl", "ts_library")
@ -36,8 +36,8 @@ ts_library(
srcs = ["test.spec.ts"],
tsconfig = ":tsconfig.test.json",
deps = [
"@ngdeps//@types/selenium-webdriver",
"@ngdeps//protractor",
"@npm//@types/selenium-webdriver",
"@npm//protractor",
],
)
@ -49,7 +49,7 @@ protractor_web_test_suite(
server = ":prodserver",
deps = [
":ts_spec",
"@ngdeps//protractor",
"@npm//protractor",
],
)
@ -61,6 +61,6 @@ protractor_web_test_suite(
server = ":devserver",
deps = [
":ts_spec",
"@ngdeps//protractor",
"@npm//protractor",
],
)

View File

@ -14,7 +14,7 @@ nodejs_binary(
testonly = True,
data = [
"fake-devserver.js",
"@ngdeps//minimist",
"@npm//minimist",
],
entry_point = "angular/packages/bazel/test/protractor-utils/fake-devserver.js",
)

View File

@ -7,8 +7,8 @@ ts_library(
srcs = ["test.spec.ts"],
tsconfig = ":tsconfig.json",
deps = [
"@ngdeps//@types/selenium-webdriver",
"@ngdeps//protractor",
"@npm//@types/selenium-webdriver",
"@npm//protractor",
],
)
@ -19,7 +19,7 @@ ts_library(
tsconfig = ":tsconfig.json",
deps = [
"//packages/bazel/src/protractor/utils",
"@ngdeps//protractor",
"@npm//protractor",
],
)
@ -29,6 +29,6 @@ protractor_web_test_suite(
data = ["//packages/bazel/src/protractor/utils"],
deps = [
":ts_spec",
"@ngdeps//protractor",
"@npm//protractor",
],
)