build: update to rules_typescript 0.23.2 and rules_nodejs 0.16.8 (#28532)

PR Close #28532
This commit is contained in:
Greg Magolan 2019-02-04 15:53:32 -08:00 committed by Matias Niemelä
parent 8d11627e6c
commit 0d1e065a1c
20 changed files with 263 additions and 994 deletions

View File

@ -2,3 +2,4 @@ node_modules
dist
aio/node_modules
aio/tools/examples/shared/node_modules
integration/bazel

View File

@ -1,17 +1,6 @@
workspace(name = "angular")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
"//packages/bazel:package.bzl",
"rules_angular_dependencies",
"rules_angular_dev_dependencies",
)
http_archive(
name = "io_bazel_rules_go",
sha256 = "b7a62250a3a73277ade0ce306d22f122365b513f5402222403e507f2f997d421",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.3/rules_go-0.16.3.tar.gz",
)
# Uncomment for local bazel rules development
#local_repository(
@ -23,25 +12,15 @@ http_archive(
# path = "../rules_typescript",
#)
# Angular Bazel users will call this function
rules_angular_dependencies()
# Fetch rules_nodejs so we can install our npm dependencies
http_archive(
name = "build_bazel_rules_nodejs",
strip_prefix = "rules_nodejs-0.16.8",
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.16.8.zip"],
)
# Install transitive deps of rules_nodejs
load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies")
rules_nodejs_dependencies()
# These are the dependencies only for us
rules_angular_dev_dependencies()
# Install transitive deps of rules_typescript
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()
#
# Point Bazel to WORKSPACEs that live in subdirectories
#
# Fetch the rxjs repository since we build rxjs from source
# TODO(gregmagolan): use rxjs bundles in the bazel build
http_archive(
name = "rxjs",
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403",
@ -49,17 +28,25 @@ http_archive(
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
)
# Point to the integration test workspace just so that Bazel doesn't descend into it
# when expanding the //... pattern
local_repository(
name = "bazel_integration_test",
path = "integration/bazel",
# TODO(gregmagolan): do we still need go dependencies?
http_archive(
name = "io_bazel_rules_go",
sha256 = "b7a62250a3a73277ade0ce306d22f122365b513f5402222403e507f2f997d421",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.3/rules_go-0.16.3.tar.gz",
)
#
# Load and install our dependencies downloaded above.
#
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
# Use a mock @npm repository while we are building angular from source
# downstream. Angular will get its npm dependencies with in @ngdeps which
# is setup in ng_setup_workspace().
# TODO(gregmagolan): remove @ngdeps once angular is no longer build from source
# downstream and have build use @npm for npm dependencies
local_repository(
name = "npm",
path = "tools/npm_workspace",
)
# Check the bazel version and download npm dependencies
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
# Bazel version must be at least v0.21.0 because:
# - 0.21.0 Using --incompatible_strict_action_env flag fixes cache when running `yarn bazel`
@ -72,6 +59,7 @@ Try running `yarn bazel` instead.
""")
# Setup the Node.js toolchain
node_repositories(
node_version = "10.9.0",
package_json = ["//:package.json"],
@ -79,17 +67,34 @@ node_repositories(
yarn_version = "1.12.1",
)
local_repository(
name = "npm",
path = "tools/npm_workspace",
)
# Setup the angular toolchain which installs npm dependencies into @ngdeps
load("//tools:ng_setup_workspace.bzl", "ng_setup_workspace")
ng_setup_workspace()
# Install all bazel dependencies of the @ngdeps npm packages
load("@ngdeps//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
# Load angular dependencies
load("//packages/bazel:package.bzl", "rules_angular_dev_dependencies")
rules_angular_dev_dependencies()
# Load karma dependencies
load("@build_bazel_rules_karma//:package.bzl", "rules_karma_dependencies")
rules_karma_dependencies()
# TODO(gregmagolan): do we still need go dependencies?
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains()
# Setup the rules_webtesting toolchain
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
web_test_repositories()
@ -99,21 +104,17 @@ browser_repositories(
firefox = True,
)
# Setup the rules_typescript tooolchain
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
ts_setup_workspace()
load("@angular//:index.bzl", "ng_setup_workspace")
ng_setup_workspace()
##################################
# Skylark documentation generation
# Setup the rules_sass toolchain
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories()
# Setup the skydoc toolchain
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
skydoc_repositories()

View File

@ -32,8 +32,8 @@
"@angular/language-service": "file:../angular/dist/packages-dist/language-service",
"@bazel/bazel": "^0.21.0",
"@bazel/ibazel": "^0.9.0",
"@bazel/karma": "^0.22.1",
"@bazel/typescript": "^0.22.1",
"@bazel/karma": "^0.23.2",
"@bazel/typescript": "^0.23.2",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",

View File

@ -2,34 +2,14 @@ workspace(name = "bazel_integration_test")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
#
# Download Bazel toolchain dependencies as needed by build actions
#
local_repository(
name = "angular",
path = "../..",
)
# Fetch rules_nodejs so we can install our npm dependencies
http_archive(
name = "rxjs",
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403",
strip_prefix = "package/src",
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
name = "build_bazel_rules_nodejs",
strip_prefix = "rules_nodejs-0.16.8",
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.16.8.zip"],
)
load("@angular//packages/bazel:package.bzl", "rules_angular_dependencies")
rules_angular_dependencies()
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()
load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies")
rules_nodejs_dependencies()
# Fetch sass rules for compiling sass files
http_archive(
name = "io_bazel_rules_sass",
sha256 = "dbe9fb97d5a7833b2a733eebc78c9c1e3880f676ac8af16e58ccf2139cbcad03",
@ -37,31 +17,67 @@ http_archive(
url = "https://github.com/bazelbuild/rules_sass/archive/1.11.0.zip",
)
#
# Setup dependencies loaded above
#
# Fetch the angular repository since we build angular from source
# TODO(gregmagolan): use angular bundles in the Bazel build
local_repository(
name = "angular",
path = "../..",
)
# Fetch the rxjs repository since we build rxjs from source
# TODO(gregmagolan): use rxjs bundles in the Bazel build
http_archive(
name = "rxjs",
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403",
strip_prefix = "package/src",
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
)
# Check the bazel version and download npm dependencies
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
check_bazel_version("0.17.0")
# Bazel version must be at least v0.21.0 because:
# - 0.21.0 Using --incompatible_strict_action_env flag fixes cache when running `yarn bazel`
# (see https://github.com/angular/angular/issues/27514#issuecomment-451438271)
check_bazel_version("0.21.0", """
You no longer need to install Bazel on your machine.
Angular has a dependency on the @bazel/bazel package which supplies it.
Try running `yarn bazel` instead.
(If you did run that, check that you've got a fresh `yarn install`)
""")
# Setup the Node.js toolchain
node_repositories(
node_version = "10.9.0",
yarn_version = "1.12.1",
)
# Install our npm dependencies into @npm
yarn_install(
name = "npm",
package_json = "//src:package.json",
yarn_lock = "//src:yarn.lock",
)
# Install all bazel dependencies of our npm packages
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
# Load karma dependencies
load("@build_bazel_rules_karma//:package.bzl", "rules_karma_dependencies")
rules_karma_dependencies()
# TODO(gregmagolan): do we still need go dependencies?
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains()
# Setup the rules_webtesting toolchain
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
web_test_repositories()
@ -71,14 +87,17 @@ browser_repositories(
firefox = True,
)
# Setup the rules_typescript tooolchain
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
ts_setup_workspace()
# Setup the rules_sass toolchain
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories()
# Setup the angular toolchain
load("@angular//:index.bzl", "ng_setup_workspace")
ng_setup_workspace()

View File

@ -2,7 +2,8 @@ package(default_visibility = ["//visibility:public"])
load("@angular//:index.bzl", "ng_module", "ng_package")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test_suite")
load("@build_bazel_rules_karma//:defs.bzl", "ts_web_test_suite")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
sass_binary(
name = "hello-world-styles",

View File

@ -13,8 +13,8 @@
"@angular/bazel": "file:../angular/dist/packages-dist/bazel",
"@angular/compiler": "file:../angular/dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../angular/dist/packages-dist/compiler-cli",
"@bazel/karma": "0.22.1",
"@bazel/typescript": "0.22.1",
"@bazel/karma": "0.23.2",
"@bazel/typescript": "0.23.2",
"@types/jasmine": "2.8.8",
"@types/source-map": "0.5.1",
"protractor": "5.1.2",
@ -23,4 +23,4 @@
"scripts": {
"//": "TODO(gregmagolan): figure out how to keep dependencies here up to date with the root package.json"
}
}
}

View File

@ -35,8 +35,8 @@
"@angular-devkit/build-optimizer": "^0.12.2",
"@angular-devkit/core": "^7.0.4",
"@angular-devkit/schematics": "^7.3.0-rc.0",
"@bazel/karma": "~0.22.1",
"@bazel/typescript": "0.22.1-7-g68fed6a",
"@bazel/karma": "0.23.2",
"@bazel/typescript": "0.23.2",
"@schematics/angular": "^7.0.4",
"@types/angular": "^1.6.47",
"@types/base64-js": "1.2.5",
@ -151,4 +151,4 @@
"resolutions": {
"natives": "1.1.6"
}
}
}

View File

@ -9,41 +9,12 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
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
# Use a SHA to get fix for needing symlink_prefix during npm publishing
_maybe(
http_archive,
name = "build_bazel_rules_nodejs",
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.16.5.zip",
strip_prefix = "rules_nodejs-0.16.5",
)
_maybe(
http_archive,
name = "build_bazel_rules_typescript",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.22.1.zip",
strip_prefix = "rules_typescript-0.22.1",
)
# Needed for Remote Execution
_maybe(
http_archive,
name = "bazel_toolchains",
sha256 = "ee854b5de299138c1f4a2edb5573d22b21d975acfc7aa938f36d30b49ef97498",
strip_prefix = "bazel-toolchains-37419a124bdb9af2fec5b99a973d359b6b899b61",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/37419a124bdb9af2fec5b99a973d359b6b899b61.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/37419a124bdb9af2fec5b99a973d359b6b899b61.tar.gz",
],
)
print("""DEPRECATION WARNING:
rules_angular_dependencies 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 call to
load("@angular//:package.bzl", "rules_angular_dependencies")
""")
def rules_angular_dev_dependencies():
"""
@ -60,14 +31,16 @@ def rules_angular_dev_dependencies():
url = "https://github.com/google/brotli/archive/v1.0.5.zip",
)
# The TypeScript rules transitively fetch a version of "rules_webtesting", but the version
# does not include 239b491e8251588bb46297b899d306ae7024858e which updates the "chromedriver"
# version so that e2e tests are able to capture the browser console output. This is needed
# for a few e2e tests, so we manually fetch a version that includes that required SHA.
http_archive(
name = "io_bazel_rules_webtesting",
url = "https://github.com/bazelbuild/rules_webtesting/archive/1f430d5e1cae10efc953a6511147e21b3bc03a5d.zip",
strip_prefix = "rules_webtesting-1f430d5e1cae10efc953a6511147e21b3bc03a5d",
# Needed for Remote Execution
_maybe(
http_archive,
name = "bazel_toolchains",
sha256 = "ee854b5de299138c1f4a2edb5573d22b21d975acfc7aa938f36d30b49ef97498",
strip_prefix = "bazel-toolchains-37419a124bdb9af2fec5b99a973d359b6b899b61",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/37419a124bdb9af2fec5b99a973d359b6b899b61.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/37419a124bdb9af2fec5b99a973d359b6b899b61.tar.gz",
],
)
#############################################

View File

@ -15,7 +15,7 @@
"@angular-devkit/architect": "^0.10.6",
"@angular-devkit/core": "^7.0.4",
"@angular-devkit/schematics": "^7.3.0-rc.0",
"@bazel/typescript": "^0.22.1",
"@bazel/typescript": "^0.23.2",
"@schematics/angular": "^7.0.4",
"@types/node": "6.0.84",
"semver": "^5.6.0",
@ -38,4 +38,4 @@
"scripts": {
"postinstall": "node ./check_version.js"
}
}
}

View File

@ -5,17 +5,9 @@
"Install toolchain dependencies"
load("@build_bazel_rules_typescript//:defs.bzl", "check_rules_typescript_version")
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.
"""
# 0.16.0: minimal version required to work with ng_module
# 0.16.2: bazel type resolution for zone.js types
# 0.20.1: fine grained deps
# 0.20.2: version check fix
check_rules_typescript_version("0.20.2")

View File

@ -19,13 +19,6 @@ http_archive(
strip_prefix = "rules_nodejs-%s" % RULES_NODEJS_VERSION,
)
RULES_TYPESCRIPT_VERSION = "<%= RULES_TYPESCRIPT_VERSION %>"
http_archive(
name = "build_bazel_rules_typescript",
url = "https://github.com/bazelbuild/rules_typescript/archive/%s.zip" % RULES_TYPESCRIPT_VERSION,
strip_prefix = "rules_typescript-%s" % RULES_TYPESCRIPT_VERSION,
)
# The @angular repo contains rule for building Angular applications
ANGULAR_VERSION = "<%= ANGULAR_VERSION %>"
http_archive(
@ -53,15 +46,6 @@ http_archive(
####################################
# Load and install our dependencies downloaded above.
load("@angular//packages/bazel:package.bzl", "rules_angular_dependencies")
rules_angular_dependencies()
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()
load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies")
rules_nodejs_dependencies()
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
# 0.18.0 is needed for .bazelignore
check_bazel_version("0.18.0")
@ -72,6 +56,12 @@ yarn_install(
yarn_lock = "//:yarn.lock",
)
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
load("@build_bazel_rules_karma//:package.bzl", "rules_karma_dependencies")
rules_karma_dependencies()
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()

View File

@ -1,10 +1,10 @@
package(default_visibility = ["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test_suite")
load("@build_bazel_rules_karma//:defs.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("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver", "ts_library")
<% if (sass) { %>load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
[

View File

@ -92,7 +92,6 @@ export default function(options: BazelWorkspaceOptions): Rule {
const workspaceVersions = {
'RULES_NODEJS_VERSION': '0.16.5',
'RULES_TYPESCRIPT_VERSION': '0.22.1',
'ANGULAR_VERSION': existingVersions.Angular || clean(latestVersions.Angular),
'RXJS_VERSION': existingVersions.RxJs || clean(latestVersions.RxJs),
// TODO(kyliau): Consider moving this to latest-versions.ts

View File

@ -8,12 +8,12 @@
* @fileoverview Schematics for ng-new project that builds with Bazel.
*/
import {SchematicContext, apply, applyTemplates, chain, mergeWith, move, Rule, schematic, Tree, url, SchematicsException, UpdateRecorder,} from '@angular-devkit/schematics';
import {parseJsonAst, JsonAstObject, strings, JsonValue} from '@angular-devkit/core';
import {findPropertyInAstObject, insertPropertyInAstObjectInOrder} from '@schematics/angular/utility/json-utils';
import {validateProjectName} from '@schematics/angular/utility/validation';
import {getWorkspacePath} from '@schematics/angular/utility/config';
import {Schema} from './schema';
import { SchematicContext, apply, applyTemplates, chain, mergeWith, move, Rule, schematic, Tree, url, SchematicsException, UpdateRecorder, } from '@angular-devkit/schematics';
import { parseJsonAst, JsonAstObject, strings, JsonValue } from '@angular-devkit/core';
import { findPropertyInAstObject, insertPropertyInAstObjectInOrder } from '@schematics/angular/utility/json-utils';
import { validateProjectName } from '@schematics/angular/utility/validation';
import { getWorkspacePath } from '@schematics/angular/utility/config';
import { Schema } from './schema';
/**
* Packages that build under Bazel require additional dev dependencies. This
@ -40,18 +40,18 @@ function addDevDependenciesToPackageJson(options: Schema) {
}
const angularCoreVersion = angularCoreNode.value as string;
const devDependencies: {[k: string]: string} = {
const devDependencies: { [ k: string ]: string } = {
'@angular/bazel': angularCoreVersion,
// TODO(kyliau): Consider moving this to latest-versions.ts
'@bazel/bazel': '^0.22.1',
'@bazel/ibazel': '^0.9.0',
'@bazel/karma': '^0.22.1',
'@bazel/typescript': '^0.22.1',
'@bazel/karma': '^0.23.2',
'@bazel/typescript': '^0.23.2',
};
const recorder = host.beginUpdate(packageJson);
for (const packageName of Object.keys(devDependencies)) {
const version = devDependencies[packageName];
const version = devDependencies[ packageName ];
const indent = 4;
insertPropertyInAstObjectInOrder(recorder, devDeps, packageName, version, indent);
}
@ -103,23 +103,23 @@ function updateGitignore() {
}
function replacePropertyInAstObject(
recorder: UpdateRecorder, node: JsonAstObject, propertyName: string, value: JsonValue,
indent: number) {
recorder: UpdateRecorder, node: JsonAstObject, propertyName: string, value: JsonValue,
indent: number) {
const property = findPropertyInAstObject(node, propertyName);
if (property === null) {
throw new Error(`Property ${propertyName} does not exist in JSON object`);
}
const {start, text} = property;
const { start, text } = property;
recorder.remove(start.offset, text.length);
const indentStr = '\n' +
' '.repeat(indent);
' '.repeat(indent);
const content = JSON.stringify(value, null, ' ').replace(/\n/g, indentStr);
recorder.insertLeft(start.offset, content);
}
function updateAngularJsonToUseBazelBuilder(options: Schema): Rule {
return (host: Tree, context: SchematicContext) => {
const {name} = options;
const { name } = options;
const workspacePath = getWorkspacePath(host);
if (!workspacePath) {
throw new Error('Could not find angular.json');
@ -137,61 +137,61 @@ function updateAngularJsonToUseBazelBuilder(options: Schema): Rule {
const recorder = host.beginUpdate(workspacePath);
const indent = 8;
const architect =
findPropertyInAstObject(project as JsonAstObject, 'architect') as JsonAstObject;
findPropertyInAstObject(project as JsonAstObject, 'architect') as JsonAstObject;
replacePropertyInAstObject(
recorder, architect, 'build', {
builder: '@angular/bazel:build',
options: {
targetLabel: '//src:bundle.js',
bazelCommand: 'build',
},
configurations: {
production: {
targetLabel: '//src:bundle',
},
recorder, architect, 'build', {
builder: '@angular/bazel:build',
options: {
targetLabel: '//src:bundle.js',
bazelCommand: 'build',
},
configurations: {
production: {
targetLabel: '//src:bundle',
},
},
indent);
},
indent);
replacePropertyInAstObject(
recorder, architect, 'serve', {
builder: '@angular/bazel:build',
options: {
targetLabel: '//src:devserver',
bazelCommand: 'run',
},
configurations: {
production: {
targetLabel: '//src:prodserver',
},
recorder, architect, 'serve', {
builder: '@angular/bazel:build',
options: {
targetLabel: '//src:devserver',
bazelCommand: 'run',
},
configurations: {
production: {
targetLabel: '//src:prodserver',
},
},
indent);
},
indent);
replacePropertyInAstObject(
recorder, architect, 'test', {
builder: '@angular/bazel:build',
options: {'bazelCommand': 'test', 'targetLabel': '//src/...'},
},
indent);
recorder, architect, 'test', {
builder: '@angular/bazel:build',
options: { 'bazelCommand': 'test', 'targetLabel': '//src/...' },
},
indent);
const e2e = `${options.name}-e2e`;
const e2eNode = findPropertyInAstObject(projects as JsonAstObject, e2e);
if (e2eNode) {
const architect =
findPropertyInAstObject(e2eNode as JsonAstObject, 'architect') as JsonAstObject;
findPropertyInAstObject(e2eNode as JsonAstObject, 'architect') as JsonAstObject;
replacePropertyInAstObject(
recorder, architect, 'e2e', {
builder: '@angular/bazel:build',
options: {
bazelCommand: 'test',
targetLabel: '//e2e:devserver_test',
},
configurations: {
production: {
targetLabel: '//e2e:prodserver_test',
},
}
recorder, architect, 'e2e', {
builder: '@angular/bazel:build',
options: {
bazelCommand: 'test',
targetLabel: '//e2e:devserver_test',
},
indent);
configurations: {
production: {
targetLabel: '//e2e:prodserver_test',
},
}
},
indent);
}
host.commitUpdate(recorder);
@ -210,13 +210,13 @@ function backupAngularJson(): Rule {
return;
}
host.create(
`${workspacePath}.bak`, '// This is a backup file of the original angular.json. ' +
'This file is needed in case you want to revert to the workflow without Bazel.\n\n' +
host.read(workspacePath));
`${workspacePath}.bak`, '// This is a backup file of the original angular.json. ' +
'This file is needed in case you want to revert to the workflow without Bazel.\n\n' +
host.read(workspacePath));
};
}
export default function(options: Schema): Rule {
export default function (options: Schema): Rule {
return (host: Tree) => {
validateProjectName(options.name);

View File

@ -8,11 +8,11 @@
* @fileoverview Schematics for ng-new project that builds with Bazel.
*/
import {Rule, Tree, chain, externalSchematic, schematic} from '@angular-devkit/schematics';
import {validateProjectName} from '@schematics/angular/utility/validation';
import {Schema} from './schema';
import { Rule, Tree, chain, externalSchematic, schematic } from '@angular-devkit/schematics';
import { validateProjectName } from '@schematics/angular/utility/validation';
import { Schema } from './schema';
export default function(options: Schema): Rule {
export default function (options: Schema): Rule {
return (host: Tree) => {
validateProjectName(options.name);

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {PluginCompilerHost} from '@bazel/typescript/tsc_wrapped/plugin_api';
import {PluginCompilerHost} from '@bazel/typescript/internal/tsc_wrapped/plugin_api';
import * as ts from 'typescript';
/**

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {PluginCompilerHost, TscPlugin} from '@bazel/typescript/tsc_wrapped/plugin_api';
import {PluginCompilerHost, TscPlugin} from '@bazel/typescript/internal/tsc_wrapped/plugin_api';
import * as ts from 'typescript';
import {SyntheticFilesCompilerHost} from './synthetic_files_compiler_host';

View File

@ -1,7 +1,8 @@
"""Re-export of some bazel rules with repository-wide defaults."""
load("@build_bazel_rules_karma//:defs.bzl", _ts_web_test_suite = "ts_web_test_suite")
load("@build_bazel_rules_nodejs//:defs.bzl", _jasmine_node_test = "jasmine_node_test", _nodejs_binary = "nodejs_binary", _npm_package = "npm_package")
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library", _ts_web_test_suite = "ts_web_test_suite")
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library")
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
load("//packages/bazel/src:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle")

View File

@ -19,7 +19,8 @@ def ng_setup_workspace():
# The NodeJS rules version must be at least v0.15.3 because:
# - 0.15.2 Re-introduced the prod_only attribute on yarn_install
# - 0.15.3 Includes a fix for the `jasmine_node_test` rule ignoring target tags
check_rules_nodejs_version("0.15.3")
# - 0.16.8 Supports npm installed bazel workspaces
check_rules_nodejs_version("0.16.8")
yarn_install(
name = "ngdeps",

825
yarn.lock

File diff suppressed because it is too large Load Diff