@@ -19,10 +19,13 @@ import (
1919)
2020
2121// FetchLocalComponent retrieves the `.spec` file and any sidecar files for the specified component
22- // from the local filesystem, placing the fetched files in the provided directory.
22+ // from the local filesystem, placing the fetched files in the provided directory. If
23+ // dynamicallyResolveRequiredFiles is true, any files referenced by the spec's *contents* but
24+ // that are not located alongside the spec will also be resolved and copied to the destination.
2325func FetchLocalComponent (
2426 dryRunnable opctx.DryRunnable , eventListener opctx.EventListener ,
2527 fs opctx.FS , component components.Component , destDirPath string ,
28+ dynamicallyResolveRequiredFiles bool ,
2629) error {
2730 if dryRunnable == nil {
2831 return errors .New ("dry runnable cannot be nil" )
@@ -61,10 +64,12 @@ func FetchLocalComponent(
6164 }
6265
6366 // Resolve and copy any required files that may be stored separately
64- err = copyRequiredFiles (dryRunnable , fs , eventListener , component , sourceDirPath , destDirPath )
65- if err != nil {
66- return fmt .Errorf ("failed to copy required files for component %#q:\n %w" ,
67- component .GetName (), err )
67+ if dynamicallyResolveRequiredFiles {
68+ err = copyRequiredFiles (dryRunnable , fs , eventListener , component , sourceDirPath , destDirPath )
69+ if err != nil {
70+ return fmt .Errorf ("failed to copy required files for component %#q:\n %w" ,
71+ component .GetName (), err )
72+ }
6873 }
6974
7075 return nil
0 commit comments