@@ -131,6 +131,57 @@ function resolveBuildDestinationFamily() {
131131 return `generic/platform=${ platformName } ` ;
132132}
133133
134+ function resolveRunnerSdkName ( ) {
135+ const platformName = resolvePlatformName ( ) ;
136+ if ( platformName === 'macOS' ) return 'macosx' ;
137+ if ( platformName === 'tvOS' ) {
138+ return resolveDeviceKind ( ) === 'simulator' ? 'appletvsimulator' : 'appletvos' ;
139+ }
140+ return resolveDeviceKind ( ) === 'simulator' ? 'iphonesimulator' : 'iphoneos' ;
141+ }
142+
143+ function runAppleToolFingerprintCommand ( command , args ) {
144+ try {
145+ return execFileSync ( command , args , {
146+ encoding : 'utf8' ,
147+ stdio : [ 'ignore' , 'pipe' , 'ignore' ] ,
148+ timeout : 5000 ,
149+ maxBuffer : 128 * 1024 ,
150+ } ) . trim ( ) || 'unknown' ;
151+ } catch {
152+ return 'unknown' ;
153+ }
154+ }
155+
156+ function parseXcodeVersionOutput ( output ) {
157+ return {
158+ version : output . match ( / ^ X c o d e \s + ( .+ ) $ / m) ?. [ 1 ] ?. trim ( ) || 'unknown' ,
159+ buildVersion : output . match ( / ^ B u i l d v e r s i o n \s + ( .+ ) $ / m) ?. [ 1 ] ?. trim ( ) || 'unknown' ,
160+ } ;
161+ }
162+
163+ function resolveRunnerToolchainFingerprint ( ) {
164+ const xcode = parseXcodeVersionOutput (
165+ runAppleToolFingerprintCommand ( 'xcodebuild' , [ '-version' ] ) ,
166+ ) ;
167+ const sdkName = resolveRunnerSdkName ( ) ;
168+ return {
169+ xcodeVersion : xcode . version ,
170+ xcodeBuildVersion : xcode . buildVersion ,
171+ sdkName,
172+ sdkVersion : runAppleToolFingerprintCommand ( 'xcrun' , [
173+ '--sdk' ,
174+ sdkName ,
175+ '--show-sdk-version' ,
176+ ] ) ,
177+ sdkBuildVersion : runAppleToolFingerprintCommand ( 'xcrun' , [
178+ '--sdk' ,
179+ sdkName ,
180+ '--show-sdk-build-version' ,
181+ ] ) ,
182+ } ;
183+ }
184+
134185function resolveSigningBuildSettings ( ) {
135186 if ( platform !== 'macos' ) {
136187 return [ ] ;
@@ -149,6 +200,7 @@ const metadata = {
149200 schemaVersion : 1 ,
150201 packageVersion : readPackageVersion ( ) ,
151202 runnerSourceFingerprint : computeRunnerSourceFingerprint ( ) ,
203+ ...resolveRunnerToolchainFingerprint ( ) ,
152204 platformName : resolvePlatformName ( ) ,
153205 deviceKind : resolveDeviceKind ( ) ,
154206 target : resolveTarget ( ) ,
@@ -175,14 +227,16 @@ function resolveRunnerCacheArtifacts() {
175227 const productPaths = resolveExistingXctestrunProductPaths ( xctestrunPath ) ;
176228 if ( ! productPaths || productPaths . length === 0 ) return null ;
177229 const xctestrunMtimeMs = readFileMtimeMs ( xctestrunPath ) ;
178- if ( xctestrunMtimeMs === null ) return null ;
230+ const xctestrunSize = readFileSize ( xctestrunPath ) ;
231+ if ( xctestrunMtimeMs === null || xctestrunSize === null ) return null ;
179232 const productArtifacts = [ ] ;
180233 for ( const productPath of productPaths ) {
181234 const mtimeMs = readFileMtimeMs ( productPath ) ;
182- if ( mtimeMs === null ) return null ;
183- productArtifacts . push ( { path : productPath , mtimeMs } ) ;
235+ const size = readFileSize ( productPath ) ;
236+ if ( mtimeMs === null || size === null ) return null ;
237+ productArtifacts . push ( { path : productPath , mtimeMs, size } ) ;
184238 }
185- return { xctestrunPath, xctestrunMtimeMs, productPaths : productArtifacts } ;
239+ return { xctestrunPath, xctestrunMtimeMs, xctestrunSize , productPaths : productArtifacts } ;
186240}
187241
188242function findXctestrun ( root ) {
@@ -378,6 +432,14 @@ function readFileMtimeMs(filePath) {
378432 }
379433}
380434
435+ function readFileSize ( filePath ) {
436+ try {
437+ return fs . statSync ( filePath ) . size ;
438+ } catch {
439+ return null ;
440+ }
441+ }
442+
381443function isRecord ( value ) {
382444 return Boolean ( value ) && typeof value === 'object' && ! Array . isArray ( value ) ;
383445}
0 commit comments