Skip to content

Add Buck CLI override for Kotlin feature flag defaults#56558

Closed
motiz88 wants to merge 2 commits intofacebook:mainfrom
motiz88:export-D101974653
Closed

Add Buck CLI override for Kotlin feature flag defaults#56558
motiz88 wants to merge 2 commits intofacebook:mainfrom
motiz88:export-D101974653

Conversation

@motiz88
Copy link
Copy Markdown
Contributor

@motiz88 motiz88 commented Apr 22, 2026

Summary:
The C++ feature flag default override mechanism (D101484355) only affects ReactNativeFeatureFlagsDefaults.h. When flags are read from the Kotlin side, ReactNativeFeatureFlagsDefaults.kt is used instead — its defaults are duplicated rather than read via JNI (see comment in the file: "more expensive than just duplicating the defaults here").

Here, we apply the same --config react_native.feature_flag_defaults override to the Kotlin file at build time, using the same genrule pattern. A regex-based Python script rewrites override fun <name>(): <Type> = <value> lines.

Changelog: [Internal]

Differential Revision: D101974653

motiz88 added 2 commits April 22, 2026 04:52
Summary:

Replaces the regex-based core of the Buck RN C++ feature flag override mechanism (D101484355) with a `tree-sitter` parser for sustainability.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D101629456
Summary:
The C++ feature flag default override mechanism (D101484355) only affects `ReactNativeFeatureFlagsDefaults.h`. When flags are read from the Kotlin side, `ReactNativeFeatureFlagsDefaults.kt` is used instead — its defaults are duplicated rather than read via JNI (see comment in the file: "more expensive than just duplicating the defaults here").

Here, we apply the same `--config react_native.feature_flag_defaults` override to the Kotlin file at build time, using the same genrule pattern. A regex-based Python script rewrites `override fun <name>(): <Type> = <value>` lines.

Changelog: [Internal]

Differential Revision: D101974653
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 22, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 22, 2026

@motiz88 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101974653.

@meta-codesync meta-codesync Bot closed this in e67dba1 Apr 23, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Apr 23, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 23, 2026

This pull request has been merged in e67dba1.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @motiz88 in e67dba1

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants