build(bazel): fine-grained npm deps and idiomatic install of @angular/bazel (#26607)
PR Close #26607
This commit is contained in:

committed by
Alex Rickabaugh

parent
81e571b908
commit
c251a5a4d1
@ -11,6 +11,10 @@ load("//tools:defaults.bzl", "ts_library")
|
||||
ts_library(
|
||||
name = "types",
|
||||
srcs = glob(["*.ts"]),
|
||||
deps = [
|
||||
"@ngdeps//@types/hammerjs",
|
||||
"@ngdeps//zone.js",
|
||||
],
|
||||
)
|
||||
|
||||
exports_files([
|
||||
|
@ -1,25 +1,20 @@
|
||||
load("//tools:defaults.bzl", "npm_package")
|
||||
|
||||
genrule(
|
||||
name = "workspace",
|
||||
outs = ["WORKSPACE"],
|
||||
cmd = "echo 'workspace(name=\"angular\")' > $@",
|
||||
)
|
||||
|
||||
npm_package(
|
||||
name = "npm_package",
|
||||
srcs = [
|
||||
"BUILD.bazel",
|
||||
"index.bzl",
|
||||
"check_version.js",
|
||||
"package.json",
|
||||
"protractor-utils.js",
|
||||
"//packages/bazel/src:package_assets",
|
||||
],
|
||||
packages = ["//packages/bazel/docs"],
|
||||
# Re-host //packages/bazel/ which is just // in the public distro
|
||||
replacements = {
|
||||
"//packages/bazel/": "//",
|
||||
"angular/packages/bazel/": "angular/",
|
||||
},
|
||||
packages = [
|
||||
"//packages/bazel/docs",
|
||||
],
|
||||
tags = ["release-with-framework"],
|
||||
deps = [":workspace"],
|
||||
deps = [
|
||||
"//packages/bazel/src/ng_package:lib",
|
||||
"//packages/bazel/src/ngc-wrapped:ngc_lib",
|
||||
"//packages/bazel/src/protractor/utils",
|
||||
],
|
||||
)
|
||||
|
74
packages/bazel/check_version.js
Normal file
74
packages/bazel/check_version.js
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @license
|
||||
* 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
|
||||
*/
|
||||
/**
|
||||
* @fileoverview This script runs as a postinstall in the published npm packages
|
||||
* and checks that the version of the build_bazel_rules_typescript external
|
||||
* repository matches that of the published npm package.
|
||||
*
|
||||
* Note, this check is only performed with bazel managed deps when the yarn or
|
||||
* npm install is from a yarn_install or npm_install repository rule. For self
|
||||
* managed bazel deps this check is not performed and it is the responsibility
|
||||
* of the user to ensure that the versions match.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
// Version in package.bzl should match the npm package version
|
||||
// but this should be tolerant of development stamped versions such as
|
||||
// "0.17.0-7-g76dc057"
|
||||
const npmPackageVersion = process.env.npm_package_version.split('-')[0];
|
||||
|
||||
// If this is a bazel managed deps yarn_install or npm_install then the
|
||||
// cwd is $(bazel info
|
||||
// output_base)/external/<wksp>/node_modules/@angular/bazel and there should
|
||||
// be $(bazel info output_base)/external/<wksp>/internal/generate_build_file.js
|
||||
// folder
|
||||
function isBazelManagedDeps() {
|
||||
try {
|
||||
fs.statSync('../../../generate_build_file.js');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isBazelManagedDeps()) {
|
||||
let contents;
|
||||
try {
|
||||
// If this is a yarn_install or npm_install then the cwd is $(bazel info
|
||||
// output_base)/external/<wksp>/node_modules/@angular/bazel so we can look for
|
||||
// the package.json file under $(bazel info
|
||||
// output_base)/external/angular/package.json
|
||||
const packagePath = path.resolve(process.cwd(), '../../../../angular/package.json');
|
||||
contents = require(packagePath);
|
||||
} catch (e) {
|
||||
throw new Error('The angular repository is not installed in your Bazel WORKSPACE file');
|
||||
}
|
||||
if (contents.name !== 'angular-srcs') {
|
||||
throw new Error('Invalid package.json in angular repository');
|
||||
}
|
||||
// Be tolerant of versions such as "0.17.0-7-g76dc057"
|
||||
const angularPackageVersion = contents.version.split('-')[0];
|
||||
if (npmPackageVersion !== angularPackageVersion) {
|
||||
// TODO: we might need to support a range here.
|
||||
// For example, if you end up with @angular/bazel@6.1.8 and
|
||||
// @angular/bazel@6.1.9 both installed one of the postinstalls is
|
||||
// guaranteed to fail since there's only one version of
|
||||
// angular
|
||||
throw new Error(`Expected angular repository to be version ${
|
||||
npmPackageVersion} but found ${angularPackageVersion}`);
|
||||
}
|
||||
} else {
|
||||
// No version check
|
||||
console.warn(`WARNING: With self managed deps you must ensure the @angular/bazel
|
||||
npm package version matches the angular repository version.
|
||||
Use yarn_install or npm_install for this version to be checked automatically.
|
||||
`);
|
||||
}
|
114
packages/bazel/package.bzl
Normal file
114
packages/bazel/package.bzl
Normal file
@ -0,0 +1,114 @@
|
||||
# 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
|
||||
|
||||
"""Package file which defines dependencies of Angular rules in skylark
|
||||
"""
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load(":rules_nodejs_package.bzl", "rules_nodejs_dependencies")
|
||||
load(":rules_typescript_package.bzl", "rules_typescript_dependencies")
|
||||
|
||||
def rules_angular_dependencies():
|
||||
"""
|
||||
Fetch our transitive dependencies.
|
||||
|
||||
If the user wants to get a different version of these, they can just fetch it
|
||||
from their WORKSPACE before calling this function, or not call this function at all.
|
||||
"""
|
||||
|
||||
#
|
||||
# Download Bazel toolchain dependencies as needed by build actions
|
||||
#
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "build_bazel_rules_typescript",
|
||||
url = "https://github.com/bazelbuild/rules_typescript/archive/0.20.3.zip",
|
||||
strip_prefix = "rules_typescript-0.20.3",
|
||||
)
|
||||
|
||||
# Needed for Remote Execution
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "bazel_toolchains",
|
||||
sha256 = "c3b08805602cd1d2b67ebe96407c1e8c6ed3d4ce55236ae2efe2f1948f38168d",
|
||||
strip_prefix = "bazel-toolchains-5124557861ebf4c0b67f98180bff1f8551e0b421",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/5124557861ebf4c0b67f98180bff1f8551e0b421.tar.gz",
|
||||
"https://github.com/bazelbuild/bazel-toolchains/archive/5124557861ebf4c0b67f98180bff1f8551e0b421.tar.gz",
|
||||
],
|
||||
)
|
||||
|
||||
rules_typescript_dependencies()
|
||||
rules_nodejs_dependencies()
|
||||
|
||||
def rules_angular_dev_dependencies():
|
||||
"""
|
||||
Fetch dependencies needed for local development, but not needed by users.
|
||||
|
||||
These are in this file to keep version information in one place, and make the WORKSPACE
|
||||
shorter.
|
||||
"""
|
||||
|
||||
# We have a source dependency on the Devkit repository, because it's built with
|
||||
# Bazel.
|
||||
# This allows us to edit sources and have the effect appear immediately without
|
||||
# re-packaging or "npm link"ing.
|
||||
# Even better, things like aspects will visit the entire graph including
|
||||
# ts_library rules in the devkit repository.
|
||||
http_archive(
|
||||
name = "angular_cli",
|
||||
sha256 = "8cf320ea58c321e103f39087376feea502f20eaf79c61a4fdb05c7286c8684fd",
|
||||
strip_prefix = "angular-cli-6.1.0-rc.0",
|
||||
url = "https://github.com/angular/angular-cli/archive/v6.1.0-rc.0.zip",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "org_brotli",
|
||||
sha256 = "774b893a0700b0692a76e2e5b7e7610dbbe330ffbe3fe864b4b52ca718061d5a",
|
||||
strip_prefix = "brotli-1.0.5",
|
||||
url = "https://github.com/google/brotli/archive/v1.0.5.zip",
|
||||
)
|
||||
|
||||
# Fetching the Bazel source code allows us to compile the Skylark linter
|
||||
http_archive(
|
||||
name = "io_bazel",
|
||||
sha256 = "978f7e0440dd82182563877e2e0b7c013b26b3368888b57837e9a0ae206fd396",
|
||||
strip_prefix = "bazel-0.18.0",
|
||||
url = "https://github.com/bazelbuild/bazel/archive/0.18.0.zip",
|
||||
)
|
||||
|
||||
# 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 = "49a6c199e3fbf5d94534b2771868677d3f9c6de9"
|
||||
|
||||
http_archive(
|
||||
name = "com_github_bazelbuild_buildtools",
|
||||
sha256 = "edf39af5fc257521e4af4c40829fffe8fba6d0ebff9f4dd69a6f8f1223ae047b",
|
||||
strip_prefix = "buildtools-%s" % BAZEL_BUILDTOOLS_VERSION,
|
||||
url = "https://github.com/bazelbuild/buildtools/archive/%s.zip" % BAZEL_BUILDTOOLS_VERSION,
|
||||
)
|
||||
|
||||
#############################################
|
||||
# Dependencies for generating documentation #
|
||||
#############################################
|
||||
http_archive(
|
||||
name = "io_bazel_rules_sass",
|
||||
sha256 = "dbe9fb97d5a7833b2a733eebc78c9c1e3880f676ac8af16e58ccf2139cbcad03",
|
||||
strip_prefix = "rules_sass-1.11.0",
|
||||
url = "https://github.com/bazelbuild/rules_sass/archive/1.11.0.zip",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "io_bazel_skydoc",
|
||||
sha256 = "7bfb5545f59792a2745f2523b9eef363f9c3e7274791c030885e7069f8116016",
|
||||
strip_prefix = "skydoc-fe2e9f888d28e567fef62ec9d4a93c425526d701",
|
||||
# TODO: switch to upstream when https://github.com/bazelbuild/skydoc/pull/103 is merged
|
||||
url = "https://github.com/alexeagle/skydoc/archive/fe2e9f888d28e567fef62ec9d4a93c425526d701.zip",
|
||||
)
|
||||
|
||||
def _maybe(repo_rule, name, **kwargs):
|
||||
if name not in native.existing_rules():
|
||||
repo_rule(name = name, **kwargs)
|
@ -4,10 +4,18 @@
|
||||
"description": "Angular - bazel build rules",
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"ngc-wrapped": "./src/ngc-wrapped/index.js",
|
||||
"packager": "./src/ng_package/packager.js",
|
||||
"xi18n": "./src/ngc-wrapped/extract_i18n.js",
|
||||
"modify_tsconfig": "./src/modify_tsconfig.js"
|
||||
},
|
||||
"typings": "./src/ngc-wrapped/index.d.ts",
|
||||
"dependencies": {
|
||||
"@bazel/typescript": "^0.15.0",
|
||||
"@bazel/typescript": "^0.20.3",
|
||||
"@types/node": "6.0.84",
|
||||
"protobufjs": "5.0.0"
|
||||
"shelljs": "0.8.2",
|
||||
"tsickle": "0.32.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
|
||||
@ -19,5 +27,8 @@
|
||||
},
|
||||
"ng-update": {
|
||||
"packageGroup": "NG_UPDATE_PACKAGE_GROUP"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./check_version.js"
|
||||
}
|
||||
}
|
||||
|
9
packages/bazel/protractor-utils.js
Normal file
9
packages/bazel/protractor-utils.js
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @license
|
||||
* 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
|
||||
*/
|
||||
|
||||
module.exports = require('./src/protractor/utils');
|
56
packages/bazel/rules_nodejs_package.bzl
Normal file
56
packages/bazel/rules_nodejs_package.bzl
Normal file
@ -0,0 +1,56 @@
|
||||
# Copyright 2018 The Bazel Authors. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Dependency-related rules defining our version and dependency versions.
|
||||
|
||||
Fulfills similar role as the package.json file.
|
||||
"""
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
# This file mirrored from https://raw.githubusercontent.com/bazelbuild/rules_nodejs/0.15.1/package.bzl
|
||||
VERSION = "0.15.1"
|
||||
|
||||
def rules_nodejs_dependencies():
|
||||
"""
|
||||
Fetch our transitive dependencies.
|
||||
|
||||
If the user wants to get a different version of these, they can just fetch it
|
||||
from their WORKSPACE before calling this function, or not call this function at all.
|
||||
"""
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "bazel_skylib",
|
||||
url = "https://github.com/bazelbuild/bazel-skylib/archive/0.3.1.zip",
|
||||
strip_prefix = "bazel-skylib-0.3.1",
|
||||
sha256 = "95518adafc9a2b656667bbf517a952e54ce7f350779d0dd95133db4eb5c27fb1",
|
||||
)
|
||||
|
||||
# Needed for Remote Build Execution
|
||||
# See https://releases.bazel.build/bazel-toolchains.html
|
||||
# Not strictly a dependency for all users, but it is convenient for them to have this repository
|
||||
# defined to reduce the effort required to on-board to remote execution.
|
||||
http_archive(
|
||||
name = "bazel_toolchains",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/cdea5b8675914d0a354d89f108de5d28e54e0edc.tar.gz",
|
||||
"https://github.com/bazelbuild/bazel-toolchains/archive/cdea5b8675914d0a354d89f108de5d28e54e0edc.tar.gz",
|
||||
],
|
||||
strip_prefix = "bazel-toolchains-cdea5b8675914d0a354d89f108de5d28e54e0edc",
|
||||
sha256 = "cefb6ccf86ca592baaa029bcef04148593c0efe8f734542f10293ea58f170715",
|
||||
)
|
||||
|
||||
def _maybe(repo_rule, name, **kwargs):
|
||||
if name not in native.existing_rules():
|
||||
repo_rule(name = name, **kwargs)
|
94
packages/bazel/rules_typescript_package.bzl
Normal file
94
packages/bazel/rules_typescript_package.bzl
Normal file
@ -0,0 +1,94 @@
|
||||
# Copyright 2018 The Bazel Authors. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Package file which defines build_bazel_rules_typescript version in skylark
|
||||
|
||||
check_rules_typescript_version can be used in downstream WORKSPACES to check
|
||||
against a minimum dependent build_bazel_rules_typescript version.
|
||||
"""
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
# This file mirrored from https://raw.githubusercontent.com/bazelbuild/rules_typescript/0.20.3/package.bzl
|
||||
VERSION = "0.20.3"
|
||||
|
||||
def rules_typescript_dependencies():
|
||||
"""
|
||||
Fetch our transitive dependencies.
|
||||
|
||||
If the user wants to get a different version of these, they can just fetch it
|
||||
from their WORKSPACE before calling this function, or not call this function at all.
|
||||
"""
|
||||
|
||||
# TypeScript compiler runs on node.js runtime
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "build_bazel_rules_nodejs",
|
||||
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.15.1.zip"],
|
||||
strip_prefix = "rules_nodejs-0.15.1",
|
||||
)
|
||||
|
||||
# ts_web_test depends on the web testing rules to provision browsers.
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "io_bazel_rules_webtesting",
|
||||
urls = ["https://github.com/bazelbuild/rules_webtesting/archive/111d792b9a5b17f87b6e177e274dbbee46094791.zip"],
|
||||
strip_prefix = "rules_webtesting-111d792b9a5b17f87b6e177e274dbbee46094791",
|
||||
sha256 = "a13af63e928c34eff428d47d31bafeec4e38ee9b6940e70bf2c9cd47184c5c16",
|
||||
)
|
||||
|
||||
# ts_devserver depends on the Go rules.
|
||||
# See https://github.com/bazelbuild/rules_go#setup for the latest version.
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "io_bazel_rules_go",
|
||||
urls = ["https://github.com/bazelbuild/rules_go/archive/cbc1e32fba771845305f15e341fa26595d4a136d.zip"],
|
||||
strip_prefix = "rules_go-cbc1e32fba771845305f15e341fa26595d4a136d",
|
||||
sha256 = "d02b1d8d11fb67fb1e451645256e58a1542170eedd6e2ba160c8540c96f659da",
|
||||
)
|
||||
|
||||
# go_repository is defined in bazel_gazelle
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "bazel_gazelle",
|
||||
urls = ["https://github.com/bazelbuild/bazel-gazelle/archive/109bcfd6880aac2517a1a2d48987226da6337e11.zip"],
|
||||
strip_prefix = "bazel-gazelle-109bcfd6880aac2517a1a2d48987226da6337e11",
|
||||
sha256 = "8f80ce0f7a6f8a3fee1fb863c9a23e1de99d678c1cf3c6f0a128f3b883168208",
|
||||
)
|
||||
|
||||
# ts_auto_deps depends on com_github_bazelbuild_buildtools
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "com_github_bazelbuild_buildtools",
|
||||
url = "https://github.com/bazelbuild/buildtools/archive/0.12.0.zip",
|
||||
strip_prefix = "buildtools-0.12.0",
|
||||
sha256 = "ec495cbd19238c9dc488fd65ca1fee56dcb1a8d6d56ee69a49f2ebe69826c261",
|
||||
)
|
||||
|
||||
###############################################
|
||||
# Repeat the dependencies of rules_nodejs here!
|
||||
# We can't load() from rules_nodejs yet, because we've only just fetched it.
|
||||
# But we also don't want to make users load and call the rules_nodejs_dependencies
|
||||
# function because we can do that for them, mostly hiding the transitive dependency.
|
||||
_maybe(
|
||||
http_archive,
|
||||
name = "bazel_skylib",
|
||||
url = "https://github.com/bazelbuild/bazel-skylib/archive/0.5.0.zip",
|
||||
strip_prefix = "bazel-skylib-0.5.0",
|
||||
sha256 = "ca4e3b8e4da9266c3a9101c8f4704fe2e20eb5625b2a6a7d2d7d45e3dd4efffd",
|
||||
)
|
||||
|
||||
def _maybe(repo_rule, name, **kwargs):
|
||||
if name not in native.existing_rules():
|
||||
repo_rule(name = name, **kwargs)
|
@ -2,14 +2,13 @@ package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = glob(["*"]) + [
|
||||
"//packages/bazel/src/ng_package:package_assets",
|
||||
"//packages/bazel/src/ngc-wrapped:package_assets",
|
||||
"//packages/bazel/src/protractor:package_assets",
|
||||
],
|
||||
srcs = ["modify_tsconfig.js"],
|
||||
visibility = ["//packages/bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
# For generating skydoc
|
||||
exports_files(glob(["*.bzl"]))
|
||||
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
|
||||
|
||||
nodejs_binary(
|
||||
|
@ -80,12 +80,20 @@ def _esm5_outputs_aspect(target, ctx):
|
||||
],
|
||||
)
|
||||
|
||||
replay_compiler = target.typescript.replay_params.compiler.path.split("/")[-1]
|
||||
if replay_compiler == "tsc_wrapped":
|
||||
compiler = ctx.executable._tsc_wrapped
|
||||
elif replay_compiler == "ngc-wrapped":
|
||||
compiler = ctx.executable._ngc_wrapped
|
||||
else:
|
||||
fail("Unknown replay compiler", target.typescript.replay_params.compiler.path)
|
||||
|
||||
ctx.actions.run(
|
||||
progress_message = "Compiling TypeScript (ES5 with ES Modules) %s" % target.label,
|
||||
inputs = target.typescript.replay_params.inputs + [tsconfig],
|
||||
outputs = outputs,
|
||||
arguments = [tsconfig.path],
|
||||
executable = target.typescript.replay_params.compiler,
|
||||
executable = compiler,
|
||||
execution_requirements = {
|
||||
# TODO(alexeagle): enable worker mode for these compilations
|
||||
"supports-workers": "0",
|
||||
@ -122,15 +130,11 @@ esm5_outputs_aspect = aspect(
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
# We must list tsc_wrapped here to ensure it's built before the action runs
|
||||
# For some reason, having the compiler output as an input to the action above
|
||||
# is not sufficient.
|
||||
"_tsc_wrapped": attr.label(
|
||||
default = Label("@build_bazel_rules_typescript//internal:tsc_wrapped_bin"),
|
||||
default = Label("@build_bazel_rules_typescript//:@bazel/typescript/tsc_wrapped"),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
# Same comment as for tsc_wrapped above.
|
||||
"_ngc_wrapped": attr.label(
|
||||
default = Label("//packages/bazel/src/ngc-wrapped"),
|
||||
executable = True,
|
||||
|
@ -13,10 +13,20 @@ load(
|
||||
_compile_ts = "compile_ts",
|
||||
_ts_providers_dict_to_struct = "ts_providers_dict_to_struct",
|
||||
)
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//internal/common:node_module_info.bzl",
|
||||
_NodeModuleInfo = "NodeModuleInfo",
|
||||
_collect_node_modules_aspect = "collect_node_modules_aspect",
|
||||
)
|
||||
|
||||
NodeModuleInfo = _NodeModuleInfo
|
||||
collect_node_modules_aspect = _collect_node_modules_aspect
|
||||
tsc_wrapped_tsconfig = _tsc_wrapped_tsconfig
|
||||
COMMON_ATTRIBUTES = _COMMON_ATTRIBUTES
|
||||
COMMON_OUTPUTS = _COMMON_OUTPUTS
|
||||
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_XI18N = "@npm//@angular/bazel/bin:xi18n"
|
@ -6,10 +6,14 @@
|
||||
"""
|
||||
|
||||
load(
|
||||
":rules_typescript.bzl",
|
||||
":external.bzl",
|
||||
"COMMON_ATTRIBUTES",
|
||||
"COMMON_OUTPUTS",
|
||||
"DEFAULT_NG_COMPILER",
|
||||
"DEFAULT_NG_XI18N",
|
||||
"DEPS_ASPECTS",
|
||||
"NodeModuleInfo",
|
||||
"collect_node_modules_aspect",
|
||||
"compile_ts",
|
||||
"ts_providers_dict_to_struct",
|
||||
"tsc_wrapped_tsconfig",
|
||||
@ -357,7 +361,7 @@ def ngc_compile_action(
|
||||
ctx.actions.run(
|
||||
inputs = list(inputs),
|
||||
outputs = messages_out,
|
||||
executable = ctx.executable._ng_xi18n,
|
||||
executable = ctx.executable.ng_xi18n,
|
||||
arguments = (_EXTRA_NODE_OPTIONS_FLAGS +
|
||||
[tsconfig_file.path] +
|
||||
# The base path is bin_dir because of the way the ngc
|
||||
@ -379,23 +383,32 @@ def ngc_compile_action(
|
||||
|
||||
return None
|
||||
|
||||
def _filter_ts_inputs(all_inputs):
|
||||
# The compiler only needs to see TypeScript sources from the npm dependencies,
|
||||
# but may need to look at package.json and ngsummary.json files as well.
|
||||
return [
|
||||
f
|
||||
for f in all_inputs
|
||||
if f.path.endswith(".js") or f.path.endswith(".ts") or f.path.endswith(".json")
|
||||
]
|
||||
|
||||
def _compile_action(ctx, inputs, outputs, messages_out, tsconfig_file, node_opts):
|
||||
# Give the Angular compiler all the user-listed assets
|
||||
file_inputs = list(ctx.files.assets)
|
||||
|
||||
# The compiler only needs to see TypeScript sources from the npm dependencies,
|
||||
# but may need to look at package.json and ngsummary.json files as well.
|
||||
if hasattr(ctx.attr, "node_modules"):
|
||||
file_inputs += [
|
||||
f
|
||||
for f in ctx.files.node_modules
|
||||
if f.path.endswith(".ts") or f.path.endswith(".json")
|
||||
]
|
||||
file_inputs.extend(_filter_ts_inputs(ctx.files.node_modules))
|
||||
|
||||
# If the user supplies a tsconfig.json file, the Angular compiler needs to read it
|
||||
if hasattr(ctx.attr, "tsconfig") and ctx.file.tsconfig:
|
||||
file_inputs.append(ctx.file.tsconfig)
|
||||
|
||||
# Also include files from npm fine grained deps as action_inputs.
|
||||
# These deps are identified by the NodeModuleInfo provider.
|
||||
for d in ctx.attr.deps:
|
||||
if NodeModuleInfo in d:
|
||||
file_inputs.extend(_filter_ts_inputs(d.files))
|
||||
|
||||
# Collect the inputs and summary files from our deps
|
||||
action_inputs = depset(
|
||||
file_inputs,
|
||||
@ -443,6 +456,13 @@ def ng_module_impl(ctx, ts_compile_actions):
|
||||
providers = ts_compile_actions(
|
||||
ctx,
|
||||
is_library = True,
|
||||
# Filter out the node_modules from deps passed to TypeScript compiler
|
||||
# since they don't have the required providers.
|
||||
# They were added to the action inputs for tsc_wrapped already.
|
||||
# strict_deps checking currently skips node_modules.
|
||||
# TODO(alexeagle): turn on strict deps checking when we have a real
|
||||
# provider for JS/DTS inputs to ts_library.
|
||||
deps = [d for d in ctx.attr.deps if not NodeModuleInfo in d],
|
||||
compile_action = _prodmode_compile_action,
|
||||
devmode_compile_action = _devmode_compile_action,
|
||||
tsc_wrapped_tsconfig = _ngc_tsconfig,
|
||||
@ -474,6 +494,11 @@ def ng_module_impl(ctx, ts_compile_actions):
|
||||
def _ng_module_impl(ctx):
|
||||
return ts_providers_dict_to_struct(ng_module_impl(ctx, compile_ts))
|
||||
|
||||
local_deps_aspects = [collect_node_modules_aspect, _collect_summaries_aspect]
|
||||
|
||||
# Workaround skydoc bug which assumes DEPS_ASPECTS is a str type
|
||||
[local_deps_aspects.append(a) for a in DEPS_ASPECTS]
|
||||
|
||||
NG_MODULE_ATTRIBUTES = {
|
||||
"srcs": attr.label_list(allow_files = [".ts"]),
|
||||
|
||||
@ -481,7 +506,7 @@ NG_MODULE_ATTRIBUTES = {
|
||||
# https://github.com/bazelbuild/skydoc/issues/21
|
||||
"deps": attr.label_list(
|
||||
doc = "Targets that are imported by this target",
|
||||
aspects = list(DEPS_ASPECTS) + [_collect_summaries_aspect],
|
||||
aspects = local_deps_aspects,
|
||||
),
|
||||
"assets": attr.label_list(
|
||||
doc = ".html and .css files needed by the Angular compiler",
|
||||
@ -500,12 +525,21 @@ NG_MODULE_ATTRIBUTES = {
|
||||
"inline_resources": attr.bool(default = True),
|
||||
"no_i18n": attr.bool(default = False),
|
||||
"compiler": attr.label(
|
||||
default = Label("//packages/bazel/src/ngc-wrapped"),
|
||||
doc = """Sets a different ngc compiler binary to use for this library.
|
||||
|
||||
The default ngc compiler depends on the `@npm//@angular/bazel`
|
||||
target which is setup for projects that use bazel managed npm deps that
|
||||
fetch the @angular/bazel npm package. It is recommended that you use
|
||||
the workspace name `@npm` for bazel managed deps so the default
|
||||
compiler works out of the box. Otherwise, you'll have to override
|
||||
the compiler attribute manually.
|
||||
""",
|
||||
default = Label(DEFAULT_NG_COMPILER),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
"_ng_xi18n": attr.label(
|
||||
default = Label("//packages/bazel/src/ngc-wrapped:xi18n"),
|
||||
"ng_xi18n": attr.label(
|
||||
default = Label(DEFAULT_NG_XI18N),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
@ -514,12 +548,69 @@ NG_MODULE_ATTRIBUTES = {
|
||||
|
||||
NG_MODULE_RULE_ATTRS = dict(dict(COMMON_ATTRIBUTES, **NG_MODULE_ATTRIBUTES), **{
|
||||
"tsconfig": attr.label(allow_files = True, single_file = True),
|
||||
|
||||
# @// is special syntax for the "main" repository
|
||||
# The default assumes the user specified a target "node_modules" in their
|
||||
# root BUILD file.
|
||||
"node_modules": attr.label(
|
||||
default = Label("@//:node_modules"),
|
||||
doc = """The npm packages which should be available during the compile.
|
||||
|
||||
The default value of `@npm//typescript:typescript__typings` is
|
||||
for projects that use bazel managed npm deps. It is recommended
|
||||
that you use the workspace name `@npm` for bazel managed deps so the
|
||||
default value works out of the box. Otherwise, you'll have to
|
||||
override the node_modules attribute manually. This default is in place
|
||||
since code compiled by ng_module will always depend on at least the
|
||||
typescript default libs which are provided by
|
||||
`@npm//typescript:typescript__typings`.
|
||||
|
||||
This attribute is DEPRECATED. As of version 0.18.0 the recommended
|
||||
approach to npm dependencies is to use fine grained npm dependencies
|
||||
which are setup with the `yarn_install` or `npm_install` rules.
|
||||
|
||||
For example, in targets that used a `//:node_modules` filegroup,
|
||||
|
||||
```
|
||||
ng_module(
|
||||
name = "my_lib",
|
||||
...
|
||||
node_modules = "//:node_modules",
|
||||
)
|
||||
```
|
||||
|
||||
which specifies all files within the `//:node_modules` filegroup
|
||||
to be inputs to the `my_lib`. Using fine grained npm dependencies,
|
||||
`my_lib` is defined with only the npm dependencies that are
|
||||
needed:
|
||||
|
||||
```
|
||||
ng_module(
|
||||
name = "my_lib",
|
||||
...
|
||||
deps = [
|
||||
"@npm//@types/foo",
|
||||
"@npm//@types/bar",
|
||||
"@npm//foo",
|
||||
"@npm//bar",
|
||||
...
|
||||
],
|
||||
)
|
||||
```
|
||||
|
||||
In this case, only the listed npm packages and their
|
||||
transitive deps are includes as inputs to the `my_lib` target
|
||||
which reduces the time required to setup the runfiles for this
|
||||
target (see https://github.com/bazelbuild/bazel/issues/5153).
|
||||
The default typescript libs are also available via the node_modules
|
||||
default in this case.
|
||||
|
||||
The @npm external repository and the fine grained npm package
|
||||
targets are setup using the `yarn_install` or `npm_install` rule
|
||||
in your WORKSPACE file:
|
||||
|
||||
yarn_install(
|
||||
name = "npm",
|
||||
package_json = "//:package.json",
|
||||
yarn_lock = "//:yarn.lock",
|
||||
)
|
||||
""",
|
||||
default = Label("@npm//typescript:typescript__typings"),
|
||||
),
|
||||
"entry_point": attr.string(),
|
||||
|
||||
|
@ -1,27 +1,30 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = glob(["*"]),
|
||||
visibility = ["//packages/bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
exports_files(["rollup.config.js"])
|
||||
exports_files([
|
||||
"rollup.config.js",
|
||||
"ng_package.bzl",
|
||||
])
|
||||
|
||||
ts_library(
|
||||
name = "lib",
|
||||
srcs = glob(["*.ts"]),
|
||||
node_modules = "@angular_packager_deps//:node_modules",
|
||||
node_modules = "@ngdeps//typescript:typescript__typings",
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = [
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//@types/shelljs",
|
||||
],
|
||||
)
|
||||
|
||||
nodejs_binary(
|
||||
name = "packager",
|
||||
data = ["lib"],
|
||||
data = [
|
||||
"lib",
|
||||
"@ngdeps//shelljs",
|
||||
],
|
||||
entry_point = "angular/packages/bazel/src/ng_package/packager.js",
|
||||
install_source_map_support = False,
|
||||
node_modules = "@angular_packager_deps//:node_modules",
|
||||
)
|
||||
|
@ -17,7 +17,7 @@ load("@build_bazel_rules_nodejs//:internal/collect_es6_sources.bzl", "collect_es
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//:internal/rollup/rollup_bundle.bzl",
|
||||
"ROLLUP_ATTRS",
|
||||
"rollup_module_mappings_aspect",
|
||||
"ROLLUP_DEPS_ASPECTS",
|
||||
"run_uglify",
|
||||
"write_rollup_config",
|
||||
)
|
||||
@ -28,8 +28,11 @@ load(
|
||||
"create_package",
|
||||
)
|
||||
load("@build_bazel_rules_nodejs//:internal/node.bzl", "sources_aspect")
|
||||
load("@build_bazel_rules_nodejs//internal/common:node_module_info.bzl", "NodeModuleInfo")
|
||||
load("//packages/bazel/src:esm5.bzl", "esm5_outputs_aspect", "esm5_root_dir", "flatten_esm5")
|
||||
|
||||
_DEFAULT_NG_PACKAGER = "@npm//@angular/bazel/bin:packager"
|
||||
|
||||
# Convert from some-dash-case to someCamelCase
|
||||
def _convert_dash_case_to_camel_case(s):
|
||||
parts = s.split("-")
|
||||
@ -160,6 +163,13 @@ def _filter_out_generated_files(files):
|
||||
def _esm2015_root_dir(ctx):
|
||||
return ctx.label.name + ".es6"
|
||||
|
||||
def _filter_js_inputs(all_inputs):
|
||||
return [
|
||||
f
|
||||
for f in all_inputs
|
||||
if f.path.endswith(".js") or f.path.endswith(".json")
|
||||
]
|
||||
|
||||
# ng_package produces package that is npm-ready.
|
||||
def _ng_package_impl(ctx):
|
||||
npm_package_directory = ctx.actions.declare_directory("%s.ng_pkg" % ctx.label.name)
|
||||
@ -235,11 +245,19 @@ def _ng_package_impl(ctx):
|
||||
umd_output = ctx.outputs.umd
|
||||
min_output = ctx.outputs.umd_min
|
||||
|
||||
node_modules_files = _filter_js_inputs(ctx.files.node_modules)
|
||||
|
||||
# Also include files from npm fine grained deps as inputs.
|
||||
# These deps are identified by the NodeModuleInfo provider.
|
||||
for d in ctx.attr.deps:
|
||||
if NodeModuleInfo in d:
|
||||
node_modules_files += _filter_js_inputs(d.files)
|
||||
|
||||
esm2015_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, _esm2015_root_dir(ctx)]), filename = "_%s.rollup_esm2015.conf.js")
|
||||
esm5_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]), filename = "_%s.rollup_esm5.conf.js")
|
||||
|
||||
fesm2015.append(_rollup(ctx, "fesm2015", esm2015_config, es2015_entry_point, esm_2015_files + ctx.files.node_modules, fesm2015_output))
|
||||
fesm5.append(_rollup(ctx, "fesm5", esm5_config, es5_entry_point, esm5_sources + ctx.files.node_modules, fesm5_output))
|
||||
fesm2015.append(_rollup(ctx, "fesm2015", esm2015_config, es2015_entry_point, esm_2015_files + node_modules_files, fesm2015_output))
|
||||
fesm5.append(_rollup(ctx, "fesm5", esm5_config, es5_entry_point, esm5_sources + node_modules_files, fesm5_output))
|
||||
|
||||
bundles.append(
|
||||
_rollup(
|
||||
@ -247,7 +265,7 @@ def _ng_package_impl(ctx):
|
||||
"umd",
|
||||
esm5_config,
|
||||
es5_entry_point,
|
||||
esm5_sources + ctx.files.node_modules,
|
||||
esm5_sources + node_modules_files,
|
||||
umd_output,
|
||||
format = "umd",
|
||||
package_name = package_name,
|
||||
@ -325,14 +343,15 @@ def _ng_package_impl(ctx):
|
||||
mnemonic = "AngularPackage",
|
||||
inputs = packager_inputs,
|
||||
outputs = [npm_package_directory],
|
||||
executable = ctx.executable._ng_packager,
|
||||
executable = ctx.executable.ng_packager,
|
||||
arguments = [packager_args],
|
||||
)
|
||||
|
||||
devfiles = depset()
|
||||
if ctx.attr.include_devmode_srcs:
|
||||
for d in ctx.attr.deps:
|
||||
devfiles = depset(transitive = [devfiles, d.files, d.node_sources])
|
||||
if not NodeModuleInfo in d:
|
||||
devfiles = depset(transitive = [devfiles, d.files, d.node_sources])
|
||||
|
||||
# Re-use the create_package function from the nodejs npm_package rule.
|
||||
package_dir = create_package(
|
||||
@ -344,13 +363,14 @@ def _ng_package_impl(ctx):
|
||||
files = depset([package_dir]),
|
||||
)]
|
||||
|
||||
DEPS_ASPECTS = [esm5_outputs_aspect, sources_aspect]
|
||||
|
||||
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
|
||||
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
|
||||
|
||||
NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **dict(ROLLUP_ATTRS, **{
|
||||
"srcs": attr.label_list(allow_files = True),
|
||||
"deps": attr.label_list(aspects = [
|
||||
rollup_module_mappings_aspect,
|
||||
esm5_outputs_aspect,
|
||||
sources_aspect,
|
||||
]),
|
||||
"deps": attr.label_list(aspects = DEPS_ASPECTS),
|
||||
"data": attr.label_list(
|
||||
doc = "Additional, non-Angular files to be added to the package, e.g. global CSS assets.",
|
||||
allow_files = True,
|
||||
@ -361,8 +381,8 @@ NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **dict(ROLLUP_ATTRS, **{
|
||||
"entry_point_name": attr.string(
|
||||
doc = "Name to use when generating bundle files for the primary entry-point.",
|
||||
),
|
||||
"_ng_packager": attr.label(
|
||||
default = Label("//packages/bazel/src/ng_package:packager"),
|
||||
"ng_packager": attr.label(
|
||||
default = Label(_DEFAULT_NG_PACKAGER),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"description": "runtime dependences for packager",
|
||||
"devDependencies": {
|
||||
"@types/node": "6.0.84",
|
||||
"@types/shelljs": "0.7.7",
|
||||
"shelljs": "0.8.2",
|
||||
"typescript": "2.7.2"
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"lib": ["es2015"]
|
||||
"lib": ["es2015"],
|
||||
"types": []
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
|
||||
"ROLLUP_ATTRS",
|
||||
"ROLLUP_DEPS_ASPECTS",
|
||||
"ROLLUP_OUTPUTS",
|
||||
"rollup_module_mappings_aspect",
|
||||
"run_rollup",
|
||||
"run_sourcemapexplorer",
|
||||
"run_uglify",
|
||||
@ -141,16 +141,18 @@ def _ng_rollup_bundle(ctx):
|
||||
|
||||
return DefaultInfo(files = depset([ctx.outputs.build_es5_min, sourcemap]))
|
||||
|
||||
DEPS_ASPECTS = [esm5_outputs_aspect]
|
||||
|
||||
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
|
||||
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
|
||||
|
||||
ng_rollup_bundle = rule(
|
||||
implementation = _ng_rollup_bundle,
|
||||
attrs = dict(ROLLUP_ATTRS, **{
|
||||
"deps": attr.label_list(
|
||||
doc = """Other targets that provide JavaScript files.
|
||||
Typically this will be `ts_library` or `ng_module` targets.""",
|
||||
aspects = [
|
||||
rollup_module_mappings_aspect,
|
||||
esm5_outputs_aspect,
|
||||
],
|
||||
aspects = DEPS_ASPECTS,
|
||||
),
|
||||
"_rollup": attr.label(
|
||||
executable = True,
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
"Install toolchain dependencies"
|
||||
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "check_rules_typescript_version")
|
||||
|
||||
def ng_setup_workspace():
|
||||
@ -14,12 +13,9 @@ def ng_setup_workspace():
|
||||
It creates some additional Bazel external repositories that are used internally
|
||||
by the Angular rules.
|
||||
"""
|
||||
yarn_install(
|
||||
name = "angular_packager_deps",
|
||||
package_json = "@angular//packages/bazel/src/ng_package:package.json",
|
||||
yarn_lock = "@angular//packages/bazel/src/ng_package:yarn.lock",
|
||||
)
|
||||
|
||||
# 0.16.0: minimal version required to work with ng_module
|
||||
# 0.16.2: bazel type resolution for zone.js types
|
||||
check_rules_typescript_version("0.16.2")
|
||||
# 0.20.1: fine grained deps
|
||||
# 0.20.2: version check fix
|
||||
check_rules_typescript_version("0.20.2")
|
||||
|
@ -1,12 +1,6 @@
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = glob(["*"]),
|
||||
visibility = ["//packages/bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "ngc_lib",
|
||||
srcs = [
|
||||
@ -14,15 +8,22 @@ ts_library(
|
||||
"index.ts",
|
||||
],
|
||||
module_name = "@angular/bazel",
|
||||
node_modules = "@ngdeps//typescript:typescript__typings",
|
||||
tsconfig = ":tsconfig.json",
|
||||
visibility = ["//packages/bazel/test/ngc-wrapped:__subpackages__"],
|
||||
visibility = [
|
||||
"//packages/bazel:__pkg__",
|
||||
"//packages/bazel/test/ngc-wrapped:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
# BEGIN-INTERNAL
|
||||
# Only needed when compiling within the Angular repo.
|
||||
# Users will get this dependency from node_modules.
|
||||
"//packages/compiler-cli",
|
||||
# END-INTERNAL
|
||||
"@build_bazel_rules_typescript//internal:tsc_wrapped",
|
||||
"@ngdeps//@bazel/typescript",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//tsickle",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -31,9 +32,9 @@ nodejs_binary(
|
||||
data = [
|
||||
":ngc_lib",
|
||||
"@build_bazel_rules_typescript//third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto",
|
||||
"@ngdeps//tslib",
|
||||
],
|
||||
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js",
|
||||
node_modules = "@//:node_modules",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@ -42,7 +43,6 @@ nodejs_binary(
|
||||
data = [
|
||||
":ngc_lib",
|
||||
],
|
||||
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js/extract_i18n.js",
|
||||
node_modules = "@//:node_modules",
|
||||
entry_point = "angular/packages/bazel/src/ngc-wrapped/extract_i18n.js",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5", "es2015.collection", "es2015.core"]
|
||||
"lib": ["es5", "es2015.collection", "es2015.core"],
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,6 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = glob(["*"]) + [
|
||||
"//packages/bazel/src/protractor/utils:package_assets",
|
||||
],
|
||||
visibility = ["//packages/bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
exports_files([
|
||||
"protractor.conf.js",
|
||||
"protractor_web_test.bzl",
|
||||
])
|
||||
|
@ -202,7 +202,6 @@ def protractor_web_test(
|
||||
name = protractor_bin_name,
|
||||
entry_point = "protractor/bin/protractor",
|
||||
data = srcs + deps + data,
|
||||
node_modules = "@//:node_modules",
|
||||
testonly = 1,
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
@ -303,7 +302,6 @@ def protractor_web_test_suite(
|
||||
name = protractor_bin_name,
|
||||
entry_point = "protractor/bin/protractor",
|
||||
data = srcs + deps + data,
|
||||
node_modules = "@//:node_modules",
|
||||
testonly = 1,
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
@ -1,16 +1,12 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "package_assets",
|
||||
srcs = glob(["*"]),
|
||||
visibility = ["//packages/bazel:__subpackages__"],
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "utils",
|
||||
srcs = ["index.ts"],
|
||||
module_name = "@angular/bazel/protractor-utils",
|
||||
node_modules = "@ngdeps//typescript:typescript__typings",
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = ["@ngdeps//@types/node"],
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"lib": ["es2015"]
|
||||
"lib": ["es2015"],
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,10 @@ ts_library(
|
||||
name = "core_spec_lib",
|
||||
testonly = True,
|
||||
srcs = ["core_package.spec.ts"],
|
||||
deps = ["//packages:types"],
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"@ngdeps//@types/shelljs",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
@ -18,6 +21,8 @@ jasmine_node_test(
|
||||
srcs = [":core_spec_lib"],
|
||||
data = [
|
||||
"//packages/core:npm_package",
|
||||
"@ngdeps//@types/shelljs",
|
||||
"@ngdeps//shelljs",
|
||||
],
|
||||
)
|
||||
|
||||
@ -25,20 +30,29 @@ ts_library(
|
||||
name = "common_spec_lib",
|
||||
testonly = True,
|
||||
srcs = ["common_package.spec.ts"],
|
||||
deps = ["//packages:types"],
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"@ngdeps//@types/shelljs",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = "common_package",
|
||||
srcs = [":common_spec_lib"],
|
||||
data = ["//packages/common:npm_package"],
|
||||
data = [
|
||||
"//packages/common:npm_package",
|
||||
"@ngdeps//shelljs",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "example_spec_lib",
|
||||
testonly = True,
|
||||
srcs = ["example_package.spec.ts"],
|
||||
deps = ["//packages:types"],
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"@ngdeps//@types/diff",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
|
@ -1,13 +1,15 @@
|
||||
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
|
||||
|
||||
load("//packages/bazel:index.bzl", "ng_module", "ng_package")
|
||||
load("//tools:defaults.bzl", "npm_package")
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_package", "npm_package")
|
||||
|
||||
ng_module(
|
||||
name = "example",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "example",
|
||||
deps = ["//packages/bazel/test/ng_package/example/secondary"],
|
||||
deps = [
|
||||
"//packages/bazel/test/ng_package/example/secondary",
|
||||
"@ngdeps//@types",
|
||||
],
|
||||
)
|
||||
|
||||
ng_package(
|
||||
|
@ -1,10 +1,13 @@
|
||||
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
|
||||
|
||||
load("//packages/bazel:index.bzl", "ng_module")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ng_module(
|
||||
name = "secondary",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "example/secondary",
|
||||
deps = ["//packages/core"],
|
||||
deps = [
|
||||
"//packages/core",
|
||||
"@ngdeps//@types",
|
||||
],
|
||||
)
|
||||
|
@ -2,6 +2,7 @@ load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "ngc_test_lib",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"index_test.ts",
|
||||
"test_support.ts",
|
||||
@ -11,6 +12,7 @@ ts_library(
|
||||
deps = [
|
||||
"//packages/bazel/src/ngc-wrapped:ngc_lib",
|
||||
"//packages/compiler-cli",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -6,5 +6,8 @@ ng_module(
|
||||
name = "empty",
|
||||
srcs = ["empty.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = ["//packages/core"],
|
||||
deps = [
|
||||
"//packages/core",
|
||||
"@ngdeps//@types",
|
||||
],
|
||||
)
|
||||
|
@ -70,7 +70,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': '../angular/external/angular_deps/node_modules',
|
||||
'nodeModulesPrefix': '../angular/external/ngdeps/node_modules',
|
||||
},
|
||||
'files': options.files,
|
||||
'angularCompilerOptions': {
|
||||
|
@ -1,12 +1,15 @@
|
||||
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver", "ts_library")
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools/http-server:http_server.bzl", "http_server")
|
||||
|
||||
ts_library(
|
||||
name = "app",
|
||||
srcs = ["app.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
# FIXME: should not be needed here!
|
||||
deps = ["@ngdeps//@types/jasmine"],
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
@ -19,7 +22,6 @@ ts_devserver(
|
||||
rollup_bundle(
|
||||
name = "bundle",
|
||||
entry_point = "packages/bazel/test/protractor-2/app",
|
||||
node_modules = "//:node_modules",
|
||||
deps = [":app"],
|
||||
)
|
||||
|
||||
@ -36,6 +38,10 @@ ts_library(
|
||||
testonly = True,
|
||||
srcs = ["test.spec.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = [
|
||||
"@ngdeps//@types/selenium-webdriver",
|
||||
"@ngdeps//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
protractor_web_test_suite(
|
||||
@ -44,7 +50,10 @@ protractor_web_test_suite(
|
||||
data = ["//packages/bazel/src/protractor/utils"],
|
||||
on_prepare = ":on-prepare.js",
|
||||
server = ":prodserver",
|
||||
deps = [":ts_spec"],
|
||||
deps = [
|
||||
":ts_spec",
|
||||
"@ngdeps//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
protractor_web_test_suite(
|
||||
@ -53,5 +62,8 @@ protractor_web_test_suite(
|
||||
data = ["//packages/bazel/src/protractor/utils"],
|
||||
on_prepare = ":on-prepare.js",
|
||||
server = ":devserver",
|
||||
deps = [":ts_spec"],
|
||||
deps = [
|
||||
":ts_spec",
|
||||
"@ngdeps//protractor",
|
||||
],
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "es2015"]
|
||||
"lib": ["dom", "es2015"],
|
||||
"types": ["jasmine"]
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "ts_spec",
|
||||
testonly = True,
|
||||
srcs = ["test.spec.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = [
|
||||
"@ngdeps//@types/selenium-webdriver",
|
||||
"@ngdeps//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
@ -13,12 +17,18 @@ ts_library(
|
||||
testonly = True,
|
||||
srcs = ["conf.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = ["//packages/bazel/src/protractor/utils"],
|
||||
deps = [
|
||||
"//packages/bazel/src/protractor/utils",
|
||||
"@ngdeps//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
protractor_web_test_suite(
|
||||
name = "test",
|
||||
configuration = ":ts_conf",
|
||||
data = ["//packages/bazel/src/protractor/utils"],
|
||||
deps = [":ts_spec"],
|
||||
deps = [
|
||||
":ts_spec",
|
||||
"@ngdeps//protractor",
|
||||
],
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2015"]
|
||||
"lib": ["es2015"],
|
||||
"types": ["jasmine"]
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ ts_library(
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"//packages/core",
|
||||
"@ngdeps//@types/node",
|
||||
],
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "npm_package")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config", "ts_library")
|
||||
load("//tools:defaults.bzl", "npm_package", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config")
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
@ -21,7 +21,6 @@ ts_library(
|
||||
],
|
||||
),
|
||||
module_name = "@angular/compiler-cli",
|
||||
node_modules = "@angular_deps//:node_modules",
|
||||
tsconfig = ":tsconfig",
|
||||
deps = [
|
||||
"//packages/compiler",
|
||||
@ -31,6 +30,10 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/metadata",
|
||||
"//packages/compiler-cli/src/ngtsc/transform",
|
||||
"//packages/compiler-cli/src/ngtsc/typecheck",
|
||||
"@ngdeps//@bazel/typescript",
|
||||
"@ngdeps//@types",
|
||||
"@ngdeps//tsickle",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -16,6 +16,7 @@ ng_module(
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-server",
|
||||
"//packages/router",
|
||||
"@ngdeps//reflect-metadata",
|
||||
"@rxjs",
|
||||
],
|
||||
)
|
||||
|
@ -3,10 +3,16 @@ load("//packages/bazel:index.bzl", "ng_module")
|
||||
ng_module(
|
||||
name = "test_module",
|
||||
srcs = glob(["*.ts"]),
|
||||
compiler = "//packages/bazel/src/ngc-wrapped",
|
||||
entry_point = "index.ts",
|
||||
flat_module_out_file = "flat_module_filename",
|
||||
module_name = "some_npm_module",
|
||||
deps = ["//packages/core"],
|
||||
ng_xi18n = "//packages/bazel/src/ngc-wrapped:xi18n",
|
||||
node_modules = "@ngdeps//typescript:typescript__typings",
|
||||
deps = [
|
||||
"//packages/core",
|
||||
"@ngdeps//@types",
|
||||
],
|
||||
)
|
||||
|
||||
load(":extract_flat_module_index.bzl", "extract_flat_module_index")
|
||||
|
@ -17,5 +17,14 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/metadata",
|
||||
"//packages/compiler-cli/src/ngtsc/transform",
|
||||
"//packages/compiler-cli/src/ngtsc/translator",
|
||||
"@ngdeps//@types/convert-source-map",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//@types/shelljs",
|
||||
"@ngdeps//@types/source-map",
|
||||
"@ngdeps//@types/yargs",
|
||||
"@ngdeps//dependency-graph",
|
||||
"@ngdeps//magic-string",
|
||||
"@ngdeps//source-map",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -13,6 +13,10 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/host",
|
||||
"//packages/compiler-cli/src/ngtsc/testing",
|
||||
"//packages/compiler-cli/src/ngtsc/transform",
|
||||
"@ngdeps//@types/convert-source-map",
|
||||
"@ngdeps//@types/mock-fs",
|
||||
"@ngdeps//magic-string",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -22,5 +26,7 @@ jasmine_node_test(
|
||||
deps = [
|
||||
":test_lib",
|
||||
"//tools/testing:node_no_angular",
|
||||
"@ngdeps//canonical-path",
|
||||
"@ngdeps//convert-source-map",
|
||||
],
|
||||
)
|
||||
|
@ -16,5 +16,7 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/metadata",
|
||||
"//packages/compiler-cli/src/ngtsc/transform",
|
||||
"//packages/compiler-cli/src/ngtsc/typecheck",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -15,6 +15,7 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/diagnostics",
|
||||
"//packages/compiler-cli/src/ngtsc/metadata",
|
||||
"//packages/compiler-cli/src/ngtsc/testing",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -11,5 +11,6 @@ ts_library(
|
||||
module_name = "@angular/compiler-cli/src/ngtsc/diagnostics",
|
||||
deps = [
|
||||
"//packages/compiler",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -14,5 +14,7 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/host",
|
||||
"//packages/compiler-cli/src/ngtsc/metadata",
|
||||
"//packages/compiler-cli/src/ngtsc/util",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -9,4 +9,5 @@ ts_library(
|
||||
"src/**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/compiler-cli/src/ngtsc/host",
|
||||
deps = ["@ngdeps//typescript"],
|
||||
)
|
||||
|
@ -14,5 +14,7 @@ ts_library(
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli/src/ngtsc/host",
|
||||
"//packages/compiler-cli/src/ngtsc/util",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/host",
|
||||
"//packages/compiler-cli/src/ngtsc/metadata",
|
||||
"//packages/compiler-cli/src/ngtsc/testing",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -10,5 +10,6 @@ ts_library(
|
||||
]),
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -6,6 +6,8 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
///<reference types="jasmine"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
|
@ -17,5 +17,6 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/translator",
|
||||
"//packages/compiler-cli/src/ngtsc/typecheck",
|
||||
"//packages/compiler-cli/src/ngtsc/util",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -10,5 +10,6 @@ ts_library(
|
||||
"//packages:types",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli/src/ngtsc/util",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -12,5 +12,6 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/metadata",
|
||||
"//packages/compiler-cli/src/ngtsc/translator",
|
||||
"//packages/compiler-cli/src/ngtsc/util",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ ts_library(
|
||||
"//packages/compiler-cli/src/ngtsc/host",
|
||||
"//packages/compiler-cli/src/ngtsc/testing",
|
||||
"//packages/compiler-cli/src/ngtsc/typecheck",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -11,5 +11,7 @@ ts_library(
|
||||
module_name = "@angular/compiler-cli/src/ngtsc/util",
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
@ -12,6 +12,7 @@ ts_library(
|
||||
"//packages:types",
|
||||
"//packages/compiler-cli/src/ngtsc/testing",
|
||||
"//packages/compiler-cli/src/ngtsc/util",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -17,6 +17,7 @@ ts_library(
|
||||
"//packages:types",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -31,6 +32,7 @@ ts_library(
|
||||
":test_utils",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -45,6 +47,7 @@ jasmine_node_test(
|
||||
"//packages/common:npm_package",
|
||||
"//packages/core",
|
||||
"//tools/testing:node",
|
||||
"@ngdeps//minimist",
|
||||
],
|
||||
)
|
||||
|
||||
@ -59,6 +62,7 @@ ts_library(
|
||||
":test_utils",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -76,6 +80,8 @@ jasmine_node_test(
|
||||
":ngc_lib",
|
||||
"//packages/core",
|
||||
"//tools/testing:node",
|
||||
"@ngdeps//minimist",
|
||||
"@ngdeps//tsickle",
|
||||
],
|
||||
)
|
||||
|
||||
@ -90,6 +96,7 @@ ts_library(
|
||||
":test_utils",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -118,6 +125,7 @@ ts_library(
|
||||
":test_utils",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -11,6 +11,7 @@ ts_library(
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"//packages/compiler/test:test_utils",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -12,6 +12,7 @@ ts_library(
|
||||
"//packages/compiler-cli",
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"//packages/core",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -24,6 +25,7 @@ ts_library(
|
||||
":mocks",
|
||||
"//packages/compiler-cli",
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -53,6 +55,7 @@ ts_library(
|
||||
"//packages/compiler-cli",
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"//packages/language-service",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -83,6 +86,7 @@ ts_library(
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"//packages/compiler/test:test_utils",
|
||||
"//packages/language-service",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -10,6 +10,7 @@ ts_library(
|
||||
"//packages/compiler-cli",
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"//packages/core",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -10,6 +10,7 @@ ts_library(
|
||||
deps = [
|
||||
"//packages/compiler-cli/src/ngcc",
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"@ngdeps//@types/mock-fs",
|
||||
],
|
||||
)
|
||||
|
||||
@ -23,5 +24,10 @@ jasmine_node_test(
|
||||
deps = [
|
||||
":ngcc_lib",
|
||||
"//tools/testing:node_no_angular",
|
||||
"@ngdeps//@types/mock-fs",
|
||||
"@ngdeps//canonical-path",
|
||||
"@ngdeps//convert-source-map",
|
||||
"@ngdeps//shelljs",
|
||||
"@ngdeps//yargs",
|
||||
],
|
||||
)
|
||||
|
@ -8,6 +8,7 @@ ts_library(
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -20,5 +21,6 @@ jasmine_node_test(
|
||||
deps = [
|
||||
":ngtsc_lib",
|
||||
"//tools/testing:node_no_angular",
|
||||
"@ngdeps//minimist",
|
||||
],
|
||||
)
|
||||
|
@ -136,8 +136,7 @@ export function setupBazelTo(basePath: string) {
|
||||
}
|
||||
|
||||
// Link typescript
|
||||
const typescriptSource =
|
||||
path.join(sources, 'angular/external/angular_deps/node_modules/typescript');
|
||||
const typescriptSource = path.join(sources, 'angular/external/ngdeps/node_modules/typescript');
|
||||
const typescriptDest = path.join(nodeModulesPath, 'typescript');
|
||||
if (fs.existsSync(typescriptSource)) {
|
||||
fs.symlinkSync(typescriptSource, typescriptDest);
|
||||
|
@ -12,6 +12,7 @@ ts_library(
|
||||
"//packages/compiler/test:test_utils",
|
||||
"//packages/core",
|
||||
"//packages/platform-browser",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -28,5 +29,6 @@ jasmine_node_test(
|
||||
":test_lib",
|
||||
"//packages/core",
|
||||
"//tools/testing:node",
|
||||
"@ngdeps//source-map",
|
||||
],
|
||||
)
|
||||
|
@ -22,6 +22,7 @@ ts_library(
|
||||
"//packages:types",
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -61,6 +62,7 @@ ts_library(
|
||||
"//packages/compiler/test/expression_parser/utils",
|
||||
"//packages/compiler/testing",
|
||||
"//packages/core",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
@ -77,6 +79,8 @@ jasmine_node_test(
|
||||
":test_node_only_lib",
|
||||
"//packages/core",
|
||||
"//tools/testing:node",
|
||||
"@ngdeps//base64-js",
|
||||
"@ngdeps//source-map",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -15,5 +15,6 @@ ng_module(
|
||||
"//packages:types",
|
||||
"//packages/compiler",
|
||||
"//packages/core",
|
||||
"@ngdeps//@types/node",
|
||||
],
|
||||
)
|
||||
|
@ -21,6 +21,7 @@ ng_module(
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"//packages/compiler",
|
||||
"@ngdeps//zone.js",
|
||||
"@rxjs",
|
||||
"@rxjs//operators",
|
||||
],
|
||||
|
@ -29,6 +29,7 @@ ts_library(
|
||||
"//packages/private/testing",
|
||||
"//packages/router",
|
||||
"//packages/router/testing",
|
||||
"@ngdeps//zone.js",
|
||||
"@rxjs",
|
||||
"@rxjs//operators",
|
||||
],
|
||||
@ -67,6 +68,9 @@ jasmine_node_test(
|
||||
"//packages/platform-server",
|
||||
"//packages/platform-server/testing",
|
||||
"//tools/testing:node",
|
||||
"@ngdeps//base64-js",
|
||||
"@ngdeps//source-map",
|
||||
"@ngdeps//zone.js",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -31,6 +31,7 @@ ng_rollup_bundle(
|
||||
"//packages/common",
|
||||
"//packages/core",
|
||||
"//packages/core/test/bundling/util:reflect_metadata",
|
||||
"@ngdeps//reflect-metadata",
|
||||
],
|
||||
)
|
||||
|
||||
@ -75,7 +76,7 @@ js_expected_symbol_test(
|
||||
genrule(
|
||||
name = "tslib",
|
||||
srcs = [
|
||||
"@angular_deps//:node_modules/tslib/tslib.js",
|
||||
"@ngdeps//node_modules/tslib:tslib.js",
|
||||
],
|
||||
outs = [
|
||||
"tslib.js",
|
||||
|
@ -35,6 +35,7 @@ ng_rollup_bundle(
|
||||
"//packages/core/test/bundling/util:reflect_metadata",
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-browser-dynamic",
|
||||
"@ngdeps//reflect-metadata",
|
||||
],
|
||||
)
|
||||
|
||||
@ -81,7 +82,7 @@ js_expected_symbol_test(
|
||||
genrule(
|
||||
name = "tslib",
|
||||
srcs = [
|
||||
"@angular_deps//:node_modules/tslib/tslib.js",
|
||||
"@ngdeps//node_modules/tslib:tslib.js",
|
||||
],
|
||||
outs = [
|
||||
"tslib.js",
|
||||
|
@ -40,6 +40,7 @@ ts_library(
|
||||
deps = [
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-server",
|
||||
"@ngdeps//zone.js",
|
||||
],
|
||||
)
|
||||
|
||||
@ -60,6 +61,7 @@ jasmine_node_test(
|
||||
],
|
||||
deps = [
|
||||
":render3_node_lib",
|
||||
"@ngdeps//zone.js",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -12,16 +12,6 @@ ts_library(
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "ivy_node_lib",
|
||||
testonly = 1,
|
||||
srcs = [],
|
||||
deps = [
|
||||
":ivy_lib",
|
||||
"//packages/core/test/render3:domino",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = "ivy",
|
||||
bootstrap = [
|
||||
@ -31,6 +21,7 @@ jasmine_node_test(
|
||||
"ivy-jit",
|
||||
],
|
||||
deps = [
|
||||
":ivy_node_lib",
|
||||
":ivy_lib",
|
||||
"//packages/core/test/render3:domino",
|
||||
],
|
||||
)
|
||||
|
@ -13,5 +13,7 @@ ng_module(
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"//packages/core",
|
||||
"@ngdeps//@types/jasmine",
|
||||
"@ngdeps//zone.js",
|
||||
],
|
||||
)
|
||||
|
@ -13,6 +13,7 @@ ts_library(
|
||||
deps = [
|
||||
"//packages/common",
|
||||
"//packages/core",
|
||||
"@ngdeps//@angular-devkit/schematics",
|
||||
"@rxjs",
|
||||
],
|
||||
)
|
||||
@ -29,6 +30,7 @@ ts_library(
|
||||
":ng-add",
|
||||
"//packages/common",
|
||||
"//packages/core",
|
||||
"@ngdeps//@angular-devkit/schematics",
|
||||
"@rxjs",
|
||||
"@rxjs//operators",
|
||||
],
|
||||
@ -39,5 +41,6 @@ jasmine_node_test(
|
||||
deps = [
|
||||
":test_lib",
|
||||
"//packages/elements/schematics:collection",
|
||||
"@ngdeps//@schematics/angular",
|
||||
],
|
||||
)
|
||||
|
@ -1,5 +1,4 @@
|
||||
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test_suite")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite")
|
||||
|
||||
ts_library(
|
||||
name = "test_lib",
|
||||
@ -23,10 +22,10 @@ filegroup(
|
||||
name = "elements_test_bootstrap_scripts",
|
||||
# do not sort
|
||||
srcs = [
|
||||
"@angular_deps//:node_modules/@webcomponents/custom-elements/src/native-shim.js",
|
||||
"@angular_deps//:node_modules/reflect-metadata/Reflect.js",
|
||||
"@angular_deps//:node_modules/zone.js/dist/zone.js",
|
||||
"@angular_deps//:node_modules/zone.js/dist/zone-testing.js",
|
||||
"@ngdeps//node_modules/@webcomponents/custom-elements:src/native-shim.js",
|
||||
"@ngdeps//node_modules/reflect-metadata:Reflect.js",
|
||||
"@ngdeps//node_modules/zone.js:dist/zone.js",
|
||||
"@ngdeps//node_modules/zone.js:dist/zone-testing.js",
|
||||
],
|
||||
)
|
||||
|
||||
@ -37,8 +36,6 @@ ts_web_test_suite(
|
||||
],
|
||||
# do not sort
|
||||
deps = [
|
||||
"@angular_deps//:node_modules/tslib/tslib.js",
|
||||
"//tools/testing:browser",
|
||||
":test_lib",
|
||||
],
|
||||
)
|
||||
|
@ -28,5 +28,6 @@ ts_web_test_suite(
|
||||
name = "test_web",
|
||||
deps = [
|
||||
":test_lib",
|
||||
"@ngdeps//karma",
|
||||
],
|
||||
)
|
||||
|
@ -16,6 +16,8 @@ ts_library(
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli",
|
||||
"//packages/core",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,9 @@ ls_rollup_bundle(
|
||||
"fs": "fs",
|
||||
},
|
||||
license_banner = "banner.js.txt",
|
||||
node_modules = "//:node_modules",
|
||||
visibility = ["//packages/language-service:__pkg__"],
|
||||
deps = ["//packages/language-service"],
|
||||
deps = [
|
||||
"//packages/language-service",
|
||||
"@ngdeps//tslib",
|
||||
],
|
||||
)
|
||||
|
@ -12,7 +12,7 @@ without having to provide all of the angular specific peer dependencies.
|
||||
load(
|
||||
"@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
|
||||
"ROLLUP_ATTRS",
|
||||
"rollup_module_mappings_aspect",
|
||||
"ROLLUP_DEPS_ASPECTS",
|
||||
"run_rollup",
|
||||
"run_uglify",
|
||||
"write_rollup_config",
|
||||
@ -28,6 +28,11 @@ _ROLLUP_OUTPUTS = {
|
||||
"build_umd_min": "%{name}.umd.min.js",
|
||||
}
|
||||
|
||||
DEPS_ASPECTS = [esm5_outputs_aspect]
|
||||
|
||||
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
|
||||
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
|
||||
|
||||
def _ls_rollup_bundle(ctx):
|
||||
esm5_sources = flatten_esm5(ctx)
|
||||
rollup_config = write_rollup_config(
|
||||
@ -42,10 +47,11 @@ def _ls_rollup_bundle(ctx):
|
||||
ls_rollup_bundle = rule(
|
||||
implementation = _ls_rollup_bundle,
|
||||
attrs = dict(ROLLUP_ATTRS, **{
|
||||
"deps": attr.label_list(aspects = [
|
||||
rollup_module_mappings_aspect,
|
||||
esm5_outputs_aspect,
|
||||
]),
|
||||
"deps": attr.label_list(
|
||||
doc = """Other targets that provide JavaScript files.
|
||||
Typically this will be `ts_library` or `ng_module` targets.""",
|
||||
aspects = DEPS_ASPECTS,
|
||||
),
|
||||
}),
|
||||
outputs = _ROLLUP_OUTPUTS,
|
||||
)
|
||||
|
@ -9,6 +9,7 @@ ts_library(
|
||||
"//packages/compiler",
|
||||
"//packages/compiler-cli/test:test_utils",
|
||||
"//packages/language-service",
|
||||
"@ngdeps//typescript",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -15,6 +15,8 @@ ng_module(
|
||||
"//packages:types",
|
||||
"//packages/common",
|
||||
"//packages/core",
|
||||
"@ngdeps//@types/hammerjs",
|
||||
"@ngdeps//zone.js",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -12,6 +12,7 @@ ng_module(
|
||||
"//packages/core",
|
||||
"//packages/core/testing",
|
||||
"//packages/platform-browser",
|
||||
"@ngdeps//@types/jasmine",
|
||||
"@rxjs",
|
||||
],
|
||||
)
|
||||
|
@ -21,6 +21,8 @@ ng_module(
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-browser-dynamic",
|
||||
"//packages/platform-browser/animations",
|
||||
"@ngdeps//@types/node",
|
||||
"@ngdeps//zone.js",
|
||||
"@rxjs",
|
||||
],
|
||||
)
|
||||
|
@ -12,6 +12,7 @@ ts_library(
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = [
|
||||
"//packages/service-worker/config",
|
||||
"@ngdeps//@types/node",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -17,7 +17,10 @@
|
||||
"inlineSourceMap": true,
|
||||
"lib": ["es2015"],
|
||||
"target": "es5",
|
||||
"typeRoots": []
|
||||
"typeRoots": [],
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"main.ts",
|
||||
|
@ -1,7 +1,6 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_rollup_bundle")
|
||||
load("//tools:defaults.bzl", "ng_rollup_bundle", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "worker",
|
||||
@ -13,6 +12,7 @@ ts_library(
|
||||
exclude = ["main.ts"],
|
||||
),
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = ["@ngdeps//@types/node"],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
|
@ -14,7 +14,8 @@
|
||||
"inlineSourceMap": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"target": "es2017",
|
||||
"typeRoots": []
|
||||
"typeRoots": [],
|
||||
"types": []
|
||||
},
|
||||
"bazelOptions": {
|
||||
"suppressTsconfigOverrideWarnings": true
|
||||
|
@ -16,6 +16,7 @@ ng_module(
|
||||
"//packages/core",
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-browser-dynamic",
|
||||
"@ngdeps//zone.js",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -74,7 +74,7 @@ export function createWithEachNg1VersionFn(setNg1: typeof setAngularJSGlobal) {
|
||||
document.body.removeChild(script);
|
||||
resolve();
|
||||
};
|
||||
script.src = `base/angular_deps/node_modules/${file}`;
|
||||
script.src = `base/ngdeps/node_modules/${file}`;
|
||||
document.body.appendChild(script);
|
||||
})),
|
||||
Promise.resolve())
|
||||
|
Reference in New Issue
Block a user