Skip to content

Commit 29704b1

Browse files
rubennortefacebook-github-bot
authored andcommitted
Add support for Static Hermes staging in Fantom (#52105)
Summary: Pull Request resolved: #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
1 parent ccc8ce0 commit 29704b1

5 files changed

Lines changed: 43 additions & 14 deletions

File tree

private/react-native-fantom/runner/formatFantomConfig.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ function formatFantomHermesVariant(hermesVariant: HermesVariant): string {
3535
switch (hermesVariant) {
3636
case FantomTestConfigHermesVariant.Hermes:
3737
return 'hermes';
38-
case FantomTestConfigHermesVariant.StaticHermes:
39-
return 'hermes 🆕';
38+
case FantomTestConfigHermesVariant.StaticHermesStable:
39+
return 'shermes 🆕';
40+
case FantomTestConfigHermesVariant.StaticHermesStaging:
41+
return 'shermes ⏭️';
4042
case FantomTestConfigHermesVariant.StaticHermesExperimental:
41-
return 'hermes 🧪';
43+
return 'shermes 🧪';
4244
}
4345
}
4446

private/react-native-fantom/runner/getFantomTestConfigs.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const MAX_FANTOM_CONFIGURATION_VARIATIONS = 12;
9090
* /**
9191
* * @flow strict-local
9292
* * @fantom_mode opt
93-
* * @fantom_hermes_variant static_hermes
93+
* * @fantom_hermes_variant static_hermes_stable
9494
* * @fantom_flags commonTestFlag:true
9595
* * @fantom_flags jsOnlyTestFlag:true
9696
* * @fantom_react_fb_flags reactInternalFlag:true
@@ -101,8 +101,8 @@ const MAX_FANTOM_CONFIGURATION_VARIATIONS = 12;
101101
* - `fantom_mode`: specifies the level of optimization to compile the test
102102
* with. Valid values are `dev`, `dev-bytecode` and `opt`.
103103
* - `fantom_hermes_variant`: specifies the Hermes variant to use to run the
104-
* test. Valid values are `hermes`, `static_hermes` and
105-
* `static_hermes_experimental`.
104+
* test. Valid values are `hermes`, `static_hermes_stable`,
105+
* `static_hermes_staging` and `static_hermes_experimental`.
106106
* - `fantom_flags`: specifies the configuration for common and JS-only feature
107107
* flags. They can be specified in the same pragma or in different ones, and
108108
* the format is `<flag_name>:<value>`.
@@ -187,16 +187,20 @@ export default function getFantomTestConfigs(
187187
case 'hermes':
188188
config.hermesVariant = HermesVariant.Hermes;
189189
break;
190-
case 'static_hermes':
191-
config.hermesVariant = HermesVariant.StaticHermes;
190+
case 'static_hermes_stable':
191+
config.hermesVariant = HermesVariant.StaticHermesStable;
192+
break;
193+
case 'static_hermes_staging':
194+
config.hermesVariant = HermesVariant.StaticHermesStaging;
192195
break;
193196
case 'static_hermes_experimental':
194197
config.hermesVariant = HermesVariant.StaticHermesExperimental;
195198
break;
196199
case '*':
197200
configVariations.push([
198201
{hermesVariant: HermesVariant.Hermes},
199-
{hermesVariant: HermesVariant.StaticHermes},
202+
{hermesVariant: HermesVariant.StaticHermesStable},
203+
{hermesVariant: HermesVariant.StaticHermesStaging},
200204
{hermesVariant: HermesVariant.StaticHermesExperimental},
201205
]);
202206
break;

private/react-native-fantom/runner/utils.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const BUCK_ISOLATION_DIR = 'react-native-fantom-buck-out';
2020

2121
export enum HermesVariant {
2222
Hermes,
23-
StaticHermes, // Static Hermes Stable
23+
StaticHermesStable, // Static Hermes Stable
24+
StaticHermesStaging, // Static Hermes Staging
2425
StaticHermesExperimental, // Static Hermes Trunk
2526
}
2627

@@ -30,8 +31,10 @@ export function getBuckOptionsForHermes(
3031
switch (variant) {
3132
case HermesVariant.Hermes:
3233
return [];
33-
case HermesVariant.StaticHermes:
34+
case HermesVariant.StaticHermesStable:
3435
return ['-c hermes.static_hermes=stable'];
36+
case HermesVariant.StaticHermesStaging:
37+
return ['-c hermes.static_hermes=staging'];
3538
case HermesVariant.StaticHermesExperimental:
3639
return ['-c hermes.static_hermes=trunk'];
3740
}
@@ -41,8 +44,10 @@ export function getHermesCompilerTarget(variant: HermesVariant): string {
4144
switch (variant) {
4245
case HermesVariant.Hermes:
4346
return '//xplat/hermes/tools/hermesc:hermesc';
44-
case HermesVariant.StaticHermes:
47+
case HermesVariant.StaticHermesStable:
4548
return '//xplat/shermes/stable:hermesc';
49+
case HermesVariant.StaticHermesStaging:
50+
return '//xplat/shermes/staging:hermesc';
4651
case HermesVariant.StaticHermesExperimental:
4752
return '//xplat/static_h:hermesc';
4853
}

private/react-native-fantom/src/__tests__/FantomHermesVariantStaticHermes-itest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
*
77
* @flow strict-local
88
* @format
9-
* @fantom_hermes_variant static_hermes
9+
* @fantom_hermes_variant static_hermes_stable
1010
*/
1111

1212
declare var HermesInternal: $HermesInternalType;
1313

14-
describe('"@fantom_hermes_variant static_hermes" in docblock', () => {
14+
describe('"@fantom_hermes_variant static_hermes_stable" in docblock', () => {
1515
it('should use Static Hermes', () => {
1616
expect(HermesInternal.getRuntimeProperties?.()['Static Hermes']).toBe(true);
1717
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
* @fantom_hermes_variant static_hermes_staging
10+
*/
11+
12+
declare var HermesInternal: $HermesInternalType;
13+
14+
describe('"@fantom_hermes_variant static_hermes_staging" in docblock', () => {
15+
it('should use Static Hermes', () => {
16+
expect(HermesInternal.getRuntimeProperties?.()['Static Hermes']).toBe(true);
17+
});
18+
});

0 commit comments

Comments
 (0)