Skip to content

Commit

Permalink
build: use rules_nodejs 1.6.0 features
Browse files Browse the repository at this point in the history
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 dgp1130 committed Apr 30, 2020
1 parent 63e668f commit eceb5cd
Show file tree
Hide file tree
Showing 30 changed files with 92 additions and 29 deletions.
11 changes: 5 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ 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.22.4": ("yarn-v1.22.4.tar.gz", "yarn-v1.22.4", "bc5316aa110b2f564a71a3d6e235be55b98714660870c5b6b2d2d3f12587fb58"),
Expand All @@ -75,7 +75,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
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
4 changes: 4 additions & 0 deletions packages/ngtools/webpack/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ ts_library(
"package.json",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@ngtools/webpack",
module_root = "src/index.d.ts",
deps = [
Expand All @@ -55,6 +57,8 @@ ts_library(
"src/**/*_spec_helpers.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
tsconfig = "//:tsconfig-test.json",
deps = [
":webpack",
Expand Down
5 changes: 4 additions & 1 deletion packages/schematics/angular/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ ts_library(
"*/other-files/**/*",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
module_name = "@schematics/angular",
deps = [
"//packages/angular_devkit/core",
Expand Down Expand Up @@ -87,10 +89,11 @@ ts_library(
srcs = glob(
include = [
"**/*_spec.ts",
"**/*_spec_large.ts",
"utility/test/**/*.ts",
],
),
devmode_module = "commonjs",
devmode_target = "es2018",
# @external_begin
tsconfig = "//:tsconfig-test.json",
deps = [
Expand Down
Loading

0 comments on commit eceb5cd

Please sign in to comment.