Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# @generated
# Input hashes for repository rule npm_translate_lock(name = "npm2", pnpm_lock = "@//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=-1406867100
.npmrc=-151232324
adev/shared-docs/pipeline/api-gen/package.json=939673974
modules/package.json=1088918580
package.json=1801177040
packages/compiler-cli/package.json=-1344632265
packages/animations/package.json=-678724831
packages/common/package.json=1729763064
packages/compiler-cli/package.json=-1765181548
packages/compiler/package.json=1190056499
pnpm-lock.yaml=1750394994
pnpm-workspace.yaml=353334404
packages/core/package.json=1154833122
packages/core/test/bundling/package.json=1175613456
packages/forms/package.json=-877154917
packages/localize/package.json=-1012769529
packages/platform-browser-dynamic/package.json=1901947880
packages/platform-browser/package.json=-1163479450
packages/router/package.json=860819913
packages/upgrade/package.json=16347051
packages/zone.js/package.json=-1545343303
pnpm-lock.yaml=-1557989717
pnpm-workspace.yaml=-1264776080
tools/bazel/rules_angular_store/package.json=-239561259
yarn.lock=-1393712141
15 changes: 14 additions & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ modules/ssr-benchmarks/node_modules


# For rules_js
packages/compiler/node_modules
adev/shared-docs/pipeline/api-gen/node_modules
modules/node_modules
packages/animations/node_modules
packages/common/node_modules
packages/localize/node_modules
packages/compiler-cli/node_modules
packages/compiler/node_modules
packages/core/node_modules
packages/core/test/bundling/node_modules
packages/forms/node_modules
packages/platform-browser/node_modules
packages/platform-browser-dynamic/node_modules
packages/router/node_modules
packages/zone.js/node_modules
packages/upgrade/node_modules
tools/bazel/rules_angular_store/node_modules
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ test --flaky_test_attempts=1
common --@aspect_rules_ts//ts:skipLibCheck=always
common --@aspect_rules_ts//ts:default_to_tsc_transpiler

# Needed as otherwise `env` of TS actions would be ignored.
common --incompatible_merge_fixed_and_default_shell_env

###############################
# Filesystem interactions #
###############################
Expand Down
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ hoist=false
# Avoid pnpm auto-installing peer dependencies. We want to be explicit about our versions used
# for peer dependencies, avoiding potential mismatches. In addition, it ensures we can continue
# to rely on peer dependency placeholders substituted via Bazel.
auto-install-peers=false
# TODO(devversion): Temporarily during migration this is flipped as we can't have `workspace:*` deps
# in the `package.json` also processed by Yarn.
auto-install-peers=true
33 changes: 23 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ http_archive(

http_archive(
name = "aspect_rules_js",
sha256 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52",
strip_prefix = "rules_js-2.1.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.tar.gz",
sha256 = "83e5af4d17385d1c3268c31ae217dbfc8525aa7bcf52508dc6864baffc8b9501",
strip_prefix = "rules_js-2.3.7",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.3.7/rules_js-v2.3.7.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
Expand Down Expand Up @@ -109,8 +109,21 @@ npm_translate_lock(
data = [
"//:package.json",
"//:pnpm-workspace.yaml",
"//adev/shared-docs/pipeline/api-gen:package.json",
"//modules:package.json",
"//packages/animations:package.json",
"//packages/common:package.json",
"//packages/compiler:package.json",
"//packages/compiler-cli:package.json",
"//packages/core:package.json",
"//packages/core/test/bundling:package.json",
"//packages/forms:package.json",
"//packages/localize:package.json",
"//packages/platform-browser:package.json",
"//packages/platform-browser-dynamic:package.json",
"//packages/router:package.json",
"//packages/upgrade:package.json",
"//packages/zone.js:package.json",
"//tools/bazel/rules_angular_store:package.json",
],
npmrc = "//:.npmrc",
Expand All @@ -126,9 +139,9 @@ npm_repositories()

http_archive(
name = "aspect_rules_ts",
sha256 = "9acd128abe77397505148eaa6895faed57839560dbf2177dd6285e51235e2724",
strip_prefix = "rules_ts-3.3.1",
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.3.1/rules_ts-v3.3.1.tar.gz",
sha256 = "6b15ac1c69f2c0f1282e41ab469fd63cd40eb2e2d83075e19b68a6a76669773f",
strip_prefix = "rules_ts-3.6.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.6.0/rules_ts-v3.6.0.tar.gz",
)

load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
Expand All @@ -141,9 +154,9 @@ rules_ts_dependencies(

http_archive(
name = "aspect_rules_rollup",
sha256 = "c4062681968f5dcd3ce01e09e4ba73670c064744a7046211763e17c98ab8396e",
strip_prefix = "rules_rollup-2.0.0",
url = "https://github.com/aspect-build/rules_rollup/releases/download/v2.0.0/rules_rollup-v2.0.0.tar.gz",
sha256 = "0b8ac7d97cd660eb9a275600227e9c4268f5904cba962939d1a6ce9a0a059d2e",
strip_prefix = "rules_rollup-2.0.1",
url = "https://github.com/aspect-build/rules_rollup/releases/download/v2.0.1/rules_rollup-v2.0.1.tar.gz",
)

http_archive(
Expand Down Expand Up @@ -273,7 +286,7 @@ setup_dependencies_2()

git_repository(
name = "rules_angular",
commit = "ad3a2d652f41c953fad8f55c3959fde628fa8ebf",
commit = "8952a28010d584280cf674c41f684a36c22dec08",
remote = "https://github.com/devversion/rules_angular.git",
)

Expand Down
4 changes: 4 additions & 0 deletions adev/shared-docs/pipeline/api-gen/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
load("@npm2//:defs.bzl", "npm_link_all_packages")

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

npm_link_all_packages()

# Expose the sources in the dev-infra NPM package.
filegroup(
name = "files",
Expand Down
34 changes: 7 additions & 27 deletions adev/shared-docs/pipeline/api-gen/extraction/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
load("@angular//tools/esm-interop:index.bzl", "nodejs_binary")
load("@npm//@angular/build-tooling/bazel/esbuild:index.bzl", "esbuild_esm_bundle")
load("@aspect_rules_js//js:defs.bzl", "js_binary")
load("//adev/shared-docs:defaults.bzl", "ts_project")

package(default_visibility = ["//adev/shared-docs/pipeline/api-gen:__subpackages__"])

esbuild_esm_bundle(
name = "bin",
entry_point = ":index.mts",
external = [
"@angular/compiler-cli",
"typescript",
],
metafile = False,
output = "bin.mjs",
platform = "node",
target = "es2022",
deps = [
":extract_api_to_json_lib",
],
)

ts_project(
name = "extract_api_to_json_lib",
srcs = glob(
Expand All @@ -28,26 +11,23 @@ ts_project(
"**/*.spec.mts",
],
),
interop_deps = [
"@angular//packages/compiler",
"@angular//packages/compiler-cli",
],
deps = [
# TODO(rules_js): Explore how this could work alternatively at runtime with the module names.
"//adev/shared-docs/pipeline/api-gen:node_modules/@angular/compiler-cli",
"//adev/shared-docs/pipeline/api-gen:node_modules/@angular/compiler",
"//:node_modules/@bazel/runfiles",
"//:node_modules/@types/node",
"//:node_modules/typescript",
],
)

# Action binary for the api_gen bazel rule.
nodejs_binary(
js_binary(
name = "extract_api_to_json",
data = [
"@angular//packages/compiler",
"@angular//packages/compiler-cli:npm_package",
"@npm//typescript",
":extract_api_to_json_lib_rjs",
],
entry_point = "bin.mjs",
entry_point = ":index.mjs",
visibility = ["//visibility:public"],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
load("@build_bazel_rules_nodejs//:providers.bzl", "run_node")

def _extract_api_to_json(ctx):
"""Implementation of the extract_api_to_json rule"""

Expand Down Expand Up @@ -49,12 +47,15 @@ def _extract_api_to_json(ctx):

# Define an action that runs the nodejs_binary executable. This is
# the main thing that this rule does.
run_node(
ctx = ctx,
ctx.actions.run(
inputs = depset(ctx.files.srcs + ctx.files.extra_entries),
executable = "_extract_api_to_json",
executable = ctx.executable._extract_api_to_json,
outputs = [json_output],
arguments = [args],
env = {
# Note: We don't need to `cd` into the bin-dir as this action deals with execpaths.
"BAZEL_BINDIR": ".",
},
)

# The return value describes what the rule is producing. In this case we need to specify
Expand Down
6 changes: 6 additions & 0 deletions adev/shared-docs/pipeline/api-gen/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"@angular/compiler": "workspace:*",
"@angular/compiler-cli": "workspace:*"
}
}
3 changes: 3 additions & 0 deletions modules/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("@npm2//:defs.bzl", "npm_link_all_packages")

npm_link_all_packages()
16 changes: 16 additions & 0 deletions modules/benchmarks/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
load("//tools:defaults2.bzl", "ts_config")

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

exports_files([
"tsconfig-build.json",
"tsconfig-e2e.json",
])

ts_config(
name = "tsconfig_build",
src = "tsconfig-build.json",
)

ts_config(
name = "tsconfig_e2e",
src = "tsconfig-e2e.json",
deps = [
"//:node_modules/@types/jasmine",
"//:node_modules/@types/node",
],
)
5 changes: 3 additions & 2 deletions modules/benchmarks/src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
load("//tools:defaults.bzl", "ts_library")
load("//tools:defaults2.bzl", "ts_project")

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

ts_library(
ts_project(
name = "util_lib",
srcs = ["util.ts"],
tsconfig = "//modules/benchmarks:tsconfig_build",
)
7 changes: 4 additions & 3 deletions modules/benchmarks/src/change_detection/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
load("//tools:defaults.bzl", "ts_library")
load("//tools:defaults2.bzl", "ts_project")

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

ts_library(
ts_project(
name = "util_lib",
srcs = ["util.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = ["//modules/benchmarks/src:util_lib"],
tsconfig = "//modules/benchmarks:tsconfig_build",
deps = ["//modules/benchmarks/src:util_lib_rjs"],
)

ts_library(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
load("@npm//@angular/build-tooling/bazel/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test")
load("@rules_angular//src/optimization:index.bzl", "optimize_angular_app")
load("//modules/benchmarks:e2e_test.bzl", "e2e_test")
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module")
load("//tools:defaults.bzl", "http_server")

package(default_visibility = ["//modules/benchmarks:__subpackages__"])

ng_module(
name = "transplanted_views_lib",
srcs = glob(["*.ts"]),
tsconfig = "//modules/benchmarks:tsconfig-build.json",
deps = [
"//modules/benchmarks/src:util_lib",
"//modules/benchmarks/src/change_detection:util_lib",
"//packages/core",
"//packages/platform-browser",
optimize_angular_app(
name = "bundles",
srcs = [
"index.html",
"init.ts",
"main.ts",
"transplanted_views.ts",
"//modules/benchmarks/src:util_lib_rjs",
"//modules/benchmarks/src/change_detection:util_lib_rjs",
],
)

app_bundle(
name = "bundle",
entry_point = ":index_aot.ts",
include_zonejs = True,
deps = [
":transplanted_views_lib",
"@npm//rxjs",
"//:node_modules/rxjs",
"//:node_modules/tslib",
"//modules:node_modules/@angular/build",
"//modules:node_modules/@angular/common",
"//modules:node_modules/@angular/core",
"//modules:node_modules/@angular/platform-browser",
"//modules:node_modules/zone.js",
],
)

# The script needs to be called `app_bundle` for easier syncing into g3.
genrule(
name = "app_bundle",
srcs = [":bundle.debug.min.js"],
srcs = [":bundles"],
outs = ["app_bundle.js"],
cmd = "cp $< $@",
cmd = "cp $</main.js $@",
)

http_server(
Expand Down
Loading