From eca2334df5bb257e3ef5955f4f950ddb1a844585 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 14 Jul 2025 18:16:33 +0000 Subject: [PATCH] docs: correctly look for examples in the bin_dir instead of execPath (#62632) Properly look for the example files for live previews in the bin_dir PR Close #62632 --- adev/shared-docs/pipeline/_previews.bzl | 6 ++++-- adev/shared-docs/pipeline/examples/previews/index.mts | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/adev/shared-docs/pipeline/_previews.bzl b/adev/shared-docs/pipeline/_previews.bzl index 24080a4e4a2..5af8cd078bf 100644 --- a/adev/shared-docs/pipeline/_previews.bzl +++ b/adev/shared-docs/pipeline/_previews.bzl @@ -7,8 +7,10 @@ def _generate_previews_impl(ctx): # Set the arguments for the actions inputs and out put location. args = ctx.actions.args() - # Path to the examples for which previews are being generated. - args.add(ctx.attr.example_srcs.label.package) + # Path to the examples for which previews are being generated. Because examples are + # generated files, we need to look in the bin_dir subpath for them instead of the + # execPath + args.add("{}/{}".format(ctx.bin_dir.path, ctx.attr.example_srcs.label.package)) # Path to the preview map template. args.add(ctx.file._template_src) diff --git a/adev/shared-docs/pipeline/examples/previews/index.mts b/adev/shared-docs/pipeline/examples/previews/index.mts index 095662e475e..fb9a84a17ef 100644 --- a/adev/shared-docs/pipeline/examples/previews/index.mts +++ b/adev/shared-docs/pipeline/examples/previews/index.mts @@ -69,6 +69,9 @@ async function main() { })) .filter((result) => result.componentNames.length > 0); + if (filesWithComponent.length === 0) { + throw Error('No previews found for the previews component map.'); + } const previewsComponentMap = generatePreviewsComponentMap(filesWithComponent); await writeFile(outputFilePath, previewsComponentMap);