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

PR Close #28567
This commit is contained in:
Greg Magolan 2019-02-06 09:06:42 -08:00 committed by Matias Niemelä
parent 116512b06d
commit 2ee265fb1f
21 changed files with 439 additions and 2033 deletions

View File

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

View File

@ -1,17 +1,6 @@
workspace(name = "angular") workspace(name = "angular")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 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 # Uncomment for local bazel rules development
#local_repository( #local_repository(
@ -23,25 +12,15 @@ http_archive(
# path = "../rules_typescript", # path = "../rules_typescript",
#) #)
# Angular Bazel users will call this function # Fetch rules_nodejs so we can install our npm dependencies
rules_angular_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 # Fetch the rxjs repository since we build rxjs from source
load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies") # TODO(gregmagolan): use rxjs bundles in the bazel build
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
#
http_archive( http_archive(
name = "rxjs", name = "rxjs",
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403", sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403",
@ -49,17 +28,18 @@ http_archive(
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz", 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 # Use a mock @npm repository while we are building angular from source
# when expanding the //... pattern # 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( local_repository(
name = "bazel_integration_test", name = "npm",
path = "integration/bazel", path = "tools/npm_workspace",
) )
# # Check the bazel version and download npm dependencies
# Load and install our dependencies downloaded above. load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
#
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
# Bazel version must be at least v0.21.0 because: # 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` # - 0.21.0 Using --incompatible_strict_action_env flag fixes cache when running `yarn bazel`
@ -72,6 +52,7 @@ Try running `yarn bazel` instead.
""") """)
# Setup the Node.js toolchain
node_repositories( node_repositories(
node_version = "10.9.0", node_version = "10.9.0",
package_json = ["//:package.json"], package_json = ["//:package.json"],
@ -79,17 +60,27 @@ node_repositories(
yarn_version = "1.12.1", yarn_version = "1.12.1",
) )
local_repository( # Setup the angular toolchain which installs npm dependencies into @ngdeps
name = "npm", load("//tools:ng_setup_workspace.bzl", "ng_setup_workspace")
path = "tools/npm_workspace",
)
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") ng_setup_workspace()
go_rules_dependencies() # Install all bazel dependencies of the @ngdeps npm packages
load("@ngdeps//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
go_register_toolchains() 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()
# Setup the rules_webtesting toolchain
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories") load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
web_test_repositories() web_test_repositories()
@ -99,21 +90,17 @@ browser_repositories(
firefox = True, firefox = True,
) )
# Setup the rules_typescript tooolchain
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
ts_setup_workspace() ts_setup_workspace()
load("@angular//:index.bzl", "ng_setup_workspace") # Setup the rules_sass toolchain
ng_setup_workspace()
##################################
# Skylark documentation generation
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories() sass_repositories()
# Setup the skydoc toolchain
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories") load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
skydoc_repositories() skydoc_repositories()

View File

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

View File

@ -3,23 +3,44 @@
const fs = require('fs'); const fs = require('fs');
function replaceAngular(content) {
const regex = /ANGULAR_VERSION.*\nhttp_archive\((.*\n){4}\)/;
if (!regex.test(content)) {
throw new Error("Failed to find http_archive rule for Angular in WORKSPACE");
}
return content.replace(regex, `
local_repository(
name = "angular",
path = "../../..",
)`);
}
function replaceNpm(content) {
const regex = /yarn_install\((.*\n){4}\)/;
if (!regex.test(content)) {
throw new Error("Failed to find yarn_install rule for Angular in WORKSPACE");
}
return content.replace(regex, `
yarn_install(
name = "npm",
# Need a reference to @angular here so that Bazel sets up the
# external repository before calling yarn_install
data = ["@angular//:LICENSE"],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)`);
}
function main(argv) { function main(argv) {
argv = argv.slice(2); argv = argv.slice(2);
if (argv.length !== 1) { if (argv.length !== 1) {
throw new Error('Expect WORKSPACE to be first parameter'); throw new Error('Expect WORKSPACE to be first parameter');
} }
const workspace = argv[0]; const workspace = argv[0];
const content = fs.readFileSync(workspace, 'utf-8'); let content = fs.readFileSync(workspace, 'utf-8');
const regex = /ANGULAR_VERSION.*\nhttp_archive\((.*\n){4}\)/; content = replaceAngular(content);
if (!regex.test(content)) { content = replaceNpm(content);
throw new Error("Failed to find http_archive rule for Angular in WORKSPACE"); fs.writeFileSync(workspace, content);
}
const newContent = content.replace(regex, `
local_repository(
name = "angular",
path = "../../..",
)`);
fs.writeFileSync(workspace, newContent);
} }
main(process.argv) main(process.argv)

View File

@ -68,12 +68,12 @@
rxjs "6.3.3" rxjs "6.3.3"
"@angular/bazel@file:../../dist/packages-dist/bazel": "@angular/bazel@file:../../dist/packages-dist/bazel":
version "8.0.0-beta.1" version "8.0.0-beta.2"
dependencies: dependencies:
"@angular-devkit/architect" "^0.10.6" "@angular-devkit/architect" "^0.10.6"
"@angular-devkit/core" "^7.0.4" "@angular-devkit/core" "^7.0.4"
"@angular-devkit/schematics" "^7.3.0-rc.0" "@angular-devkit/schematics" "^7.3.0-rc.0"
"@bazel/typescript" "^0.22.1" "@bazel/typescript" "^0.23.2"
"@schematics/angular" "^7.0.4" "@schematics/angular" "^7.0.4"
"@types/node" "6.0.84" "@types/node" "6.0.84"
semver "^5.6.0" semver "^5.6.0"
@ -119,11 +119,12 @@
"@bazel/bazel-linux_x64" "0.22.0" "@bazel/bazel-linux_x64" "0.22.0"
"@bazel/bazel-win32_x64" "0.22.0" "@bazel/bazel-win32_x64" "0.22.0"
"@bazel/typescript@^0.22.1": "@bazel/typescript@^0.23.2":
version "0.22.1" version "0.23.2"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.22.1.tgz#b52c00e8560019e2f9d273d45c04785e0ec9d9bd" resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.23.2.tgz#a3ff199880855259d84216cb41644c1d9a0fad14"
integrity sha512-88DaCCnNg8rPlKP0eAQEZuoiJkEPeiItpUS3oBR1sFQNBRJb56D25ahK8+N6LJk4qaH+ZQ1/AHOPDhfEEWvDzA== integrity sha512-GrTyDW6Fvp/rgnxZGYampB5/QmDWvxtLEtUyMCPa/QXFR1OVxaMWeHxxuFEcES2UKJegqBDKAA8IzX21x4UbEw==
dependencies: dependencies:
jasmine-core "2.8.0"
protobufjs "5.0.3" protobufjs "5.0.3"
semver "5.6.0" semver "5.6.0"
source-map-support "0.5.9" source-map-support "0.5.9"
@ -1215,6 +1216,11 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
jasmine-core@2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e"
integrity sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=
json-parse-better-errors@^1.0.0: json-parse-better-errors@^1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"

View File

@ -2,34 +2,14 @@ workspace(name = "bazel_integration_test")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# # Fetch rules_nodejs so we can install our npm dependencies
# Download Bazel toolchain dependencies as needed by build actions
#
local_repository(
name = "angular",
path = "../..",
)
http_archive( http_archive(
name = "rxjs", name = "build_bazel_rules_nodejs",
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403", strip_prefix = "rules_nodejs-0.16.8",
strip_prefix = "package/src", urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.16.8.zip"],
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
) )
load("@angular//packages/bazel:package.bzl", "rules_angular_dependencies") # Fetch sass rules for compiling sass files
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()
http_archive( http_archive(
name = "io_bazel_rules_sass", name = "io_bazel_rules_sass",
sha256 = "dbe9fb97d5a7833b2a733eebc78c9c1e3880f676ac8af16e58ccf2139cbcad03", sha256 = "dbe9fb97d5a7833b2a733eebc78c9c1e3880f676ac8af16e58ccf2139cbcad03",
@ -37,31 +17,63 @@ http_archive(
url = "https://github.com/bazelbuild/rules_sass/archive/1.11.0.zip", url = "https://github.com/bazelbuild/rules_sass/archive/1.11.0.zip",
) )
# # Fetch the angular repository since we build angular from source
# Setup dependencies loaded above # 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") 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_repositories(
node_version = "10.9.0", node_version = "10.9.0",
yarn_version = "1.12.1", yarn_version = "1.12.1",
) )
# Install our npm dependencies into @npm
yarn_install( yarn_install(
name = "npm", name = "npm",
# Need a reference to @angular here so that Bazel sets up the
# external repository before calling yarn_install
data = ["@angular//:LICENSE"],
package_json = "//src:package.json", package_json = "//src:package.json",
yarn_lock = "//src:yarn.lock", yarn_lock = "//src:yarn.lock",
) )
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") # Install all bazel dependencies of our npm packages
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
go_rules_dependencies() install_bazel_dependencies()
go_register_toolchains() # Load karma dependencies
load("@build_bazel_rules_karma//:package.bzl", "rules_karma_dependencies")
rules_karma_dependencies()
# Setup the rules_webtesting toolchain
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories") load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
web_test_repositories() web_test_repositories()
@ -71,14 +83,17 @@ browser_repositories(
firefox = True, firefox = True,
) )
# Setup the rules_typescript tooolchain
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
ts_setup_workspace() ts_setup_workspace()
# Setup the rules_sass toolchain
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories() sass_repositories()
# Setup the angular toolchain
load("@angular//:index.bzl", "ng_setup_workspace") load("@angular//:index.bzl", "ng_setup_workspace")
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("@angular//:index.bzl", "ng_module", "ng_package")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary") 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( sass_binary(
name = "hello-world-styles", name = "hello-world-styles",

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -35,8 +35,8 @@
"@angular-devkit/build-optimizer": "^0.12.2", "@angular-devkit/build-optimizer": "^0.12.2",
"@angular-devkit/core": "^7.0.4", "@angular-devkit/core": "^7.0.4",
"@angular-devkit/schematics": "^7.3.0-rc.0", "@angular-devkit/schematics": "^7.3.0-rc.0",
"@bazel/karma": "~0.22.1", "@bazel/karma": "0.23.2",
"@bazel/typescript": "~0.22.1", "@bazel/typescript": "0.23.2",
"@schematics/angular": "^7.0.4", "@schematics/angular": "^7.0.4",
"@types/chokidar": "1.7.3", "@types/chokidar": "1.7.3",
"@types/convert-source-map": "^1.5.1", "@types/convert-source-map": "^1.5.1",
@ -151,4 +151,4 @@
"resolutions": { "resolutions": {
"natives": "1.1.6" "natives": "1.1.6"
} }
} }

View File

@ -9,41 +9,12 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def rules_angular_dependencies(): def rules_angular_dependencies():
""" print("""DEPRECATION WARNING:
Fetch our transitive dependencies. 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.
If the user wants to get a different version of these, they can just fetch it Simply remove any calls to this function and the corresponding call to
from their WORKSPACE before calling this function, or not call this function at all. load("@angular//:package.bzl", "rules_angular_dependencies")
""" """)
#
# 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",
],
)
def rules_angular_dev_dependencies(): def rules_angular_dev_dependencies():
""" """
@ -60,6 +31,18 @@ def rules_angular_dev_dependencies():
url = "https://github.com/google/brotli/archive/v1.0.5.zip", url = "https://github.com/google/brotli/archive/v1.0.5.zip",
) )
# 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",
],
)
############################################# #############################################
# Dependencies for generating documentation # # Dependencies for generating documentation #
############################################# #############################################

View File

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

View File

@ -5,17 +5,9 @@
"Install toolchain dependencies" "Install toolchain dependencies"
load("@build_bazel_rules_typescript//:defs.bzl", "check_rules_typescript_version")
def ng_setup_workspace(): def ng_setup_workspace():
"""This repository rule should be called from your WORKSPACE file. """This repository rule should be called from your WORKSPACE file.
It creates some additional Bazel external repositories that are used internally It creates some additional Bazel external repositories that are used internally
by the Angular rules. 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, 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 # The @angular repo contains rule for building Angular applications
ANGULAR_VERSION = "<%= ANGULAR_VERSION %>" ANGULAR_VERSION = "<%= ANGULAR_VERSION %>"
http_archive( http_archive(
@ -53,15 +46,6 @@ http_archive(
#################################### ####################################
# Load and install our dependencies downloaded above. # 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") load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
# 0.18.0 is needed for .bazelignore # 0.18.0 is needed for .bazelignore
check_bazel_version("0.18.0") check_bazel_version("0.18.0")
@ -72,9 +56,11 @@ yarn_install(
yarn_lock = "//:yarn.lock", yarn_lock = "//:yarn.lock",
) )
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
go_rules_dependencies() install_bazel_dependencies()
go_register_toolchains()
load("@build_bazel_rules_karma//:package.bzl", "rules_karma_dependencies")
rules_karma_dependencies()
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories") load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
web_test_repositories() web_test_repositories()

View File

@ -1,10 +1,10 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("@angular//:index.bzl", "ng_module") 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//:defs.bzl", "rollup_bundle", "history_server")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package") 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") <% if (sass) { %>load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
[ [

View File

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

View File

@ -43,8 +43,8 @@ function addDevDependenciesToPackageJson(options: Schema) {
// TODO(kyliau): Consider moving this to latest-versions.ts // TODO(kyliau): Consider moving this to latest-versions.ts
'@bazel/bazel': '^0.22.1', '@bazel/bazel': '^0.22.1',
'@bazel/ibazel': '^0.9.0', '@bazel/ibazel': '^0.9.0',
'@bazel/karma': '^0.22.1', '@bazel/karma': '^0.23.2',
'@bazel/typescript': '^0.22.1', '@bazel/typescript': '^0.23.2',
}; };
const recorder = host.beginUpdate(packageJson); const recorder = host.beginUpdate(packageJson);

View File

@ -59,11 +59,12 @@
"@angular-devkit/core" "7.3.0-rc.0" "@angular-devkit/core" "7.3.0-rc.0"
rxjs "6.3.3" rxjs "6.3.3"
"@bazel/typescript@^0.22.1": "@bazel/typescript@^0.23.2":
version "0.22.1" version "0.23.2"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.22.1.tgz#b52c00e8560019e2f9d273d45c04785e0ec9d9bd" resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.23.2.tgz#a3ff199880855259d84216cb41644c1d9a0fad14"
integrity sha512-88DaCCnNg8rPlKP0eAQEZuoiJkEPeiItpUS3oBR1sFQNBRJb56D25ahK8+N6LJk4qaH+ZQ1/AHOPDhfEEWvDzA== integrity sha512-GrTyDW6Fvp/rgnxZGYampB5/QmDWvxtLEtUyMCPa/QXFR1OVxaMWeHxxuFEcES2UKJegqBDKAA8IzX21x4UbEw==
dependencies: dependencies:
jasmine-core "2.8.0"
protobufjs "5.0.3" protobufjs "5.0.3"
semver "5.6.0" semver "5.6.0"
source-map-support "0.5.9" source-map-support "0.5.9"
@ -755,6 +756,11 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
jasmine-core@2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e"
integrity sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=
json-schema-traverse@^0.4.1: json-schema-traverse@^0.4.1:
version "0.4.1" version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"

View File

@ -1,7 +1,8 @@
"""Re-export of some bazel rules with repository-wide defaults.""" """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_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:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
load("//packages/bazel/src:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle") 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: # 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.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 # - 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( yarn_install(
name = "ngdeps", name = "ngdeps",

825
yarn.lock

File diff suppressed because it is too large Load Diff