@@ -34,6 +34,7 @@ import {
3434 printConsoleLog ,
3535 runBuck2 ,
3636 runBuck2Sync ,
37+ runCommand ,
3738 symbolicateStackTrace ,
3839} from './utils' ;
3940import fs from 'fs' ;
@@ -151,22 +152,34 @@ function generateBytecodeBundle({
151152 isOptimizedMode : boolean ,
152153 hermesVariant : HermesVariant ,
153154} ) : void {
154- const hermesCompilerCommandResult = runBuck2Sync (
155- [
156- 'run' ,
157- ...getBuckModesForPlatform ( isOptimizedMode ) ,
158- ...getBuckOptionsForHermes ( hermesVariant ) ,
159- getHermesCompilerTarget ( hermesVariant ) ,
160- '--' ,
161- '-emit-binary' ,
162- isOptimizedMode ? '-O' : null ,
163- '-max-diagnostic-width' ,
164- '80' ,
165- '-out' ,
166- bytecodePath ,
167- sourcePath ,
168- ] . filter ( Boolean ) ,
169- ) ;
155+ const hermescArgs = [
156+ '-emit-binary' ,
157+ isOptimizedMode ? '-O' : null ,
158+ '-max-diagnostic-width' ,
159+ '80' ,
160+ '-out' ,
161+ bytecodePath ,
162+ sourcePath ,
163+ ] . filter ( Boolean ) ;
164+ const hermesCompilerCommandResult = false
165+ ? runCommand (
166+ path . join (
167+ __dirname ,
168+ '..' ,
169+ '..' ,
170+ '..' ,
171+ 'packages/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc' ,
172+ ) ,
173+ hermescArgs ,
174+ )
175+ : runBuck2Sync ( [
176+ 'run' ,
177+ ...getBuckModesForPlatform ( isOptimizedMode ) ,
178+ ...getBuckOptionsForHermes ( hermesVariant ) ,
179+ getHermesCompilerTarget ( hermesVariant ) ,
180+ '--' ,
181+ ...hermescArgs ,
182+ ] ) ;
170183
171184 if ( hermesCompilerCommandResult . status !== 0 ) {
172185 throw new Error ( getDebugInfoFromCommandResult ( hermesCompilerCommandResult ) ) ;
@@ -215,6 +228,27 @@ module.exports = async function runTest(
215228 const testResultsByConfig = [ ] ;
216229
217230 for ( const testConfig of testConfigs ) {
231+ if (
232+ EnvironmentOptions . isOSS &&
233+ testConfig . mode === FantomTestConfigMode . Optimized
234+ ) {
235+ testResultsByConfig . push ( [
236+ {
237+ ancestorTitles : [ '"@fantom_mode opt" in docblock' ] ,
238+ duration : 0 ,
239+ failureDetails : [ ] ,
240+ failureMessages : [ ] ,
241+ fullName : 'Optimized mode is not yet supoprted in OSS' ,
242+ numPassingAsserts : 0 ,
243+ snapshotResults : { } ,
244+ status : 'pending' ,
245+ testFilePath : testPath ,
246+ title : 'Optimized mode is not yet supoprted in OSS' ,
247+ } ,
248+ ] ) ;
249+ continue ;
250+ }
251+
218252 const entrypointContents = entrypointTemplate ( {
219253 testPath : `${ path . relative ( BUILD_OUTPUT_PATH , testPath ) } ` ,
220254 setupModulePath : `${ path . relative ( BUILD_OUTPUT_PATH , setupModulePath ) } ` ,
@@ -261,28 +295,46 @@ module.exports = async function runTest(
261295 } ) ;
262296 }
263297
264- const rnTesterCommandResult = runBuck2 (
265- [
266- 'run' ,
267- ...getBuckModesForPlatform (
268- testConfig . mode === FantomTestConfigMode . Optimized ,
269- ) ,
270- ...getBuckOptionsForHermes ( testConfig . hermesVariant ) ,
271- '//xplat/js/react-native-github/private/react-native-fantom/tester:tester' ,
272- '--' ,
273- '--bundlePath' ,
274- testConfig . mode === FantomTestConfigMode . DevelopmentWithSource
275- ? testJSBundlePath
276- : testBytecodeBundlePath ,
277- '--featureFlags' ,
278- JSON . stringify ( testConfig . flags . common ) ,
279- '--minLogLevel' ,
280- EnvironmentOptions . printCLIOutput ? 'info' : 'error' ,
281- ] ,
282- {
283- withFDB : EnvironmentOptions . enableCppDebugging ,
284- } ,
285- ) ;
298+ const rnTesterCommandArgs = [
299+ '--bundlePath' ,
300+ testConfig . mode === FantomTestConfigMode . DevelopmentWithSource
301+ ? testJSBundlePath
302+ : testBytecodeBundlePath ,
303+ '--featureFlags' ,
304+ JSON . stringify ( testConfig . flags . common ) ,
305+ '--minLogLevel' ,
306+ EnvironmentOptions . printCLIOutput ? 'info' : 'error' ,
307+ ] ;
308+
309+ const rnTesterCommandResult = EnvironmentOptions . isOSS
310+ ? runCommand (
311+ path . join (
312+ __dirname ,
313+ '..' ,
314+ 'tester' ,
315+ 'build' ,
316+ testConfig . mode === FantomTestConfigMode . Optimized
317+ ? 'release'
318+ : 'debug' ,
319+ 'fantom_tester' ,
320+ ) ,
321+ rnTesterCommandArgs ,
322+ )
323+ : runBuck2 (
324+ [
325+ 'run' ,
326+ ...getBuckModesForPlatform (
327+ testConfig . mode === FantomTestConfigMode . Optimized ,
328+ ) ,
329+ ...getBuckOptionsForHermes ( testConfig . hermesVariant ) ,
330+ '//xplat/js/react-native-github/private/react-native-fantom/tester:tester' ,
331+ '--' ,
332+ ...rnTesterCommandArgs ,
333+ ] ,
334+ {
335+ withFDB : EnvironmentOptions . enableCppDebugging ,
336+ } ,
337+ ) ;
286338
287339 const processedResult = await processRNTesterCommandResult (
288340 rnTesterCommandResult ,
0 commit comments