Skip to content

Download React Native artifacts from the proxy cache server first#57325

Draft
coado wants to merge 4 commits into
react:mainfrom
coado:@coado/maven-repo-switch
Draft

Download React Native artifacts from the proxy cache server first#57325
coado wants to merge 4 commits into
react:mainfrom
coado:@coado/maven-repo-switch

Conversation

@coado

@coado coado commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary:

This PR adds pull-through cache support for React Native Maven artifacts by trying https://rnmaven.swmtest.xyz/ before Maven Central for release artifacts.

  • Updates the Android Gradle resolution by adding cache repository before mavenCentral() scoped to React Native groups via includeGroupByRegex.
  • Updates iOS CocoaPods prebuilt artifact resolution to try the cache first, then fall back to https://repo1.maven.org/maven2.
  • Updates SwiftPM/iOS prebuild JS tooling with the same cache-first fallback behavior.
  • Preserves ENTERPRISE_REPOSITORY behavior as an explicit single custom repository override.
  • Avoids duplicate artifact existence probes in Ruby and JS by checking candidate URLs directly and caching JS HEAD results within the process.

Changelog:

[GENERAL][CHANGED] - Add React Native Maven pull-through cache fallback for prebuilt artifacts.

Test Plan:

Run:

react-native % RN_DEP_VERSION=0.81.0 \
HERMES_VERSION=250829098.0.13 \
node scripts/ios-prebuild -s -f Debug

The logs confirm that React Native artifacts are cached and pulled from the proxy:

[ReactNativeDependencies] Using download prebuild Debug tarball
[ReactNativeDependencies] Using release tarball from URL: https://rnmaven.swmtest.xyz/com/facebook/react/react-native-artifacts/0.81.0/react-native-artifacts-0.81.0-reactnative-dependencies-debug.tar.gz
[ReactNativeDependencies] Downloading ReactNativeDependencies tarball from https://rnmaven.swmtest.xyz/com/facebook/react/react-native-artifacts/0.81.0/react-native-artifacts-0.81.0-reactnative-dependencies-debug.tar.gz

Added gradle plugin tests which can be run with:

./gradlew :react-native-gradle-plugin:test --tests com.facebook.react.utils.DependencyUtilsTest

@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 Jun 24, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Jun 24, 2026

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

Great stuff 👍 love the direction

"commander": "^12.0.0",
"flow-enums-runtime": "^0.0.6",
"hermes-compiler": "0.0.0",
"hermes-compiler": "250829098.0.14",

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.

Undo this please

repo.content { it.excludeGroup("org.webkit") }
}
}
if (!hasProperty(INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO)) {

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.

I think we probably want to add a kill-switch that disables this entirely, like a react.internal.enableReactNativeRepoMirror=false gradle property (naming up for debate).

We would need the same for iOS


class ReactNativeCoreUtils
MAVEN_CENTRAL_REPOSITORY = "https://repo1.maven.org/maven2"
REACT_NATIVE_MAVEN_CACHE_REPOSITORY = "https://rnmaven.swmtest.xyz"

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.

This returns 404. Can we have a landing page? :)

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.

this is also really nit 💅

}
}
if (!hasProperty(INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO)) {
mavenRepoFromUrl(REACT_NATIVE_MAVEN_CACHE_URL) { repo ->

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.

Let's add a comment mentioning that this is added "first" intentionally

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. p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants