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

Do not store .cpp/.h files inside src/main/java - fabricjni #34435

Closed
wants to merge 1 commit into from

Conversation

cortinico
Copy link
Contributor

Summary:
Currently we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for fabricjni

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - fabricjni

Reviewed By: cipolleschi

Differential Revision: D38741130

Summary:
Currently we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for fabricjni

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - fabricjni

Reviewed By: cipolleschi

Differential Revision: D38741130

fbshipit-source-id: 773df77fbe27cae30af68d280b5af4dc4e76eb1d
@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 fb-exported labels Aug 17, 2022
@facebook-github-bot
Copy link
Contributor

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

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,613,899 -6
android hermes armeabi-v7a 7,028,904 -12
android hermes x86 7,914,354 -31
android hermes x86_64 7,888,296 +11
android jsc arm64-v8a 9,492,866 +8
android jsc armeabi-v7a 8,270,746 -11
android jsc x86 9,430,919 -29
android jsc x86_64 10,023,957 +13

Base commit: ba383ba
Branch: main

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 163636d
Branch: main

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @cortinico in 4706d13.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 17, 2022
roryabraham pushed a commit to Expensify/react-native that referenced this pull request Aug 17, 2022
…#34435)

Summary:
Pull Request resolved: facebook#34435

Currently we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for fabricjni

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - fabricjni

Reviewed By: cipolleschi

Differential Revision: D38741130

fbshipit-source-id: f9e3e4514d3ae0ddeac65256928d71d5134d08f8
roryabraham pushed a commit to Expensify/react-native that referenced this pull request Aug 17, 2022
…#34435)

Summary:
Pull Request resolved: facebook#34435

Currently we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for fabricjni

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - fabricjni

Reviewed By: cipolleschi

Differential Revision: D38741130

fbshipit-source-id: f9e3e4514d3ae0ddeac65256928d71d5134d08f8
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