Skip to content

Commit aab59c1

Browse files
refactor(devtools): dedupe some bazel tooling brought in from angular/components
Some tooling was brought in from angular/components to help with bundling spec files for Karma. This tooling has since been ported over to the dev-infra repo. This commit dedupes the tooling and instead depends on the angular/dev-infra-private repo.
1 parent 6a659a5 commit aab59c1

18 files changed

+96
-1034
lines changed

devtools/.bazelrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ build:remote --google_default_credentials
2222

2323
build --config=remote
2424

25-
import ../.bazelrc
25+
import ../.bazelrc
26+
27+
build --flag_alias=partial_compilation=@npm//@angular/bazel/src:partial_compilation

devtools/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"@angular/bazel": "13.0.1",
6262
"@angular/cli": "github:angular/cli-builds#858ee211470523d39a9ff16b57b676be740f77cc",
6363
"@angular/compiler-cli": "github:angular/compiler-cli-builds#89c6b3464f3f46a9f46334825bbff3d784af4136",
64-
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#2cfe4b98a157927b319a3a00b467ff6233dc3337",
64+
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#c55a3937d45945489714273bfbbe9b803ceff89e",
6565
"@angular/elements": "github:angular/elements-builds#55c36f9d5381ffc06649a03bff3c2934b18ddd02",
6666
"@angular/language-service": "github:angular/language-service-builds#e16ca91c029934dde01557efcf860e2465629655",
6767
"@angular/localize": "13.0.1",

devtools/tools/BUILD.bazel

-27
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,3 @@
1-
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
2-
31
exports_files([
42
"karma.conf.js",
53
])
6-
7-
# Dupe from angular/components
8-
#
9-
# todo(aleksanderbodurri): Remove this when when spec-bundling bazel logic is moved to
10-
# dev-infra repo
11-
12-
config_setting(
13-
name = "partial_compilation_enabled",
14-
flag_values = {
15-
"@npm//@angular/bazel/src:partial_compilation": "True",
16-
},
17-
)
18-
19-
bool_flag(
20-
name = "force_partial_jit_compilation",
21-
build_setting_default = False,
22-
)
23-
24-
config_setting(
25-
name = "force_partial_jit_compilation_enabled",
26-
flag_values = {
27-
"@npm//@angular/bazel/src:partial_compilation": "True",
28-
":force_partial_jit_compilation": "True",
29-
},
30-
)

devtools/tools/angular/BUILD.bazel

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
2-
load("//tools/esbuild:index.bzl", "esbuild_config")
1+
load("@npm//@angular/dev-infra-private/bazel/esbuild:index.bzl", "esbuild_config")
32
load(":index.bzl", "create_angular_bundle_targets")
43

54
package(default_visibility = ["//visibility:public"])
65

7-
js_library(
8-
name = "create_linker_esbuild_plugin",
9-
srcs = ["create_linker_esbuild_plugin.mjs"],
10-
deps = [
11-
"@npm//@angular/compiler-cli",
12-
"@npm//@babel/core",
13-
],
14-
)
15-
166
esbuild_config(
177
name = "esbuild_config",
188
config_file = "esbuild.config.mjs",
199
deps = [
20-
":create_linker_esbuild_plugin",
10+
"@npm//@angular/dev-infra-private/shared-scripts/angular-linker:js_lib",
2111
],
2212
)
2313

devtools/tools/angular/create_linker_esbuild_plugin.mjs

-85
This file was deleted.

devtools/tools/angular/esbuild.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {createLinkerEsbuildPlugin} from './create_linker_esbuild_plugin.mjs';
9+
import { createLinkerEsbuildPlugin } from '@angular/dev-infra-private/shared-scripts/angular-linker/esbuild-plugin.mjs';
1010

1111
export default {
1212
// Note: We support `.mjs` here as this is the extension used by Angular APF packages.

devtools/tools/angular/index.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("//:packages.bzl", "ANGULAR_PACKAGES")
2-
load("//tools/esbuild:index.bzl", "esbuild")
2+
load("@npm//@angular/dev-infra-private/bazel/esbuild:index.bzl", "esbuild")
33
load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "LinkerPackageMappingInfo")
44
load("@build_bazel_rules_nodejs//:providers.bzl", "ExternalNpmPackageInfo", "JSModuleInfo")
55

devtools/tools/defaults.bzl

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# Re-export of Bazel rules with repository-wide defaults
22

33
load("@npm//@bazel/concatjs:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
4-
load("//tools/spec-bundling:index.bzl", "spec_bundle")
4+
load("@npm//@angular/dev-infra-private/bazel/esbuild:index.bzl", _esbuild = "esbuild", _esbuild_config = "esbuild_config")
5+
load("@npm//@angular/dev-infra-private/bazel/spec-bundling:index.bzl", _spec_bundle = "spec_bundle")
6+
load("@npm//@angular/dev-infra-private/bazel:extract_js_module_output.bzl", "extract_js_module_output")
7+
load("//tools/angular:index.bzl", "LINKER_PROCESSED_FW_PACKAGES")
8+
9+
esbuild = _esbuild
10+
esbuild_config = _esbuild_config
511

612
def karma_web_test_suite(name, **kwargs):
713
web_test_args = {}
@@ -23,6 +29,8 @@ def karma_web_test_suite(name, **kwargs):
2329
# Note: when changing the browser names here, also update the "yarn test"
2430
# script to reflect the new browser names.
2531
"@npm//@angular/dev-infra-private/bazel/browsers/chromium:chromium",
32+
33+
# todo(aleksanderbodurri): enable when firefox support is done
2634
# "@npm//@angular/dev-infra-private/bazel/browsers/firefox:firefox",
2735
]
2836

@@ -54,3 +62,25 @@ def karma_web_test_suite(name, **kwargs):
5462
name = name,
5563
**kwargs
5664
)
65+
66+
def spec_bundle(name, deps, **kwargs):
67+
extract_js_module_output(
68+
name = "%s_devmode_deps" % name,
69+
deps = deps,
70+
provider = "JSModuleInfo",
71+
forward_linker_mappings = True,
72+
include_external_npm_packages = True,
73+
include_default_files = False,
74+
include_declarations = False,
75+
testonly = True,
76+
)
77+
78+
_spec_bundle(
79+
name = name,
80+
# For specs, we always add the pre-processed linker FW packages so that these
81+
# are resolved instead of the unprocessed FW entry-points through the `node_modules`.
82+
deps = ["%s_devmode_deps" % name] + LINKER_PROCESSED_FW_PACKAGES,
83+
workspace_name = "angular_devtools",
84+
run_angular_linker = True,
85+
**kwargs
86+
)

devtools/tools/esbuild/BUILD.bazel

-1
This file was deleted.

devtools/tools/esbuild/devmode-output.bzl

-43
This file was deleted.

devtools/tools/esbuild/esbuild-amd-config.mjs

-24
This file was deleted.

devtools/tools/esbuild/index.bzl

-52
This file was deleted.

0 commit comments

Comments
 (0)