-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Download React Native artifacts from the proxy cache server first #57325
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ import org.gradle.api.Project | |
| import org.gradle.api.artifacts.repositories.MavenArtifactRepository | ||
|
|
||
| internal object DependencyUtils { | ||
| private const val REACT_NATIVE_MAVEN_CACHE_URL = "https://rnmaven.swmtest.xyz/" | ||
|
|
||
| internal data class Coordinates( | ||
| val versionString: String, | ||
|
|
@@ -75,6 +76,14 @@ internal object DependencyUtils { | |
| repo.content { it.excludeGroup("org.webkit") } | ||
| } | ||
| } | ||
| if (!hasProperty(INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO)) { | ||
| mavenRepoFromUrl(REACT_NATIVE_MAVEN_CACHE_URL) { repo -> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a comment mentioning that this is added "first" intentionally |
||
| repo.content { | ||
| it.includeGroupByRegex("com\\.facebook\\.react.*") | ||
| it.includeGroupByRegex("com\\.facebook\\.hermes.*") | ||
| } | ||
| } | ||
| } | ||
| repositories.mavenCentral { repo -> | ||
| // We don't want to fetch JSC from Maven Central as there are older versions there. | ||
| repo.content { it.excludeGroup("org.webkit") } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,7 +167,7 @@ | |
| "base64-js": "^1.5.1", | ||
| "commander": "^12.0.0", | ||
| "flow-enums-runtime": "^0.0.6", | ||
| "hermes-compiler": "0.0.0", | ||
| "hermes-compiler": "250829098.0.14", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Undo this please |
||
| "invariant": "^2.2.4", | ||
| "memoize-one": "^5.0.0", | ||
| "metro-runtime": "^0.84.3", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,9 @@ def add_rncore_dependency(s) | |
| ## - RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS: If set to 1, it will download the dSYMs for the prebuilt RNCore frameworks and install these in the framework folders | ||
|
|
||
| class ReactNativeCoreUtils | ||
| MAVEN_CENTRAL_REPOSITORY = "https://repo1.maven.org/maven2" | ||
| REACT_NATIVE_MAVEN_CACHE_REPOSITORY = "https://rnmaven.swmtest.xyz" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This returns 404. Can we have a landing page? :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is also really nit 💅 |
||
|
|
||
| @@build_from_source = true | ||
| @@react_native_path = "" | ||
| @@react_native_version = "" | ||
|
|
@@ -364,16 +367,27 @@ def self.generate_plist_content(mappings) | |
| end | ||
|
|
||
| def self.stable_tarball_url(version, build_type, dsyms = false) | ||
| ## You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded. | ||
| ## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central. | ||
| maven_repo_url = | ||
| ENV['ENTERPRISE_REPOSITORY'] != nil && ENV['ENTERPRISE_REPOSITORY'] != "" ? | ||
| ENV['ENTERPRISE_REPOSITORY'] : | ||
| "https://repo1.maven.org/maven2" | ||
| candidates = stable_tarball_urls(version, build_type, dsyms) | ||
| return candidates.find { |url| artifact_exists(url) } || candidates.first | ||
| end | ||
|
|
||
| def self.stable_tarball_urls(version, build_type, dsyms = false) | ||
| group = "com/facebook/react" | ||
| # Sample url from Maven: | ||
| # https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.0/react-native-artifacts-0.81.0-reactnative-core-debug.tar.gz | ||
| return "#{maven_repo_url}/#{group}/react-native-artifacts/#{version}/react-native-artifacts-#{version}-reactnative-core-#{dsyms ? "dSYM-" : ""}#{build_type.to_s}.tar.gz" | ||
| return maven_repository_urls().map { |maven_repo_url| | ||
| # Sample url from Maven: | ||
| # https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.0/react-native-artifacts-0.81.0-reactnative-core-debug.tar.gz | ||
| "#{maven_repo_url}/#{group}/react-native-artifacts/#{version}/react-native-artifacts-#{version}-reactnative-core-#{dsyms ? "dSYM-" : ""}#{build_type.to_s}.tar.gz" | ||
| } | ||
| end | ||
|
|
||
| def self.maven_repository_urls() | ||
| ## You can use the `ENTERPRISE_REPOSITORY` variable to customise the base url from which artifacts will be downloaded. | ||
| ## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central. | ||
| if ENV['ENTERPRISE_REPOSITORY'] != nil && ENV['ENTERPRISE_REPOSITORY'] != "" | ||
| return [ENV['ENTERPRISE_REPOSITORY'].delete_suffix("/")] | ||
| end | ||
|
|
||
| return [REACT_NATIVE_MAVEN_CACHE_REPOSITORY, MAVEN_CENTRAL_REPOSITORY] | ||
| end | ||
|
|
||
| def self.nightly_tarball_url(version, configuration, dsyms = false) | ||
|
|
@@ -475,7 +489,7 @@ def self.download_rncore_tarball(react_native_path, tarball_url, version, config | |
| end | ||
|
|
||
| def self.release_artifact_exists(version) | ||
| return artifact_exists(stable_tarball_url(version, :debug)) | ||
| return stable_tarball_urls(version, :debug).any? { |url| artifact_exists(url) } | ||
| end | ||
|
|
||
| def self.nightly_artifact_exists(version) | ||
|
|
||
There was a problem hiding this comment.
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=falsegradle property (naming up for debate).We would need the same for iOS