Skip to content

Enable module annotation processor with gradle - #25922

Closed
janicduplessis wants to merge 18 commits into
react:mainfrom
janicduplessis:annotations-compiler
Closed

Enable module annotation processor with gradle#25922
janicduplessis wants to merge 18 commits into
react:mainfrom
janicduplessis:annotations-compiler

Conversation

@janicduplessis

@janicduplessisjanicduplessis commented Aug 2, 2019

Copy link
Copy Markdown
Contributor

Summary

Run the module annotation processor with gradle.

To do this we need to separate the annotation and the annotations compiler into separate modules. I kept the same package names but files are now in different folders.

Changelog

[Android] [Added] - Enable module annotation processor with gradle

Test Plan

Run RN tester

@facebook-github-botfacebook-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. labels Aug 2, 2019
@janicduplessis
janicduplessis marked this pull request as ready for review August 2, 2019 19:10
@react-native-botreact-native-bot added Platform: Android Android applications. Type: Enhancement A new feature or enhancement of an existing feature. labels Aug 2, 2019
@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

BUCK is kind of broken in OSS currently so I wasn't able to get it building 100%. Hermes is missing a BUCK file and the yoga target is missing a dep. Fixing this is outside of the scope of this PR.

This will definitely require a good amount of internal work to update BUCK files for annotations and model. Here are the steps to update the files:

react_native_target("java/com/facebook/react/module/annotations:annotations"), ->
react_native_annotations_target("java/com/facebook/react/module/annotations:annotations"),
react_native_target("java/com/facebook/react/module/model:model"), ->
react_native_annotations_target("java/com/facebook/react/module/model:model"),
Add "react_native_annotations_target" to the load section

Also I'm not sure how to get the processor to run with BUCK. We probably want to add that code to OSS and adjust the path to the processor.

@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

cc @axe-fb@mdvacca@cpojer

@mdvaccamdvacca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@facebook-github-botfacebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mdvacca is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@mdvaccamdvacca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@janicduplessis This PR is failing internally because react_native_annotations_target does not exists.

@dulmandakh would you like to help to review the Gradle integration?

@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

@mdvacca it is defined here https://github.com/janicduplessis/react-native/blob/edeac0bb77b7ebc2779cb6fa624abc0cf2a62cc4/tools/build_defs/oss/rn_defs.bzl#L80 but this file is used only for oss so you’ll have to add the definition in the one used internally.

@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

@mdvacca Any change you could have a look at this again?

@janicduplessis
janicduplessisforce-pushed the annotations-compiler branch 3 times, most recently from 180e408 to 0c9b49aCompareMay 29, 2020 19:08
@analysis-bot

analysis-bot commented May 29, 2020

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
ios-universaln/a--

Base commit: 1b3581e
Branch: main

@janicduplessis
janicduplessisforce-pushed the annotations-compiler branch 2 times, most recently from b080a90 to 85baa27CompareMay 29, 2020 19:44
@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

Ok so I kept BUCK files in the old location that just re-export the ones in the android/annotations folder, this way no changes should be needed in files that import these modules.

cc @mdvacca@RSNara

@analysis-bot

analysis-bot commented May 29, 2020

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a8,188,503-603
androidhermesarmeabi-v7a7,788,936-597
androidhermesx868,558,597-601
androidhermesx86_648,510,974-605
androidjscarm64-v8a9,858,037+431
androidjscarmeabi-v7a8,843,353+441
androidjscx869,824,728+437
androidjscx86_6410,421,207+446

Base commit: 1b3581e
Branch: main

@yungstersyungsters self-assigned this Aug 11, 2021
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

1 similar comment
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@yungsters

Copy link
Copy Markdown
Contributor

I have been trying to import this but it's too old (which is totally our fault, to which I apologize).

@janicduplessis, do you still want to push this through? And if so, would you mind helping rebase it?

@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

Hey @yungsters, thanks for looking at this. I have an updated version of it that I've been maintaining in my fork, will update this in a bit.

@analysis-botanalysis-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code analysis results:

Comment threadReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java Outdated
Comment threadReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java Outdated
Comment threadReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java Outdated
janicduplessisand others added 14 commits February 11, 2022 14:00
This reverts commit 46105291ab539d298838f6dc481e09e2b5c51467.
…cebook/react/module/annotations/BaseNativeModule.java
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
…cebook/react/module/annotations/BaseNativeModule.java
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
…cebook/react/module/annotations/BUCK
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
…cebook/react/module/model/BUCK
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

@cortinico Done!

facebook-github-bot pushed a commit that referenced this pull request Jan 31, 2023
Summary:
This sync includes the following changes:
- **[48b687f](react/react@48b687fc9 )**: [trusted types][www] Add enableTrustedTypesIntegration flag back in ([#26016](react/react#26016)) //<an onion>//
- **[9b1423c](react/react@9b1423cc0 )**: Revert "Hold host functions in var" ([#26079](react/react#26079)) //<Samuel Susla>//
- **[ce09ace](react/react@ce09ace9a )**: Improve Error Messages when Access Client References ([#26059](react/react#26059)) //<Sebastian Markbåge>//
- **[0652bdb](react/react@0652bdbd1 )**: Add flow types to Maps in ReactNativeViewConfigRegistry.js ([#26064](react/react#26064)) //<Samuel Susla>//
- **[ee85098](react/react@ee8509801 )**: [cleanup] remove deletedTreeCleanUpLevel feature flag ([#25529](react/react#25529)) //<Jan Kassens>//
- **[0e31dd0](react/react@0e31dd028 )**: Remove findDOMNode www shim ([#25998](react/react#25998)) //<Jan Kassens>//
- **[379dd74](react/react@379dd741e )**: [www] set enableTrustedTypesIntegration to false ([#25997](react/react#25997)) //<Jan Kassens>//
- **[555ece0](react/react@555ece0cd )**: Don't warn about concurrently rendering contexts if we finished rendering ([#22797](react/react#22797)) //<Sebastian Silbermann>//
- **[0fce6bb](react/react@0fce6bb49 )**: [cleanup] remove feature flags warnAboutDefaultPropsOnFunctionComponents and warnAboutStringRefs ([#25980](react/react#25980)) //<Jan Kassens>//
- **[7002a67](react/react@7002a6743 )**: [cleanup] remove unused values from ReactFeatureFlags.www-dynamic ([#25575](react/react#25575)) //<Jan Kassens>//
- **[a48e54f](react/react@a48e54f2b )**: [cleanup] remove old feature flag warnAboutDeprecatedLifecycles ([#25978](react/react#25978)) //<Jan Kassens>//
- **[0f4a835](react/react@0f4a83596 )**: Remove duplicate JSResourceReferenceImpl mock ([#25976](react/react#25976)) //<Jan Kassens>//
- **[c491316](react/react@c49131669 )**: Remove unused Flow suppressions ([#25977](react/react#25977)) //<Jan Kassens>//
- **[afe6521](react/react@afe6521e1 )**: Refactor: remove useless parameter ([#25923](react/react#25923)) //<Chris>//
- **[34464fb](react/react@34464fb16 )**: Upgrade to Flow 0.196.3 ([#25974](react/react#25974)) //<Jan Kassens>//
- **[e2424f3](react/react@e2424f33b )**: [flow] enable exact_empty_objects ([#25973](react/react#25973)) //<Jan Kassens>//
- **[0b4f443](react/react@0b4f44302 )**: [flow] enable enforce_local_inference_annotations ([#25921](react/react#25921)) //<Jan Kassens>//
- **[0b97441](react/react@0b974418c )**: [Fizz] Fork Fizz instruction set for inline script and external runtime ([#25862](react/react#25862)) //<mofeiZ>//
- **[5379b61](react/react@5379b6123 )**: Batch sync, default and continuous lanes ([#25700](react/react#25700)) //<Tianyu Yao>//
- **[bbf4d22](react/react@bbf4d2211 )**: Update import for babel-code-frame in build script ([#25963](react/react#25963)) //<Ming Ye>//
- **[b83baf6](react/react@b83baf63f )**: Transform updates to support Flow this annotation syntax ([#25918](react/react#25918)) //<Jan Kassens>//
- **[c2d6552](react/react@c2d655207 )**: Unify `use` and `renderDidSuspendDelayIfPossible` implementations ([#25922](react/react#25922)) //<Andrew Clark>//
- **[48274a4](react/react@48274a43a )**: Remove vestigial Suspense batching logic ([#25861](react/react#25861)) //<Andrew Clark>//
- **[de7d1c9](react/react@de7d1c907 )**: Add `fetchPriority` to `<img>` and `<link>` ([#25927](react/react#25927)) //<Steven>//
- **[81d4ee9](react/react@81d4ee9ca )**: reconciler docs: fix small typo - "mode" (instead of "node") ([#25863](react/react#25863)) //<satelllte>//
- **[5fcf1a4](react/react@5fcf1a4b4 )**: Bugfix: Synchronous ping during render phase sometimes unwinds the stack, leading to crash ([#25851](react/react#25851)) //<Andrew Clark>//
- **[2b1fb91](react/react@2b1fb91a5 )**: ESLint upgrade to use hermes-eslint ([#25915](react/react#25915)) //<Jan Kassens>//
- **[fabef7a](react/react@fabef7a6b )**: Resubmit Add HydrationSyncLane ([#25878](react/react#25878)) //<Tianyu Yao>//
- **[7efa9e5](react/react@7efa9e597 )**: Fix unwinding context during selective hydration ([#25876](react/react#25876)) //<Tianyu Yao>//
- **[84a0a17](react/react@84a0a171e )**: Rename experimental useEvent to useEffectEvent ([#25881](react/react#25881)) //<Sebastian Markbåge>//
- **[4dda96a](react/react@4dda96a40 )**: [react-www] remove forked bundle ([#25866](react/react#25866)) //<Jan Kassens>//
- **[9c09c1c](react/react@9c09c1cd6 )**: Revert "Fork ReactDOMSharedInternals for www ([#25791](react/react#25791))" ([#25864](react/react#25864)) //<lauren>//
- **[996e4c0](react/react@996e4c0d5 )**: Offscreen add attach ([#25603](react/react#25603)) //<Samuel Susla>//
- **[b14d7fa](react/react@b14d7fa4b )**: Add support for setNativeProps to Fabric ([#25737](react/react#25737)) //<Samuel Susla>//
- **[8196872](react/react@819687279 )**: [Float] Fix typo in ReactDOMResourceValidation.js ([#25798](react/react#25798)) //<Ikko Ashimine>//
- **[5dfc485](react/react@5dfc485f6 )**: fix tests for when float is off ([#25839](react/react#25839)) //<Josh Story>//
- **[bfcbf33](react/react@bfcbf3306 )**: toString children of title ([#25838](react/react#25838)) //<Sebastian Markbåge>//
- **[d4bc16a](react/react@d4bc16a7d )**: Revert "[react-www] remove forked bundle" ([#25837](react/react#25837)) //<Ricky>//
- **[d69b2cf](react/react@d69b2cf82 )**: [bug fix] revert values in ReactFiberFlags to keep consistency for devtools ([#25832](react/react#25832)) //<Mengdi Chen>//
- **[645ae26](react/react@645ae2686 )**: [react-www] remove forked bundle ([#25831](react/react#25831)) //<Jan Kassens>//
- **[d807eb5](react/react@d807eb52c )**: Revert recent hydration changes ([#25812](react/react#25812)) //<Andrew Clark>//
- **[2ccfa65](react/react@2ccfa657d )**: Fork ReactDOMSharedInternals for www ([#25791](react/react#25791)) //<lauren>//
- **[f0534ae](react/react@f0534ae94 )**: Avoid replaying SelectiveHydrationException in dev ([#25754](react/react#25754)) //<Tianyu Yao>//
- **[7fab379](react/react@7fab379d8 )**: fix link to ReactDOMHostconfig in reconciler docs ([#25788](react/react#25788)) //<Dmitry>//
- **[500c8aa](react/react@500c8aa08 )**: Add component name to StrictMode error message ([#25718](react/react#25718)) //<Samuel Susla>//
- **[353c302](react/react@353c30252 )**: Hold host functions in var ([#25741](react/react#25741)) //<Samuel Susla>//
Changelog:
[General][Changed] - React Native sync for revisions 17f6912...48b687f
jest_e2e[run_all_tests]
Reviewed By: rubennorte
Differential Revision: D42855483
fbshipit-source-id: c244a595bb2d490a23b333c1b16d04a459ec94fc
@github-actions

This comment was marked as off-topic.

@github-actionsgithub-actionsBot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 13, 2023
@cortinicocortinico removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 13, 2023
@janicduplessis

janicduplessis commented Mar 15, 2023

Copy link
Copy Markdown
ContributorAuthor

@cortinico Is there still interest in merging this? I think it might need some major refactoring with the repo changes that are coming. Maybe you also have some ideas about how we could improve the approach.

@cortinico

Copy link
Copy Markdown
Contributor

@cortinico Is there still interest in merging this? I think it might need some major refactoring with the repo changes that are coming. Maybe you also have some ideas about how we could improve the approach.

Yes I'd love to have this merged. I've been thinking at this as we approached the RNGP and the monorepo work (which is close to land).

This will have to be moved to a packages/module-spec-annotation-processor (or any other name) and from there we'll have to have a Gradle build that publishes 2 artifacts on Maven Central (the annotation and the process).

@janicduplessis

Copy link
Copy Markdown
ContributorAuthor

Sounds good, I will wait for monorepo work to land first and then try that when I get some time.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actionsgithub-actionsBot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 13, 2023
@cortinicocortinico removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 13, 2023
@cortinico

Copy link
Copy Markdown
Contributor

Hey @janicduplessis
Small heads up that I still have this PR on my plate.

After the monorepo work, we could look into merging it.
The reason why it's currently on hold is that we're looking into understanding what would be the role of Annotation Processors within the New Architecture of React Native.

I should be able to get back to this in 1/2 months. Thanks for your patience.

@cortinico

Copy link
Copy Markdown
Contributor

Hey @janicduplessis
Sorry for the late reply.

We discussed this internally with @mdvacca and we decided that we'll be dropping the Annotation Processors in the coming future (we'll remove the code generation part from our internal codebase). So I'm closing this now.
We'll reopen this if we revisit this decision

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.ContributorA React Native contributor.Platform: AndroidAndroid applications.Type: EnhancementA new feature or enhancement of an existing feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@janicduplessis@analysis-bot@facebook-github-bot@yungsters@pull-bot@cortinico@mdvacca@sota000@react-native-bot