Skip to content

Commit 23f3bf9

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Add the ENTERPRISE_REPOSITORY env var to let user consume artifacts from their personal maven mirror (#52514)
Summary: Pull Request resolved: #52514 As per title, this change add the `ENTERPRISE_REPOSITORY` env variable so that users can use their owm maven mirror to consume artifacts rather than the official url. This is helpful as: - we can reduce the traffic toward maven central - companies can speed up their builds by relying on local/closer replicas ## Changelog: [iOS][Added] - Add the `ENTERPRISE_REPOSITORY` env variable to cocopaods infra Reviewed By: cortinico Differential Revision: D78011424 fbshipit-source-id: 24b83b4866095d7fe3318362afc5075b99b146e7
1 parent dfce5c7 commit 23f3bf9

5 files changed

Lines changed: 26 additions & 5 deletions

File tree

packages/react-native/scripts/cocoapods/rncore.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ def self.podspec_source_download_prebuild_stable_tarball()
119119
end
120120

121121
def self.stable_tarball_url(version, build_type)
122-
maven_repo_url = "https://repo1.maven.org/maven2"
122+
## You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
123+
## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
124+
maven_repo_url =
125+
ENV[ENTERPRISE_REPOSITORY] != nil && ENV[ENTERPRISE_REPOSITORY] != "" ?
126+
ENV[ENTERPRISE_REPOSITORY] :
127+
"https://repo1.maven.org/maven2"
123128
group = "com/facebook/react"
124129
# Sample url from Maven:
125130
# 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

packages/react-native/scripts/cocoapods/rndependencies.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ def self.podspec_source_download_prebuild_release_tarball()
166166
end
167167

168168
def self.release_tarball_url(version, build_type)
169-
maven_repo_url = "https://repo1.maven.org/maven2"
169+
## You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
170+
## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
171+
maven_repo_url =
172+
ENV[ENTERPRISE_REPOSITORY] != nil && ENV[ENTERPRISE_REPOSITORY] != "" ?
173+
ENV[ENTERPRISE_REPOSITORY] :
174+
"https://repo1.maven.org/maven2"
170175
group = "com/facebook/react"
171176
# Sample url from Maven:
172177
# https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.79.0-rc.0/react-native-artifacts-0.79.0-rc.0-reactnative-dependencies-debug.tar.gz

packages/react-native/scripts/ios-prebuild/hermes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ function getTarballUrl(
183183
version /*: string */,
184184
buildType /*: BuildFlavor */,
185185
) /*: string */ {
186-
const mavenRepoUrl = 'https://repo1.maven.org/maven2';
186+
// You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
187+
// The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
188+
const mavenRepoUrl =
189+
process.env.ENTERPRISE_REPOSITORY ?? 'https://repo1.maven.org/maven2';
187190
const namespace = 'com/facebook/react';
188191
return `${mavenRepoUrl}/${namespace}/react-native-artifacts/${version}/react-native-artifacts-${version}-hermes-ios-${buildType.toLowerCase()}.tar.gz`;
189192
}

packages/react-native/scripts/ios-prebuild/reactNativeDependencies.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ function getTarballUrl(
179179
version /*: string */,
180180
buildType /*: BuildFlavor */,
181181
) /*: string */ {
182-
const mavenRepoUrl = 'https://repo1.maven.org/maven2';
182+
// You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
183+
// The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
184+
const mavenRepoUrl =
185+
process.env.ENTERPRISE_REPOSITORY ?? 'https://repo1.maven.org/maven2';
183186
const namespace = 'com/facebook/react';
184187
return `${mavenRepoUrl}/${namespace}/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-${buildType.toLowerCase()}.tar.gz`;
185188
}

packages/react-native/sdks/hermes-engine/hermes-utils.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,12 @@ def hermestag_file(react_native_path)
204204
end
205205

206206
def release_tarball_url(version, build_type)
207-
maven_repo_url = "https://repo1.maven.org/maven2"
207+
## You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
208+
## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
209+
maven_repo_url =
210+
ENV[ENTERPRISE_REPOSITORY] != nil && ENV[ENTERPRISE_REPOSITORY] != "" ?
211+
ENV[ENTERPRISE_REPOSITORY] :
212+
"https://repo1.maven.org/maven2"
208213
namespace = "com/facebook/react"
209214
# Sample url from Maven:
210215
# https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz

0 commit comments

Comments
 (0)