Skip to content

build: fix errors against latest @angular/bazel version #20779

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Add NodeJS rules
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "84abf7ac4234a70924628baa9a73a5a5cbad944c4358cf9abdb4aab29c9a5b77",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.7.0/rules_nodejs-1.7.0.tar.gz"],
sha256 = "4952ef879704ab4ad6729a29007e7094aef213ea79e9f2e94cbe1c9a753e63ef",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.2.0/rules_nodejs-2.2.0.tar.gz"],
)

# Add sass rules
Expand Down Expand Up @@ -67,15 +67,14 @@ yarn_install(
# Install all bazel dependencies of the @ngdeps npm packages
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")

install_bazel_dependencies()

# Setup TypeScript Bazel workspace
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")

ts_setup_workspace()
install_bazel_dependencies(
# TODO(crisbeto): supress warnings for now so everything works like it has until now.
# Eventually we should remove it and re-test everything.
suppress_warning = True,
)

# Fetch transitive dependencies which are needed to use the karma rules.
load("@npm_bazel_karma//:package.bzl", "npm_bazel_karma_dependencies")
load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies")

npm_bazel_karma_dependencies()

Expand Down
4 changes: 2 additions & 2 deletions integration/size-test/index.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "nodejs_test")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_terser//:index.bzl", "terser_minified")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("@npm//@bazel/terser:index.bzl", "terser_minified")
load("//tools:defaults.bzl", "ng_module")
load("//tools:expand_template.bzl", "expand_template")

