From 2a7e37e51e4ad7c2d6045c94e8d65c2d64aaee40 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Mon, 9 Jun 2025 20:30:32 -0700 Subject: [PATCH] RN: Move `tools/api` to `private/cxx-public-api` (#51859) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51859 Moves `tools/apis` to `private/cxx-public-api` and cleans up a few things: - Clean up the `BUCK` file a bit. - Deduplicate relative paths in scripts. - Prefix the private package name with `react-native/`. Changelog: [Internal] Reviewed By: huntie Differential Revision: D76091765 fbshipit-source-id: 6fac7423f9d205085b0b21465f65075a850b61e2 --- package.json | 1 - {tools/api => private/cxx-public-api}/ReactNativeCPP.api | 0 {tools/api => private/cxx-public-api}/check-api.sh | 9 +++++---- {tools/api => private/cxx-public-api}/package.json | 2 +- {tools/api => private/cxx-public-api}/public-api.conf | 2 +- {tools/api => private/cxx-public-api}/public-api.js | 0 6 files changed, 7 insertions(+), 7 deletions(-) rename {tools/api => private/cxx-public-api}/ReactNativeCPP.api (100%) rename {tools/api => private/cxx-public-api}/check-api.sh (91%) rename {tools/api => private/cxx-public-api}/package.json (89%) rename {tools/api => private/cxx-public-api}/public-api.conf (94%) rename {tools/api => private/cxx-public-api}/public-api.js (100%) diff --git a/package.json b/package.json index da64b27fd67..e4e32d0abae 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "workspaces": [ "packages/*", "private/*", - "tools/*", "!packages/helloworld" ], "devDependencies": { diff --git a/tools/api/ReactNativeCPP.api b/private/cxx-public-api/ReactNativeCPP.api similarity index 100% rename from tools/api/ReactNativeCPP.api rename to private/cxx-public-api/ReactNativeCPP.api diff --git a/tools/api/check-api.sh b/private/cxx-public-api/check-api.sh similarity index 91% rename from tools/api/check-api.sh rename to private/cxx-public-api/check-api.sh index 02f79634006..3bf419aa7a9 100755 --- a/tools/api/check-api.sh +++ b/private/cxx-public-api/check-api.sh @@ -73,12 +73,13 @@ pushd "$FBSOURCE_ROOT/xplat/js/react-native-github" || exit $ERR_CODE_CANT_FIND_ trap cleanup EXIT # TODO: This operates in the sandbox and can't modify files in the repository, which we need for change detection -# buck2 run //xplat/js/react-native-github/tools/api:public-api -(cd tools/api && $YARN_BINARY install) -$NODE_BINARY tools/api/public-api.js +# buck2 run //xplat/js/react-native-github/private/cxx-public-api:public-api +REPO_RELATIVE_DIR="private/cxx-public-api" +(cd "$REPO_RELATIVE_DIR" && $YARN_BINARY install) +$NODE_BINARY "$REPO_RELATIVE_DIR/public-api.js" echo -API_FILE=$(grep -oP '(?<=output=)[^ \n]+' tools/api/public-api.conf) +API_FILE=$(grep -oP '(?<=output=)[^ \n]+' "$REPO_RELATIVE_DIR/public-api.conf") API_STATUS=$(hg status --no-status "$API_FILE") if [ -z "$API_STATUS" ]; then diff --git a/tools/api/package.json b/private/cxx-public-api/package.json similarity index 89% rename from tools/api/package.json rename to private/cxx-public-api/package.json index e0e092d2338..11e3c5cb75e 100644 --- a/tools/api/package.json +++ b/private/cxx-public-api/package.json @@ -1,5 +1,5 @@ { - "name": "public-api", + "name": "@react-native/cxx-public-api", "version": "0.0.1", "description": "Captures the Objective-C / C++ public API of React Native", "main": "public-api.js", diff --git a/tools/api/public-api.conf b/private/cxx-public-api/public-api.conf similarity index 94% rename from tools/api/public-api.conf rename to private/cxx-public-api/public-api.conf index cc34a11319c..1abb1b3ef23 100644 --- a/tools/api/public-api.conf +++ b/private/cxx-public-api/public-api.conf @@ -22,6 +22,6 @@ packages/react-native/Libraries/WebSocket/* packages/react-native/Libraries/Wrapper/Example/* [settings] -output=tools/api/ReactNativeCPP.api +output=private/cxx-public-api/ReactNativeCPP.api ; clang=$HOME/some/path/to/clang ; clang-format=$HOME/some/path/to/clang-format diff --git a/tools/api/public-api.js b/private/cxx-public-api/public-api.js similarity index 100% rename from tools/api/public-api.js rename to private/cxx-public-api/public-api.js