mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
fix: missing symbols on prebuilt Android with hermesV1 disabled (#55400)
Summary: Since HermesV1 is enabled by default in React Native 0.84, the prebuilt Android artifacts are compiled with the flag `HERMES_V1_ENABLED`. This results in dropping some inspector symbols, in my case `enableDebugging` and `disableDebugging` from `inspector-modern/chrome/Registration.cpp`. This is problematic, because even if the app sets `hermesV1Enabled=false` in `gradle.properties`, it's shipped with binaries compiled with `hermesV1Enabled=true`. This makes it so I'm expecting symbols that should be available when `HERMES_V1_ENABLED` macro isn't defined - but they aren't available. I don't know what other symbols could lead to compilation failures, maybe shipping a whole other binary would be a better idea. For the time being I made a simple fix that would provide fallback implementations instead of not generating them at all. ## Changelog: [ANDROID] [FIXED] - Provide symbol fallbacks for `inspector-modern/chrome/Registration.h` when HermesV1 is disabled. Pull Request resolved: https://github.com/facebook/react-native/pull/55400 Test Plan: I tested these changes (although in `Registration.h` file) in a project, not building from source, and they worked. Reviewed By: cipolleschi Differential Revision: D92964824 Pulled By: cortinico fbshipit-source-id: a87ceab6d25095062de200d1a08821dba379240d
This commit is contained in:
1 parent
f3678f51d9
commit
5ee695ad8f
1 file changed
+44
-3
@@ -8,10 +8,13 @@
|
||||
#include "Registration.h"
|
||||
#include "ConnectionDemux.h"
|
||||
|
||||
#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
|
||||
#if defined(HERMES_ENABLE_DEBUGGER)
|
||||
|
||||
#include <hermes/hermes.h>
|
||||
|
||||
#if !defined(HERMES_V1_ENABLED)
|
||||
|
||||
namespace facebook::hermes::inspector_modern::chrome {
|
||||
|
||||
namespace {
|
||||
|
||||
ConnectionDemux& demux() {
|
||||
@@ -34,4 +37,42 @@ void disableDebugging(DebugSessionToken session) {
|
||||
|
||||
} // namespace facebook::hermes::inspector_modern::chrome
|
||||
|
||||
#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
|
||||
#else
|
||||
|
||||
namespace facebook::hermes::inspector_modern {
|
||||
class RuntimeAdapter {
|
||||
// Backwards compatibility definition fallback for libraries that are compiled
|
||||
// without `HERMES_V1_ENABLED` but are linked against React Native with
|
||||
// `HERMES_V1_ENABLED` which doesn't provide this symbol.
|
||||
public:
|
||||
virtual ~RuntimeAdapter() = 0;
|
||||
virtual HermesRuntime& getRuntime() = 0;
|
||||
virtual void tickleJs();
|
||||
};
|
||||
|
||||
namespace chrome {
|
||||
|
||||
using DebugSessionToken = int;
|
||||
|
||||
DebugSessionToken enableDebugging(
|
||||
std::unique_ptr<RuntimeAdapter>,
|
||||
const std::string&) {
|
||||
// Backwards compatibility fallback for libraries that are compiled without
|
||||
// `HERMES_V1_ENABLED` but are linked against React Native with
|
||||
// `HERMES_V1_ENABLED` which doesn't provide this symbol.
|
||||
return -1;
|
||||
};
|
||||
|
||||
void disableDebugging(DebugSessionToken) {
|
||||
// Backwards compatibility fallback for libraries that are compiled without
|
||||
// `HERMES_V1_ENABLED` but are linked against React Native with
|
||||
// `HERMES_V1_ENABLED` which doesn't provide this symbol.
|
||||
}
|
||||
|
||||
} // namespace chrome
|
||||
|
||||
} // namespace facebook::hermes::inspector_modern
|
||||
|
||||
#endif // !defined(HERMES_V1_ENABLED)
|
||||
|
||||
#endif // defined(HERMES_ENABLE_DEBUGGER)
|
||||
Reference in new issue
Block a user