Skip to content

Commit

Permalink
build: use rules_nodejs snapshot
Browse files Browse the repository at this point in the history
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs.

Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
  • Loading branch information
filipesilva authored and gregmagolan committed Apr 16, 2020
1 parent 4507c05 commit 4e7bcd3
Show file tree
Hide file tree
Showing 31 changed files with 98 additions and 47 deletions.
27 changes: 7 additions & 20 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:git.bzl", "git_repository")

http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "b6670f9f43faa66e3009488bbd909bc7bc46a5a9661a33f6bc578068d1837f37",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.3.0/rules_nodejs-1.3.0.tar.gz"],
sha256 = "7b96a7ce4d40e57d629b435eb948d17037d0c346d5b27aecc55078291b75699b",
urls = ["https://github.com/aspect-dev/rules_nodejs-builds/raw/1.5.0+1361843f/build_bazel_rules_nodejs-labs-snapshot.tar.gz"],
)

# We use protocol buffers for the Build Event Protocol
Expand Down Expand Up @@ -52,29 +52,17 @@ Try running `yarn bazel` instead.
# - 0.32.1 remove override of @bazel/tsetse & exclude typescript lib declarations in node_module_library transitive_declarations
# - 0.32.2 resolves bug in @bazel/hide-bazel-files postinstall step
# - 0.34.0 introduces protractor rule
check_rules_nodejs_version(minimum_version_string = "0.34.0")
check_rules_nodejs_version(minimum_version_string = "1.5.0")

# Setup the Node.js toolchain
node_repositories(
node_repositories = {
"10.16.0-darwin_amd64": ("node-v10.16.0-darwin-x64.tar.gz", "node-v10.16.0-darwin-x64", "6c009df1b724026d84ae9a838c5b382662e30f6c5563a0995532f2bece39fa9c"),
"10.16.0-linux_amd64": ("node-v10.16.0-linux-x64.tar.xz", "node-v10.16.0-linux-x64", "1827f5b99084740234de0c506f4dd2202a696ed60f76059696747c34339b9d48"),
"10.16.0-windows_amd64": ("node-v10.16.0-win-x64.zip", "node-v10.16.0-win-x64", "aa22cb357f0fb54ccbc06b19b60e37eefea5d7dd9940912675d3ed988bf9a059"),
"12.14.1-darwin_amd64": ("node-v12.14.1-darwin-x64.tar.gz", "node-v12.14.1-darwin-x64", "0be10a28737527a1e5e3784d3ad844d742fe8b0718acd701fd48f718fd3af78f"),
"12.14.1-linux_amd64": ("node-v12.14.1-linux-x64.tar.xz", "node-v12.14.1-linux-x64", "07cfcaa0aa9d0fcb6e99725408d9e0b07be03b844701588e3ab5dbc395b98e1b"),
"12.14.1-windows_amd64": ("node-v12.14.1-win-x64.zip", "node-v12.14.1-win-x64", "1f96ccce3ba045ecea3f458e189500adb90b8bc1a34de5d82fc10a5bf66ce7e3"),
},
node_version = "10.16.0",
node_version = "12.14.1",
package_json = ["//:package.json"],
yarn_repositories = {
"1.17.3": ("yarn-v1.17.3.tar.gz", "yarn-v1.17.3", "e3835194409f1b3afa1c62ca82f561f1c29d26580c9e220c36866317e043c6f3"),
},
# yarn 1.13.0 under Bazel has a regression on Windows that causes build errors on rebuilds:
# ```
# ERROR: Source forest creation failed: C:/.../fyuc5c3n/execroot/angular/external (Directory not empty)
# ```
# See https://github.com/angular/angular/pull/29431 for more information.
# It possible that versions of yarn past 1.13.0 do not have this issue, however, before
# advancing this version we need to test manually on Windows that the above error does not
# happen as the issue is not caught by CI.
yarn_version = "1.17.3",
)

yarn_install(
Expand All @@ -83,7 +71,6 @@ yarn_install(
"//:tools/yarn/check-yarn.js",
],
package_json = "//:package.json",
symlink_node_modules = False,
yarn_lock = "//:yarn.lock",
)

