@@ -38,6 +38,7 @@ var saveXcodeDerivedDataFilesCmd = &cobra.Command{
3838 cacheKey , _ := cmd .Flags ().GetString ("key" )
3939 ddPath , _ := cmd .Flags ().GetString ("deriveddata-path" )
4040 xcodeCachePath , _ := cmd .Flags ().GetString ("xcodecache-path" )
41+ followSymlinks , _ := cmd .Flags ().GetBool ("follow-symlinks" )
4142
4243 tracker := xcode .NewDefaultStepTracker ("save-xcode-build-cache" , os .Getenv , logger )
4344 defer tracker .Wait ()
@@ -49,7 +50,18 @@ var saveXcodeDerivedDataFilesCmd = &cobra.Command{
4950 return fmt .Errorf ("read auth config from environments: %w" , err )
5051 }
5152
52- op , cmdError := saveXcodeDerivedDataFilesCmdFn (cmd .Context (), authConfig , CacheMetadataPath , projectRoot , cacheKey , ddPath , xcodeCachePath , logger , tracker , startT , os .Getenv )
53+ op , cmdError := saveXcodeDerivedDataFilesCmdFn (cmd .Context (),
54+ authConfig ,
55+ CacheMetadataPath ,
56+ projectRoot ,
57+ cacheKey ,
58+ ddPath ,
59+ xcodeCachePath ,
60+ followSymlinks ,
61+ logger ,
62+ tracker ,
63+ startT ,
64+ os .Getenv )
5365 if op != nil {
5466 if cmdError != nil {
5567 errStr := cmdError .Error ()
@@ -86,10 +98,21 @@ func init() {
8698 panic (err )
8799 }
88100 saveXcodeDerivedDataFilesCmd .Flags ().String ("xcodecache-path" , "" , "Path to the Xcode cache directory folder to be saved. If not set, it will not be uploaded." )
101+ saveXcodeDerivedDataFilesCmd .Flags ().Bool ("follow-symlinks" , false , "Follow symlinks when calculating metadata and save referenced files to the cache (default: false)" )
89102}
90103
91- func saveXcodeDerivedDataFilesCmdFn (ctx context.Context , authConfig common.CacheAuthConfig , cacheMetadataPath , projectRoot , providedCacheKey , derivedDataPath , xcodeCachePath string ,
92- logger log.Logger , tracker xcode.StepAnalyticsTracker , startT time.Time , envProvider func (string ) string ) (* xa.CacheOperation , error ) {
104+ func saveXcodeDerivedDataFilesCmdFn (ctx context.Context ,
105+ authConfig common.CacheAuthConfig ,
106+ cacheMetadataPath ,
107+ projectRoot ,
108+ providedCacheKey ,
109+ derivedDataPath ,
110+ xcodeCachePath string ,
111+ followSymlinks bool ,
112+ logger log.Logger ,
113+ tracker xcode.StepAnalyticsTracker ,
114+ startT time.Time ,
115+ envProvider func (string ) string ) (* xa.CacheOperation , error ) {
93116 var err error
94117 var cacheKey string
95118 if providedCacheKey == "" {
@@ -126,6 +149,7 @@ func saveXcodeDerivedDataFilesCmdFn(ctx context.Context, authConfig common.Cache
126149 DerivedDataPath : derivedDataPath ,
127150 XcodeCacheDirPath : xcodeCachePath ,
128151 CacheKey : cacheKey ,
152+ FollowSymlinks : followSymlinks ,
129153 }, envProvider , logger )
130154 if err != nil {
131155 return op , fmt .Errorf ("create metadata: %w" , err )
0 commit comments