-
-
Notifications
You must be signed in to change notification settings - Fork 361
fix(e2e): Remove dead OSSRH snapshots repo from RN 0.71 Gradle plugin #6387
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
Merged
+66
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
dev-packages/e2e-tests/patch-scripts/rn.patch.gradle.plugin.repo.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| const { argv } = require('process'); | ||
|
|
||
| const parseArgs = require('minimist'); | ||
| const { debug } = require('@sentry/core'); | ||
| debug.enable(); | ||
|
|
||
| const args = parseArgs(argv.slice(2)); | ||
| if (!args['app-dir']) { | ||
| throw new Error('Missing --app-dir'); | ||
| } | ||
|
|
||
| // Sonatype's legacy OSSRH host (oss.sonatype.org) reached end-of-life on | ||
| // 2025-06-30 and is now unreliable — it intermittently answers with a | ||
| // `504 Gateway Time-out` instead of a clean `404`. The React Native Gradle | ||
| // plugin bundled with older RN versions (e.g. 0.71) hardcodes this host as a | ||
| // snapshots repository and injects it into every project's repository list. | ||
| // Gradle treats a 5xx from any declared repo as fatal (unlike a 404, which it | ||
| // skips), so a single 504 breaks resolution of ANY dependency (react-android, | ||
| // AGP lint, ...) even though those artifacts live on Maven Central / google(). | ||
| // | ||
| // We pin a stable RN release, so the snapshots repo is only ever used for | ||
| // nightly (0.0.0-*) builds and serves no purpose here — remove it entirely so | ||
| // nothing in the resolution path depends on a Sonatype snapshots host. | ||
| const SNAPSHOT_REPO_LINE = /^[^\n]*mavenRepoFromUrl\("https:\/\/oss\.sonatype\.org\/content\/repositories\/snapshots\/"\)[^\n]*\n/m; | ||
|
|
||
| const dependencyUtilsPath = path.join( | ||
| args['app-dir'], | ||
| 'node_modules', | ||
| 'react-native-gradle-plugin', | ||
| 'src', | ||
| 'main', | ||
| 'kotlin', | ||
| 'com', | ||
| 'facebook', | ||
| 'react', | ||
| 'utils', | ||
| 'DependencyUtils.kt' | ||
| ); | ||
|
|
||
| debug.log('Removing dead OSSRH snapshots repo from React Native Gradle plugin', dependencyUtilsPath); | ||
|
|
||
| if (!fs.existsSync(dependencyUtilsPath)) { | ||
| debug.log('DependencyUtils.kt not found, skipping patch (plugin likely already uses a live repo)'); | ||
| } else { | ||
| const source = fs.readFileSync(dependencyUtilsPath, 'utf8'); | ||
|
|
||
| if (!SNAPSHOT_REPO_LINE.test(source)) { | ||
| debug.log('DependencyUtils.kt does not reference the dead OSSRH host, nothing to patch'); | ||
| } else { | ||
| const patched = source.replace(SNAPSHOT_REPO_LINE, ''); | ||
| fs.writeFileSync(dependencyUtilsPath, patched); | ||
| debug.log('Removed dead OSSRH snapshots repo successfully!'); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.