@@ -25,6 +25,7 @@ const derivedDataPath = path.join(__dirname, "../build", "derived-data", "macos-
2525const testRunnerAppSourcePath = path . join ( __dirname , "../TestRunner" , "app" ) ;
2626const nativeScriptXCFramework = path . join ( __dirname , "../dist" , "NativeScript.xcframework" ) ;
2727const tkLiveSyncXCFramework = path . join ( __dirname , "../dist" , "TKLiveSync.xcframework" ) ;
28+ const nativeScriptSourceRoot = path . join ( __dirname , "../NativeScript" ) ;
2829const metadataGeneratorRoot = path . join ( __dirname , "../metadata-generator" ) ;
2930const metadataGeneratorBinary = path . join (
3031 metadataGeneratorRoot ,
@@ -461,6 +462,26 @@ function ensureMetadataGeneratorBuilt() {
461462 runBuildAndRequireSuccess ( "npm" , [ "run" , "build-metagen" ] , commandTimeoutMs ) ;
462463}
463464
465+ function ensureMacOSRuntimeArtifactsBuilt ( ) {
466+ const sourceInputs = [
467+ nativeScriptSourceRoot ,
468+ path . join ( __dirname , "../build_nativescript.sh" )
469+ ] ;
470+
471+ const sourceMtime = sourceInputs . reduce (
472+ ( latest , inputPath ) => Math . max ( latest , getPathStats ( inputPath ) . maxMtimeMs ) ,
473+ 0
474+ ) ;
475+ const artifactMtime = getPathStats ( nativeScriptXCFramework ) . maxMtimeMs ;
476+
477+ if ( artifactMtime > 0 && artifactMtime >= sourceMtime ) {
478+ return ;
479+ }
480+
481+ console . log ( "NativeScript macOS artifacts are missing or stale; running build:macos..." ) ;
482+ runBuildAndRequireSuccess ( "npm" , [ "run" , "build:macos" ] , commandTimeoutMs ) ;
483+ }
484+
464485function buildTestRunnerApp ( ) {
465486 const appBundlePath = path . join (
466487 derivedDataPath ,
@@ -477,6 +498,7 @@ function buildTestRunnerApp() {
477498 }
478499
479500 ensureMetadataGeneratorBuilt ( ) ;
501+ ensureMacOSRuntimeArtifactsBuilt ( ) ;
480502
481503 const nativeFingerprint = createBuildFingerprint ( macosBuildInputs ) ;
482504 const existingBuildState = readBuildState ( ) ;
0 commit comments