Skip to content

Commit eca8236

Browse files
committed
build: migrate license file handling to write_source_file
Migrate the handling of THIRD_PARTY_LICENSES.txt.golden in the SSR npm package from using `bazel_skylib`'s `diff_test` and `write_file` rules to `aspect_bazel_lib`'s `write_source_file` rule. This simplifies the Bazel configuration for managing the golden license file.
1 parent a9c700a commit eca8236

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

packages/angular/ssr/test/npm_package/BUILD.bazel

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
2-
load("@bazel_skylib//rules:write_file.bzl", "write_file")
1+
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file")
32
load("//tools:defaults.bzl", "jasmine_test", "ts_project")
43

54
ts_project(
@@ -32,26 +31,8 @@ genrule(
3231
""",
3332
)
3433

35-
diff_test(
36-
name = "beasties_license_test",
37-
failure_message = """
38-
39-
To accept the new golden file, execute:
40-
pnpm bazel run //packages/angular/ssr/test/npm_package:beasties_license_test.accept
41-
""",
42-
file1 = ":THIRD_PARTY_LICENSES.txt.golden",
43-
file2 = ":beasties_license_file",
44-
)
45-
46-
write_file(
47-
name = "beasties_license_test.accept",
48-
out = "beasties_license_file_accept.sh",
49-
content =
50-
[
51-
"#!/usr/bin/env bash",
52-
"cd ${BUILD_WORKSPACE_DIRECTORY}",
53-
"pnpm bazel build //packages/angular/ssr:npm_package",
54-
"cp -fv dist/bin/packages/angular/ssr/npm_package/third_party/beasties/THIRD_PARTY_LICENSES.txt packages/angular/ssr/test/npm_package/THIRD_PARTY_LICENSES.txt.golden",
55-
],
56-
is_executable = True,
34+
write_source_file(
35+
name = "beasties_license",
36+
in_file = ":beasties_license_file",
37+
out_file = ":THIRD_PARTY_LICENSES.txt.golden",
5738
)

0 commit comments

Comments
 (0)