Add support for Static Hermes staging in Fantom (#52105)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52105

Changelog: [internal]

I just learnt there's a Hermes variant that we don't support (staging) so this adds support for it.

Reviewed By: christophpurrer

Differential Revision: D76897715

fbshipit-source-id: 3113edde3c785d71ad4a57dd435f16e13ab46976
This commit is contained in:
Rubén Norte
2025-06-18 09:36:36 -07:00
committed by Facebook GitHub Bot
parent ccc8ce0d01
commit 29704b1f02
5 changed files with 43 additions and 14 deletions
+5 -3
View File
@@ -35,10 +35,12 @@ function formatFantomHermesVariant(hermesVariant: HermesVariant): string {
switch (hermesVariant) {
case FantomTestConfigHermesVariant.Hermes:
return 'hermes';
case FantomTestConfigHermesVariant.StaticHermes:
return 'hermes 🆕';
case FantomTestConfigHermesVariant.StaticHermesStable:
return 'shermes 🆕';
case FantomTestConfigHermesVariant.StaticHermesStaging:
return 'shermes ⏭️';
case FantomTestConfigHermesVariant.StaticHermesExperimental:
return 'hermes 🧪';
return 'shermes 🧪';
}
}
+10 -6
View File
@@ -90,7 +90,7 @@ const MAX_FANTOM_CONFIGURATION_VARIATIONS = 12;
* /**
* * @flow strict-local
* * @fantom_mode opt
* * @fantom_hermes_variant static_hermes
* * @fantom_hermes_variant static_hermes_stable
* * @fantom_flags commonTestFlag:true
* * @fantom_flags jsOnlyTestFlag:true
* * @fantom_react_fb_flags reactInternalFlag:true
@@ -101,8 +101,8 @@ const MAX_FANTOM_CONFIGURATION_VARIATIONS = 12;
* - `fantom_mode`: specifies the level of optimization to compile the test
* with. Valid values are `dev`, `dev-bytecode` and `opt`.
* - `fantom_hermes_variant`: specifies the Hermes variant to use to run the
* test. Valid values are `hermes`, `static_hermes` and
* `static_hermes_experimental`.
* test. Valid values are `hermes`, `static_hermes_stable`,
* `static_hermes_staging` and `static_hermes_experimental`.
* - `fantom_flags`: specifies the configuration for common and JS-only feature
* flags. They can be specified in the same pragma or in different ones, and
* the format is `<flag_name>:<value>`.
@@ -187,8 +187,11 @@ export default function getFantomTestConfigs(
case 'hermes':
config.hermesVariant = HermesVariant.Hermes;
break;
case 'static_hermes':
config.hermesVariant = HermesVariant.StaticHermes;
case 'static_hermes_stable':
config.hermesVariant = HermesVariant.StaticHermesStable;
break;
case 'static_hermes_staging':
config.hermesVariant = HermesVariant.StaticHermesStaging;
break;
case 'static_hermes_experimental':
config.hermesVariant = HermesVariant.StaticHermesExperimental;
@@ -196,7 +199,8 @@ export default function getFantomTestConfigs(
case '*':
configVariations.push([
{hermesVariant: HermesVariant.Hermes},
{hermesVariant: HermesVariant.StaticHermes},
{hermesVariant: HermesVariant.StaticHermesStable},
{hermesVariant: HermesVariant.StaticHermesStaging},
{hermesVariant: HermesVariant.StaticHermesExperimental},
]);
break;
+8 -3
View File
@@ -20,7 +20,8 @@ const BUCK_ISOLATION_DIR = 'react-native-fantom-buck-out';
export enum HermesVariant {
Hermes,
StaticHermes, // Static Hermes Stable
StaticHermesStable, // Static Hermes Stable
StaticHermesStaging, // Static Hermes Staging
StaticHermesExperimental, // Static Hermes Trunk
}
@@ -30,8 +31,10 @@ export function getBuckOptionsForHermes(
switch (variant) {
case HermesVariant.Hermes:
return [];
case HermesVariant.StaticHermes:
case HermesVariant.StaticHermesStable:
return ['-c hermes.static_hermes=stable'];
case HermesVariant.StaticHermesStaging:
return ['-c hermes.static_hermes=staging'];
case HermesVariant.StaticHermesExperimental:
return ['-c hermes.static_hermes=trunk'];
}
@@ -41,8 +44,10 @@ export function getHermesCompilerTarget(variant: HermesVariant): string {
switch (variant) {
case HermesVariant.Hermes:
return '//xplat/hermes/tools/hermesc:hermesc';
case HermesVariant.StaticHermes:
case HermesVariant.StaticHermesStable:
return '//xplat/shermes/stable:hermesc';
case HermesVariant.StaticHermesStaging:
return '//xplat/shermes/staging:hermesc';
case HermesVariant.StaticHermesExperimental:
return '//xplat/static_h:hermesc';
}
@@ -6,12 +6,12 @@
*
* @flow strict-local
* @format
* @fantom_hermes_variant static_hermes
* @fantom_hermes_variant static_hermes_stable
*/
declare var HermesInternal: $HermesInternalType;
describe('"@fantom_hermes_variant static_hermes" in docblock', () => {
describe('"@fantom_hermes_variant static_hermes_stable" in docblock', () => {
it('should use Static Hermes', () => {
expect(HermesInternal.getRuntimeProperties?.()['Static Hermes']).toBe(true);
});
@@ -0,0 +1,18 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @fantom_hermes_variant static_hermes_staging
*/
declare var HermesInternal: $HermesInternalType;
describe('"@fantom_hermes_variant static_hermes_staging" in docblock', () => {
it('should use Static Hermes', () => {
expect(HermesInternal.getRuntimeProperties?.()['Static Hermes']).toBe(true);
});
});