Expand Down
10 changes: 6 additions & 4 deletions etc/api/BUILD → etc/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ load("@npm_ts_api_guardian//:index.bzl", "ts_api_guardian_test")
),
# We don't want to analyse these exports nor add them to the golden files
# in most cases it's because Ts API Guardian doesn't support Symbol Aliases.
# Note: $ must be escaped to $$ because these patterns will be executed by shell
# and $ has a special meaning there.
strip_export_pattern = [
# @angular-devkit/architect
"^BuilderProgressState$",
"^BuilderProgressState$$",
# @angular-devkit/schematics
"^workflow$",
"^formats$",
"^workflow$$",
"^formats$$",
# @angular-devkit/build-optimizer
"^buildOptimizerLoader$",
"^buildOptimizerLoader$$",
],
# At the moment using this will ignore a big change
use_angular_tag_rules = False,
Expand Down
2 changes: 1 addition & 1 deletion etc/api/angular_devkit/architect/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export interface BuilderContext {
workspaceRoot: string;
addTeardown(teardown: () => (Promise<void> | void)): void;
getBuilderNameForTarget(target: Target): Promise<string>;
getProjectMetadata(target: Target): Promise<json.JsonObject>;
getProjectMetadata(projectName: string): Promise<json.JsonObject>;
getProjectMetadata(target: Target): Promise<json.JsonObject>;
getTargetOptions(target: Target): Promise<json.JsonObject>;
reportProgress(current: number, total?: number, status?: string): void;
reportRunning(): void;
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
"@angular/compiler-cli": "9.1.2",
"@bazel/bazel": "2.1.0",
"@bazel/buildifier": "0.29.0",
"@bazel/jasmine": "1.3.0",
"@bazel/karma": "1.3.0",
"@bazel/labs": "1.3.0",
"@bazel/typescript": "1.3.0",
"@bazel/jasmine": "https://github.com/aspect-dev/rules_nodejs-builds/raw/1.5.0+1361843f/@bazel_jasmine-labs-snapshot.tar.gz",
"@bazel/karma": "https://github.com/aspect-dev/rules_nodejs-builds/raw/1.5.0+1361843f/@bazel_karma-labs-snapshot.tar.gz",
"@bazel/labs": "https://github.com/aspect-dev/rules_nodejs-builds/raw/1.5.0+1361843f/@bazel_labs-labs-snapshot.tar.gz",
"@bazel/typescript": "https://github.com/aspect-dev/rules_nodejs-builds/raw/1.5.0+1361843f/@bazel_typescript-labs-snapshot.tar.gz",
"@types/babel__core": "7.1.7",
"@types/browserslist": "^4.4.0",
"@types/caniuse-lite": "^1.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ ts_library(
"**/*.json",
"**/*.md",
]),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular/cli",
# strict_checks = False,
deps = [
Expand Down Expand Up @@ -232,6 +234,8 @@ ts_library(
"**/*_spec_large.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# strict_checks = False,
tsconfig = "//:tsconfig-test.json",
deps = [
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/pwa/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ ts_library(
"pwa/files/**/*",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
deps = [
"//packages/angular_devkit/core",
"//packages/angular_devkit/schematics",
Expand All @@ -60,6 +62,8 @@ ts_library(
"pwa/**/*_spec_large.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# strict_checks = False,
tsconfig = "//:tsconfig-test.json",
deps = [
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/architect/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ ts_library(
],
# strict_checks = False,
data = glob(["**/*.json"]),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/architect",
module_root = "src/index.d.ts",
deps = [
Expand All @@ -72,6 +74,8 @@ ts_library(
"src/**/*_spec_large.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# strict_checks = False,
tsconfig = "//:tsconfig-test.json",
deps = [
Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/architect/node/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ts_library(
"**/*_spec_large.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/architect/node",
module_root = "index.d.ts",
# strict_checks = False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
}

async loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder> {
// f1 const is a temporary workaround for a TS bug with UMDs.
// See microsoft/TypeScript#36780. Should be removed when
// https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
const f1 = info.import;
const builder = (await import(f1)).default;
const builder = (await import(info.import)).default;
if (builder[BuilderSymbol]) {
return builder;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/architect/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ts_library(
"**/*_spec_large.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/architect/testing",
module_root = "index.d.ts",
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ export class TestingArchitectHost implements ArchitectHost {
this._builderMap.set(builderName, { builderName, description, optionSchema });
}
async addBuilderFromPackage(packageName: string) {
// f1 const is a temporary workaround for a TS bug with UMDs.
// See microsoft/TypeScript#36780. Should be removed when
// https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
const f1 = packageName + '/package.json';
const packageJson = await import(f1);
const packageJson = await import(packageName + '/package.json');
if (!('builders' in packageJson)) {
throw new Error('Invalid package.json, builders key not found.');
}
Expand All @@ -60,13 +56,8 @@ export class TestingArchitectHost implements ArchitectHost {
const b = builders[builderName];
// TODO: remove this check as v1 is not supported anymore.
if (!b.implementation) { continue; }
// f2 and f3 consts are a temporary workaround for a TS bug with UMDs.
// See microsoft/TypeScript#36780. Should be removed when
// https://github.com/bazelbuild/rules_typescript/pull/492 goes in.
const f2 = builderJsonPath + '/../' + b.implementation;
const handler = (await import(f2)).default;
const f3 = builderJsonPath + '/../' + b.schema;
const optionsSchema = await import(f3);
const handler = (await import(builderJsonPath + '/../' + b.implementation)).default;
const optionsSchema = await import(builderJsonPath + '/../' + b.schema);
this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema);
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/architect_cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ts_library(
srcs = [
"bin/architect.ts",
] + glob(["src/**/*.ts"]),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/architect-cli",
deps = [
"//packages/angular_devkit/architect",
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/benchmark/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ts_library(
"src/**/*_benchmark.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/benchmark",
module_root = "src/index.d.ts",
deps = [
Expand Down Expand Up @@ -50,6 +52,8 @@ ts_library(
"src/test/watch-test-file.txt",
"src/test/watch-test-script.js",
],
devmode_module = "commonjs",
devmode_target = "es2018",
# @external_begin
tsconfig = "//:tsconfig-test.json",
deps = [
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/build_optimizer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ ts_library(
"webpack-loader/package.json",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/build-optimizer",
module_root = "src/index.d.ts",
deps = [
Expand All @@ -52,6 +54,8 @@ ts_library(
"src/**/*_spec_large.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# @external_begin
tsconfig = "//:tsconfig-test.json",
deps = [
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/core/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ ts_library(
data = glob(["**/*.json"]) + [
"//packages/angular_devkit/core/third_party/github.com/chalk/supports-color",
],
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/core",
module_root = "src/index.d.ts",
# The attribute below is needed in g3 to turn off strict typechecking
Expand Down Expand Up @@ -61,6 +63,8 @@ ts_library(
"src/experimental/workspace/test/test-workspace.json",
"src/experimental/workspace/workspace-schema.json",
],
devmode_module = "commonjs",
devmode_target = "es2018",
# The attribute below is needed in g3 to turn off strict typechecking
# strict_checks = False,
# @external_begin
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/core/node/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ts_library(
"**/*_benchmark.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/core/node",
module_root = "index.d.ts",
# The attribute below is needed in g3 to turn off strict typechecking
Expand All @@ -43,6 +45,8 @@ ts_library(
"testing/**/*.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# @external_begin
tsconfig = "//:tsconfig-test.json",
# @external_end
Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/core/node/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ts_library(
"**/*_benchmark.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/core/node/testing",
module_root = "index.d.ts",
# The attribute below is needed in g3 to turn off strict typechecking
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ ts_library(
# The attribute below is needed in g3 to turn off strict typechecking
# strict_checks = False,
data = glob(["**/*.json"]),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/schematics",
module_root = "src/index.d.ts",
deps = [
Expand All @@ -48,6 +50,8 @@ ts_library(
"src/**/*_spec_large.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# @external_begin
tsconfig = "//:tsconfig-test.json",
# @external_end
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/schematics/tasks/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ts_library(
"tslint-fix/test/**/*",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/schematics/tasks",
module_root = "index.d.ts",
# The attribute below is needed in g3 to turn off strict typechecking
Expand Down Expand Up @@ -53,6 +55,8 @@ ts_library(
"tslint-fix/test/collection.json",
"tslint-fix/test/rules/customRuleRule.js",
],
devmode_module = "commonjs",
devmode_target = "es2018",
# The attribute below is needed in g3 to turn off strict typechecking
# strict_checks = False,
# @external_begin
Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/schematics/tasks/node/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ts_library(
"**/*_benchmark.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/schematics/tasks/node",
module_root = "index.d.ts",
# The attribute below is needed in g3 to turn off strict typechecking
Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/schematics/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ts_library(
srcs = glob(
include = ["**/*.ts"],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/schematics/testing",
module_root = "index.d.ts",
deps = [
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/schematics/tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ts_library(
"test/**/*.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/schematics/tools",
module_root = "index.d.ts",
# The attribute below is needed in g3 to turn off strict typechecking
Expand All @@ -44,6 +46,8 @@ ts_library(
"test/**/*.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# @external_begin
tsconfig = "//:tsconfig-test.json",
# @external_end
Expand Down
4 changes: 4 additions & 0 deletions packages/angular_devkit/schematics_cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ts_library(
# The attribute below is needed in g3 to turn off strict typechecking
# strict_checks = False,
data = glob(["**/*.json"]),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@angular-devkit/schematics-cli",
module_root = "bin/schematics.d.ts",
deps = [
Expand Down Expand Up @@ -51,6 +53,8 @@ ts_library(
"bin/**/*_spec.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# strict_checks = False,
tsconfig = "//:tsconfig-test.json",
deps = [
Expand Down
Loading

0 comments on commit 4e7bcd3

Please sign in to comment.