Skip to content

Commit 082cac9

Browse files
committed
build: use genrule for best practices copy
Replaces `copy_file` with `genrule` in `packages/schematics/angular/BUILD.bazel` to depend explicitly on `//:node_modules/@angular/core/dir`. When `@angular/core` is linked as a directory tree artifact, referencing an internal file label directly without depending on the directory artifact causes Bazel's sandbox not to stage `@angular/core` into the sandbox, failing with `cp: cannot stat 'node_modules/@angular/core/resources/best-practices.md'`.
1 parent 6469b5f commit 082cac9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/schematics/angular/BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Use of this source code is governed by an MIT-style license that can be
44
# found in the LICENSE file at https://angular.dev/license
55

6-
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
76
load("@npm//:defs.bzl", "npm_link_all_packages")
87
load("//tools:defaults.bzl", "copy_to_bin", "jasmine_test", "npm_package", "ts_project")
98
load("//tools:ts_json_schema.bzl", "ts_json_schema")
@@ -46,10 +45,11 @@ copy_to_bin(
4645
srcs = glob(["**/schema.json"]),
4746
)
4847

49-
copy_file(
48+
genrule(
5049
name = "angular_best_practices",
51-
src = "//:node_modules/@angular/core/resources/best-practices.md",
52-
out = "ai-config/files/__bestPracticesName__.template",
50+
srcs = ["//:node_modules/@angular/core/dir"],
51+
outs = ["ai-config/files/__bestPracticesName__.template"],
52+
cmd = "cp $(execpath //:node_modules/@angular/core/dir)/resources/best-practices.md $@",
5353
)
5454

5555
RUNTIME_ASSETS = [

0 commit comments

Comments
 (0)