Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate jsc-android to mavenCentral #47972

Closed
wants to merge 3 commits into from
Closed

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Nov 26, 2024

Summary:

Since people mostly use Hermes, it doesn't make sense to download jsc-android from npm even when jsc is not used. This PR migrates the jsc-android to mavenCentral. The new jsc-android supports Android 16KB memory page sizes and packaged by prefab.
Relevant PRs:

Changelog:

[ANDROID] [CHANGED] - Migrate jsc-android to mavenCentral

Test Plan:

CI passed

@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. Contributor A React Native contributor. p: Expo Partner: Expo Partner labels Nov 26, 2024
@Kudo Kudo marked this pull request as ready for review November 27, 2024 15:34
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 27, 2024
@NickGerleman
Copy link
Contributor

Love this change!

@cortinico will probably want to take a look at this, but is on PTO and will be back soon.

@NickGerleman
Copy link
Contributor

Side-note, IIRC JSCRuntime::createWeakObject secretly returns strong refs, which is really sketch, because I think new arch does actually create weak refs in places? @javache has been porting some bits over to JSC where new arch relies on it though like Native State I remember. I sometimes worry a bit about the continued support where Meta isn't really testing with JSC anymore, and whether there is a path to deprecating it.

@Kudo
Copy link
Contributor Author

Kudo commented Nov 27, 2024

cool thanks for the note. i was just waiting for Nico coming back.

JSCRuntime::createWeakObject secretly returns strong refs

would be good to know more about this. does that happen on ios or just jsc-android only? if it happens on ios, it would be tough because we have no way to touch jsc on ios.

I sometimes worry a bit about the continued support where Meta isn't really testing with JSC anymore, and whether there is a path to deprecating it.

totally makes sense. i had some thought for this and would write a RFC for lean core of jsc.

@@ -81,14 +81,14 @@ def enableProguardInReleaseBuilds = false
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
* `def jscFlavor = "io.github.react-native-community:jsc-android-intl:2026004.+"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Do we still need a JSC flavor? Can we just have a single string/flavor for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just to keep it as backward compatible for a while. in the future we can remove this entirely

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a heads up: this requires a PR against https://github.com/react-native-community/template

packages/react-native/ReactCommon/jsc/CMakeLists.txt Outdated Show resolved Hide resolved
packages/react-native/ReactCommon/jsc/CMakeLists.txt Outdated Show resolved Hide resolved
@cortinico
Copy link
Contributor

BTW this is awesome!

@Kudo
Copy link
Contributor Author

Kudo commented Nov 28, 2024

side note: the proposing RFC to move away JSC from core react-native-community/discussions-and-proposals#836

Kudo added a commit to react-native-community/jsc-android-buildscripts that referenced this pull request Nov 28, 2024
# Why

following up facebook/react-native#47972 (comment)

# How

move prefab headers into `JavaScriptCore/` directory, so that `#include <JavaScriptCore/JavaScript.h>` in JSCRuntime will not break. this also simulates how JavaScriptCore.framework works.
@Kudo Kudo requested a review from cortinico November 29, 2024 07:50
@@ -81,14 +81,14 @@ def enableProguardInReleaseBuilds = false
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
* `def jscFlavor = "io.github.react-native-community:jsc-android-intl:2026004.+"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a heads up: this requires a PR against https://github.com/react-native-community/template

add_library(fbjni ALIAS fbjni::fbjni)
add_library(jsc ALIAS jsc-android::jsc)
Copy link
Contributor

Choose a reason for hiding this comment

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

that's great. The only thing for us to remember is that we'll have to bump/publish a new version of the JSC library whenever we bump the NDK

@facebook-github-bot
Copy link
Contributor

@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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

@cortinico merged this pull request in e42a3a6.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @Kudo in e42a3a6

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

@Kudo Kudo deleted the @kudo/jsc-maven branch December 10, 2024 08:59
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. Contributor A React Native contributor. Merged This PR has been merged. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants