Skip to content

Conversation

@cipolleschi
Copy link
Contributor

Summary:
The old architecture looks broken because in the OnLoad.cpp file we try to include the autolinking.h header which is only generated when the New Architecture is enabled.

This fix guards the include and the usage of the function provided by the autolinking so that the old architecture should work as well.

Changelog

[Internal] - Include autolinkin.h in OnLoad.cpp only if it exists

Differential Revision: D66295318

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Nov 21, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66295318

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 21, 2024
Summary:

The old architecture looks broken because in the OnLoad.cpp file we try to include the autolinking.h header which is only generated when the New Architecture is enabled.

This fix guards the include and the usage of the function provided by the autolinking so that the old architecture should work as well.

## Changelog
[Internal] - Include autolinkin.h in OnLoad.cpp only if it exists

Differential Revision: D66295318
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66295318

Summary:

The old architecture looks broken because in the OnLoad.cpp file we try to include the autolinking.h header which is only generated when the New Architecture is enabled.

This fix guards the include and the usage of the function provided by the autolinking so that the old architecture should work as well.

## Changelog
[Internal] - Include autolinkin.h in OnLoad.cpp only if it exists

Reviewed By: blakef

Differential Revision: D66295318
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66295318

Comment on lines +84 to +86
#endif

return nullptr;
Copy link
Collaborator

@tido64 tido64 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang might complain about unreachable code (with -Wunreachable-code):

Suggested change
#endif
return nullptr;
#else
return nullptr;
#endif

#include <DefaultComponentsRegistry.h>
#include <DefaultTurboModuleManagerDelegate.h>
#if __has_include("<autolinking.h>")
#define AUTOLINKING_AVAILABLE 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Technically, autolinking is still available. Just not TurboModules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the define is just to have a quick way to compile out the pieces that could not be available in the rest of the file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I know. I was commenting on the name of the macro 😄

REACT_NATIVE_APP_COMPONENT_REGISTRATION(registry);
#endif

#if AUTOLINKING_AVAILABLE
Copy link
Collaborator

@tido64 tido64 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think on iOS, we can enable New Arch at runtime. I don't recall if we can on Android. If so, won't this break on Android?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, android can't disable the new arch at runtime. You can disable some pieces, but it is not recommended.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Nov 21, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in b8419b2.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @cipolleschi in b8419b2

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

blakef pushed a commit that referenced this pull request Dec 4, 2024
Summary:
Pull Request resolved: #47875

The old architecture looks broken because in the OnLoad.cpp file we try to include the autolinking.h header which is only generated when the New Architecture is enabled.

This fix guards the include and the usage of the function provided by the autolinking so that the old architecture should work as well.

## Changelog
[Internal] - Include autolinkin.h in OnLoad.cpp only if it exists

Reviewed By: blakef

Differential Revision: D66295318

fbshipit-source-id: 18461e6b70ac92af57b805bef51c0df49db02283
cortinico added a commit that referenced this pull request Dec 6, 2024
blakef pushed a commit that referenced this pull request Dec 9, 2024
cipolleschi pushed a commit that referenced this pull request Dec 16, 2024
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Dec 19, 2024
…k#47875)"

Summary:
We reverted [this commit](facebook@5b2bbb8) in 0.76 and 0.77 as it was not the right fix.

## Changelog
[Internal] - Revert excluding `autolinking.h` only if it exists

Differential Revision: D67456530
facebook-github-bot pushed a commit that referenced this pull request Dec 20, 2024
#48341)

Summary:
Pull Request resolved: #48341

We reverted [this commit](5b2bbb8) in 0.76 and 0.77 as it was not the right fix.

## Changelog
[Internal] - Revert excluding `autolinking.h` only if it exists

Reviewed By: alanleedev

Differential Revision: D67456530

fbshipit-source-id: 0f7bfc11d23f7a8fef5100784754add5b4ecda58
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. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants