Skip to content

fix: prevent error when react extension was already created#43694

Closed
AlexanderEggers wants to merge 1 commit into
facebook:mainfrom
AlexanderEggers:patch-1
Closed

fix: prevent error when react extension was already created#43694
AlexanderEggers wants to merge 1 commit into
facebook:mainfrom
AlexanderEggers:patch-1

Conversation

@AlexanderEggers

Copy link
Copy Markdown
Contributor

Summary:

Currently the react-native-gradle-plugin does not allow the "react" plugin extension to already exist when running its apply block. I had a use-case where I wanted to create a new gradle plugin which would take care of applying the react plugin including setting some of its options. Without the change in this PR, this would currently turn into a build failure.

Changelog:

[ANDROID] [FIXED] - prevent error when the "react" extension was already created by another gradle plugin

Test Plan:

@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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Mar 28, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@analysis-bot

analysis-bot commented Mar 29, 2024

Copy link
Copy Markdown
Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 18,876,970 +4
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,250,017 -3
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: d0cac87
Branch: main

@AlexanderEggers

Copy link
Copy Markdown
Contributor Author

@zeyap I saw that you've imported this PR. I made some additional changes to get the CI green - just a few minor things I missed in my initial commit. Let me know if you notice anything.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 1, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@zeyap merged this pull request in b9dad7f.

@NickGerleman

Copy link
Copy Markdown
Contributor

This doesn't seem to compile.

FAILURE: Build failed with an exception.

* Where:
Build file '/root/react-native/packages/react-native/ReactAndroid/build.gradle.kts' line: 784

* What went wrong:
Script compilation errors:

  Line 784: react {
            ^ Unresolved reference: react

  Line 787:   libraryName = "rncore"
              ^ Unresolved reference: libraryName

  Line 788:   jsRootDir = file("../src")
              ^ Unresolved reference: jsRootDir

@AlexanderEggers

Copy link
Copy Markdown
Contributor Author

@NickGerleman Were you testing with the latest commit in this PR? Can you show me how you tried to test that and I can give that a try as well

@AlexanderEggers AlexanderEggers deleted the patch-1 branch April 2, 2024 03:48
@AlexanderEggers

Copy link
Copy Markdown
Contributor Author

All tests were also green, so I expected things to just work, no?

@NickGerleman

Copy link
Copy Markdown
Contributor

This failed CircleCI tests that should run on PR.

@AlexanderEggers

Copy link
Copy Markdown
Contributor Author

Oh okay.. well I will have another look at this (and will open a new PR soon) but I'm using this already as a patch and it is working fine for me locally.

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. Merged This PR has been merged. 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.

4 participants