Skip to content

Conversation

@sergeich
Copy link

@sergeich sergeich commented Jan 26, 2026

Summary:

Even though Sonatype Central repository isn't used by an app, still the React Native Gradle plugin adds the Sonatype Central to repositories.
In some cases it leads to a considerable amount of failed requests on Gradle downloading dependencies.

858 failed requests out of 858 requests

I'm introducing a change where Sonatype Central repository is included for users of nightly builds only.

Changelog:

[ANDROID] [CHANGED] - Add Sonatype Central repository for users of nightly builds only

Test Plan:

All of the tests in gradle plugin are green

$ ./gradlew test

BUILD SUCCESSFUL in 10s
20 actionable tasks: 20 executed

Summary:
Even though Sonatype Central repository isn't used by an app, still the React Native Gradle plugin adds the Sonatype Central to repositories.
In some cases it leads to a considerable amount of failed requests on Gradle downloading dependencies.
I'm introducing a Gradle property to control if Sonatype Central should be included by default or not.

User can control this behavior by changing their `gradle.properties` file as such:

```
includeSonatypeRepository=false
```

The default value of this property is true

Changelog:
[Android] [Added] - Make the addition of Sonatype Central repository configurable
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 26, 2026
@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 Jan 26, 2026
@cortinico
Copy link
Contributor

That's not the right approach. Instead we should add the snapshot repository only if you're using a nightly version of React Native.

Summary:
Even though Sonatype Central repository isn't used by an app, still the React Native Gradle plugin adds the Sonatype Central to repositories.
In some cases it leads to a considerable amount of failed requests on Gradle downloading dependencies.
I'm introducing a change where Sonatype Central repository is included for users of nightly builds only.

Changelog:
[ANDROID] [CHANGED] - Add Sonatype Central repository for users of nightly builds only
@sergeich sergeich changed the title Make the addition of Sonatype Central repository configurable Add Sonatype Central repository for users of nightly builds only Jan 27, 2026
@sergeich
Copy link
Author

That's not the right approach. Instead we should add the snapshot repository only if you're using a nightly version of React Native.

@cortinico Ah, I see, thank you

I've changed the PR accordingly :)

Comment on lines +281 to +282
private fun String.isNightly(): Boolean =
this.startsWith("0.0.0") || "-nightly-" in this
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you write some unit tests for this function as well?

val hermesGroupString: String = DEFAULT_INTERNAL_HERMES_PUBLISHING_GROUP,
)
) {
val isNightly: Boolean = versionString.isNightly()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
val isNightly: Boolean = versionString.isNightly()
val isNightly: Boolean get() = versionString.isNightly()

@cortinico
Copy link
Contributor

a couple of nits to fix and then we can merge this

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. 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.

3 participants