Expand Down
7 changes: 4 additions & 3 deletions integration/ts-compat/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {relative, sep, join} = require('path');
const {readdirSync, readFileSync, existsSync} = require('fs');
const {readdirSync, readFileSync, existsSync, unlinkSync} = require('fs');
const {set, ln, rm, mkdir} = require('shelljs');
const {fork} = require('child_process');
const runfiles = require(process.env.BAZEL_NODE_RUNFILES_HELPER);
Expand Down Expand Up @@ -30,7 +30,7 @@ exports.runTypeScriptCompatibilityTest = async (tscBinPath) => {
// be compiled without path mappings (simulating a real project).
for (const {name, pkgPath} of npmPackages) {
console.info(`Linking "@angular/${name}" into node modules..`);
ln('-s', pkgPath, join(angularDir, name));
ln('-sf', pkgPath, join(angularDir, name));
}

const tscArgs = [
Expand All @@ -49,7 +49,8 @@ exports.runTypeScriptCompatibilityTest = async (tscBinPath) => {
// Remove symlinks to keep a clean repository state.
for (const {name} of npmPackages) {
console.info(`Removing link for "@angular/${name}"..`);
rm(join(angularDir, name));
unlinkSync(join(angularDir, name));
rm('-rf', join(angularDir, name));
}
exitCode === 0 ? resolve() : reject();
});
Expand Down
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
},
"version": "11.0.0-next.1",
"dependencies": {
"@angular/animations": "^11.0.0-next.5",
"@angular/common": "^11.0.0-next.5",
"@angular/compiler": "^11.0.0-next.5",
"@angular/core": "^11.0.0-next.5",
"@angular/elements": "^11.0.0-next.5",
"@angular/forms": "^11.0.0-next.5",
"@angular/platform-browser": "^11.0.0-next.5",
"@angular/animations": "^11.0.0-next.6",
"@angular/common": "^11.0.0-next.6",
"@angular/compiler": "^11.0.0-next.6",
"@angular/core": "^11.0.0-next.6",
"@angular/elements": "^11.0.0-next.6",
"@angular/forms": "^11.0.0-next.6",
"@angular/platform-browser": "^11.0.0-next.6",
"@types/googlemaps": "^3.39.3",
"@types/youtube": "^0.0.38",
"@webcomponents/custom-elements": "^1.1.0",
Expand All @@ -69,28 +69,28 @@
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-optimizer": "^0.1100.0-next.5",
"@angular-devkit/core": "^11.0.0-next.5",
"@angular-devkit/schematics": "^11.0.0-next.5",
"@angular/bazel": "^11.0.0-next.5",
"@angular-devkit/build-optimizer": "^0.1100.0-next.6",
"@angular-devkit/core": "^11.0.0-next.6",
"@angular-devkit/schematics": "^11.0.0-next.6",
"@angular/bazel": "^11.0.0-next.6",
"@angular/benchpress": "0.2.1",
"@angular/compiler-cli": "^11.0.0-next.5",
"@angular/compiler-cli": "^11.0.0-next.6",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#f8bc880d554d45ca8bf881b8a776f00f61b918fb",
"@angular/platform-browser-dynamic": "^11.0.0-next.5",
"@angular/platform-server": "^11.0.0-next.5",
"@angular/router": "^11.0.0-next.5",
"@angular/platform-browser-dynamic": "^11.0.0-next.6",
"@angular/platform-server": "^11.0.0-next.6",
"@angular/router": "^11.0.0-next.6",
"@bazel/bazelisk": "^1.4.0",
"@bazel/buildifier": "^2.2.1",
"@bazel/ibazel": "^0.13.0",
"@bazel/jasmine": "^1.7.0",
"@bazel/karma": "^1.7.0",
"@bazel/protractor": "^1.7.0",
"@bazel/rollup": "^1.7.0",
"@bazel/terser": "^1.7.0",
"@bazel/typescript": "^1.7.0",
"@bazel/jasmine": "^2.2.0",
"@bazel/karma": "^2.2.0",
"@bazel/protractor": "^2.2.0",
"@bazel/rollup": "^2.2.0",
"@bazel/terser": "^2.2.0",
"@bazel/typescript": "^2.2.0",
"@firebase/app-types": "^0.3.2",
"@octokit/rest": "16.28.7",
"@schematics/angular": "^11.0.0-next.5",
"@schematics/angular": "^11.0.0-next.6",
"@types/autoprefixer": "^9.7.2",
"@types/browser-sync": "^2.26.1",
"@types/fs-extra": "^4.0.3",
Expand Down Expand Up @@ -128,6 +128,7 @@
"highlight.js": "^9.11.0",
"husky": "^4.3.0",
"inquirer": "^7.1.0",
"jasmine": "^3.5.0",
"jasmine-core": "^3.5.0",
"kagekiri": "^1.0.18",
"karma": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_typescript//:index.bzl", "ts_config")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("//src/cdk:config.bzl", "CDK_ENTRYPOINTS")
load("//src/material:config.bzl", "MATERIAL_ENTRYPOINTS", "MATERIAL_TESTING_ENTRYPOINTS")
load("//tools/dgeni:index.bzl", "dgeni_api_docs")
Expand Down
13 changes: 9 additions & 4 deletions src/cdk/schematics/testing/resolve-bazel-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ export function resolveBazelPath(parent: string, relativePath: string) {
for (const projectDir of projectDirs) {
const relativeParent = path.relative(projectDir, parent);
const workspacePath = path.join(relativeParent, relativePath).replace(/\\/g, '/');
const result = runfiles.resolveWorkspaceRelative(workspacePath);
if (result) {
return result;
}

try {
// In newer versions `resolveWorkspaceRelative` throws an error if it doesn't succeed.
const result = runfiles.resolveWorkspaceRelative(workspacePath);

if (result) {
return result;
}
} catch {}
}

throw Error(`Could not resolve path. Looked in: ${projectDirs.join(', ')}`);
Expand Down
2 changes: 1 addition & 1 deletion src/components-examples/material/datepicker/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_typescript//:index.bzl", "ts_config")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("//tools:defaults.bzl", "ng_module")

package(default_visibility = ["//visibility:public"])
Expand Down
2 changes: 1 addition & 1 deletion src/e2e-app/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")
load("@npm//@bazel/typescript:index.bzl", "ts_devserver")
load("//:packages.bzl", "getAngularUmdTargets")
load("//tools:defaults.bzl", "ng_module", "sass_binary")

Expand Down
2 changes: 1 addition & 1 deletion src/material-moment-adapter/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_typescript//:index.bzl", "ts_config")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("//tools:defaults.bzl", "ng_module", "ng_package", "ng_test_library", "ng_web_test_suite")

package(default_visibility = ["//visibility:public"])
Expand Down
10 changes: 5 additions & 5 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Re-export of Bazel rules with repository-wide defaults

load("@io_bazel_rules_sass//:defs.bzl", _sass_binary = "sass_binary", _sass_library = "sass_library")
load("@npm_angular_bazel//:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test")
load("@npm_bazel_karma//:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
load("@npm_bazel_protractor//:index.bzl", _protractor_web_test_suite = "protractor_web_test_suite")
load("@npm_bazel_typescript//:index.bzl", _ts_library = "ts_library")
load("@npm//@angular/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmine_node_test")
load("@npm//@bazel/karma:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
load("@npm//@bazel/protractor:index.bzl", _protractor_web_test_suite = "protractor_web_test_suite")
load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library")
load("//:packages.bzl", "VERSION_PLACEHOLDER_REPLACEMENTS", "getAngularUmdTargets")
load("//:rollup-globals.bzl", "ROLLUP_GLOBALS")
load("//tools/markdown-to-html:index.bzl", _markdown_to_html = "markdown_to_html")
Expand Down
Loading