Skip to content

Commit 69d0b4d

Browse files
committed
build: remove references to ng_module rule
This commit removes references to the `ng_module` rule.
1 parent b7510ad commit 69d0b4d

File tree

7 files changed

+36
-179
lines changed

7 files changed

+36
-179
lines changed

.bazelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ build --nobuild_runfile_links
3535
###############################
3636

3737
# A more useful default output mode for bazel query
38-
# Prints eg. "ng_module rule //foo:bar" rather than just "//foo:bar"
38+
# Prints eg. "ng_project rule //foo:bar" rather than just "//foo:bar"
3939
query --output=label_kind
4040

4141
# By default, failing tests don't print any output, it goes to the log file

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ yarn_install(
112112
"//:.yarn/releases/yarn-1.22.17.cjs",
113113
"//:.yarnrc",
114114
"//:tools/postinstall/apply-patches.js",
115-
"//:tools/postinstall/patches/@angular+bazel+20.0.0-next.1.patch",
115+
"//:tools/postinstall/patches/@angular+bazel+20.0.0-next.3.patch",
116116
"//:tools/postinstall/patches/@angular+build-tooling+0.0.0-1ebf18a3a60b182a3dbad12e9a149fd93af5c29b.patch",
117117
"//:tools/postinstall/patches/tsec+0.2.2.patch",
118118
"//src/cdk:package.json",

src/cdk/keycodes/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ load("//tools:defaults2.bzl", "ng_project", "ts_project")
33

44
package(default_visibility = ["//visibility:public"])
55

6-
# We need to use "ng_module" here since we want metadata to be generated for keycode
6+
# We need to use "ng_project" here since we want metadata to be generated for keycode
77
# constants. This is necessary because some of these constants are statically used in
88
# component/directive metadata (e.g. chips) and NGC needs to be able to evaluate these
99
# at compile time.

src/components-examples/config.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ALL_EXAMPLES = [
22
# TODO(devversion): try to have for each entry-point a bazel package so that
33
# we can automate this using the "package.bzl" variables. Currently generated
4-
# with "bazel query 'kind("ng_module", //src/components-examples/...:*)' --output="label"
4+
# with "bazel query 'kind("ng_project", //src/components-examples/...:*)' --output="label"
55
"//src/components-examples/material/tree",
66
"//src/components-examples/material/tooltip",
77
"//src/components-examples/material/toolbar",

tools/defaults.bzl

+2-44
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
load("@rules_pkg//:pkg.bzl", "pkg_tar")
44
load("@build_bazel_rules_nodejs//:index.bzl", _pkg_npm = "pkg_npm")
55
load("@io_bazel_rules_sass//:defs.bzl", _npm_sass_library = "npm_sass_library", _sass_binary = "sass_binary", _sass_library = "sass_library")
6-
load("@npm//@angular/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
6+
load("@npm//@angular/bazel:index.bzl", _ng_package = "ng_package")
77
load("@npm//@angular/build-tooling/bazel/integration:index.bzl", _integration_test = "integration_test")
88
load("@npm//@angular/build-tooling/bazel/karma:index.bzl", _karma_web_test_suite = "karma_web_test_suite")
99
load("@npm//@angular/build-tooling/bazel/esbuild:index.bzl", _esbuild = "esbuild", _esbuild_config = "esbuild_config")
@@ -18,7 +18,6 @@ load("//:pkg-externals.bzl", "PKG_EXTERNALS")
1818
load("//tools/markdown-to-html:index.bzl", _markdown_to_html = "markdown_to_html")
1919
load("//tools/extract-tokens:index.bzl", _extract_tokens = "extract_tokens")
2020
load("//tools/angular:index.bzl", "LINKER_PROCESSED_FW_PACKAGES")
21-
load("//tools/bazel:module_name.bzl", "compute_module_name")
2221

2322
_DEFAULT_TSCONFIG_BUILD = "//src:bazel-tsconfig-build.json"
2423
_DEFAULT_TSCONFIG_TEST = "//src:tsconfig-test"
@@ -67,47 +66,6 @@ def sass_library(**kwargs):
6766
def npm_sass_library(**kwargs):
6867
_npm_sass_library(**kwargs)
6968

70-
def ng_module(
71-
deps = [],
72-
srcs = [],
73-
tsconfig = None,
74-
testonly = False,
75-
**kwargs):
76-
if not tsconfig:
77-
tsconfig = _getDefaultTsConfig(testonly)
78-
79-
# Compute an AMD module name for the target.
80-
module_name = compute_module_name(testonly)
81-
82-
local_deps = [
83-
# Add tslib because we use import helpers for all public packages.
84-
"@npm//tslib",
85-
]
86-
87-
# Append given deps only if they're not in the default set of deps
88-
for d in deps:
89-
if d not in local_deps:
90-
local_deps = local_deps + [d]
91-
92-
_ng_module(
93-
srcs = srcs,
94-
# `module_name` is used for AMD module names within emitted JavaScript files.
95-
module_name = module_name,
96-
# We use the module name as package name, so that the target can be resolved within
97-
# NodeJS executions, by activating the Bazel NodeJS linker.
98-
# See: https://github.com/bazelbuild/rules_nodejs/pull/2799.
99-
package_name = module_name,
100-
strict_templates = True,
101-
deps = local_deps,
102-
tsconfig = tsconfig,
103-
testonly = testonly,
104-
**kwargs
105-
)
106-
107-
# TODO(devversion): Partner with ISE team to support `rules_js` here.
108-
if False and module_name and not testonly:
109-
_make_tsec_test(kwargs["name"])
110-
11169
def ng_package(name, srcs = [], deps = [], externals = PKG_EXTERNALS, readme_md = None, visibility = None, **kwargs):
11270
# If no readme file has been specified explicitly, use the default readme for
11371
# release packages from "src/README.md".
@@ -295,7 +253,7 @@ def ng_web_test_suite(deps = [], static_css = [], exclude_init_script = False, *
295253
]
296254

297255
# Workaround for https://github.com/bazelbuild/rules_typescript/issues/301
298-
# Since some of our tests depend on CSS files which are not part of the `ng_module` rule,
256+
# Since some of our tests depend on CSS files which are not part of the `ng_project` rule,
299257
# we need to somehow load static CSS files within Karma (e.g. overlay prebuilt). Those styles
300258
# are required for successful test runs. Since the `karma_web_test_suite` rule currently only
301259
# allows JS files to be included and served within Karma, we need to create a JS file that

tools/postinstall/patches/@angular+bazel+20.0.0-next.1.patch

-131
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl b/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl
2+
index 5fd9a73..c155cea 100755
3+
--- a/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl
4+
+++ b/node_modules/@angular/bazel/src/ng_module/partial_compilation.bzl
5+
@@ -16,10 +16,10 @@ ng_partial_compilation_flag = rule(
6+
)
7+
8+
def _partial_compilation_transition_impl(_settings, _attr):
9+
- return {"@npm//@angular/bazel/src:partial_compilation": True}
10+
+ return {"@rules_angular//src/ng_project/config:partial_compilation": True}
11+
12+
partial_compilation_transition = transition(
13+
implementation = _partial_compilation_transition_impl,
14+
inputs = [],
15+
- outputs = ["@npm//@angular/bazel/src:partial_compilation"],
16+
+ outputs = ["@rules_angular//src/ng_project/config:partial_compilation"],
17+
)
18+
diff --git a/node_modules/@angular/bazel/src/ng_package/packager.mjs b/node_modules/@angular/bazel/src/ng_package/packager.mjs
19+
index 20604c5..6066214 100755
20+
--- a/node_modules/@angular/bazel/src/ng_package/packager.mjs
21+
+++ b/node_modules/@angular/bazel/src/ng_package/packager.mjs
22+
@@ -8,7 +8,7 @@
23+
import * as fs from 'fs';
24+
import * as path from 'path';
25+
import { globSync } from 'tinyglobby';
26+
-import { analyzeFileAndEnsureNoCrossImports } from './cross_entry_points_imports';
27+
+import { analyzeFileAndEnsureNoCrossImports } from './cross_entry_points_imports.mjs';
28+
/**
29+
* List of known `package.json` fields which provide information about
30+
* supported package formats and their associated entry paths.

0 commit comments

Comments
 (0)