@@ -4551,6 +4551,66 @@ var getConfig = async (dir) => {
45514551// src/shared/index.ts
45524552var import_node_path6 = __toESM ( require ( "path" ) ) ;
45534553var import_node_fs6 = __toESM ( require ( "fs" ) ) ;
4554+ var getHostAndroidSystemImageArch = ( ) => {
4555+ switch ( process . arch ) {
4556+ case "arm64" :
4557+ return "arm64-v8a" ;
4558+ case "arm" :
4559+ return "armeabi-v7a" ;
4560+ case "x64" :
4561+ default :
4562+ return "x86_64" ;
4563+ }
4564+ } ;
4565+ var resolveAvdCachingEnabled = ( {
4566+ snapshotEnabled
4567+ } ) => {
4568+ const override = process . env . HARNESS_AVD_CACHING ;
4569+ const requestedValue = override == null ? snapshotEnabled : override . toLowerCase ( ) === "true" ;
4570+ return requestedValue === true ;
4571+ } ;
4572+ var getNormalizedAvdCacheConfig = ( {
4573+ emulator,
4574+ hostArch
4575+ } ) => {
4576+ const avd = emulator . avd ;
4577+ if ( ! avd ) {
4578+ return null ;
4579+ }
4580+ return {
4581+ name : emulator . name ,
4582+ apiLevel : avd . apiLevel ,
4583+ arch : hostArch ,
4584+ profile : avd . profile . trim ( ) . toLowerCase ( ) ,
4585+ diskSize : avd . diskSize . trim ( ) . toLowerCase ( ) ,
4586+ heapSize : avd . heapSize . trim ( ) . toLowerCase ( )
4587+ } ;
4588+ } ;
4589+ var getResolvedRunner = ( runner ) => {
4590+ if ( runner . platformId !== "android" || runner . config . device . type !== "emulator" ) {
4591+ return runner ;
4592+ }
4593+ const avdCachingEnabled = resolveAvdCachingEnabled ( {
4594+ snapshotEnabled : runner . config . device . avd ?. snapshot ?. enabled
4595+ } ) ;
4596+ return {
4597+ ...runner ,
4598+ config : {
4599+ ...runner . config ,
4600+ device : {
4601+ ...runner . config . device ,
4602+ avd : runner . config . device . avd
4603+ }
4604+ } ,
4605+ action : {
4606+ avdCachingEnabled,
4607+ avdCacheConfig : getNormalizedAvdCacheConfig ( {
4608+ emulator : runner . config . device ,
4609+ hostArch : getHostAndroidSystemImageArch ( )
4610+ } )
4611+ }
4612+ } ;
4613+ } ;
45544614var run = async ( ) => {
45554615 try {
45564616 const projectRootInput = process . env . INPUT_PROJECTROOT ;
@@ -4560,7 +4620,9 @@ var run = async () => {
45604620 }
45614621 const projectRoot = projectRootInput ? import_node_path6 . default . resolve ( projectRootInput ) : process . cwd ( ) ;
45624622 console . info ( `Loading React Native Harness config from: ${ projectRoot } ` ) ;
4563- const { config, projectRoot : resolvedProjectRoot } = await getConfig ( projectRoot ) ;
4623+ const { config, projectRoot : resolvedProjectRoot } = await getConfig (
4624+ projectRoot
4625+ ) ;
45644626 const runner = config . runners . find ( ( runner2 ) => runner2 . name === runnerInput ) ;
45654627 if ( ! runner ) {
45664628 throw new Error ( `Runner ${ runnerInput } not found in config` ) ;
@@ -4569,8 +4631,11 @@ var run = async () => {
45694631 if ( ! githubOutput ) {
45704632 throw new Error ( "GITHUB_OUTPUT environment variable is not set" ) ;
45714633 }
4634+ const resolvedRunner = getResolvedRunner ( runner ) ;
45724635 const relativeProjectRoot = import_node_path6 . default . relative ( process . cwd ( ) , resolvedProjectRoot ) || "." ;
4573- const output = `config=${ JSON . stringify ( runner ) }
4636+ const output = `config=${ JSON . stringify (
4637+ resolvedRunner
4638+ ) }
45744639projectRoot=${ relativeProjectRoot }
45754640` ;
45764641 import_node_fs6 . default . appendFileSync ( githubOutput , output ) ;
0 commit comments