Skip to content

Commit 9c172fb

Browse files
cortinicofacebook-github-bot
authored andcommitted
Add more logging around computeNightlyTarballURL
Summary: This is a backport of a fix we applied to the 0.81 branch. Changelog: [Internal] [Changed] - bypass-github-export-checks Reviewed By: vzaidman Differential Revision: D78000573 fbshipit-source-id: 64a4e90632158c1f52c45f9fbc3452e848271e94
1 parent 7725a0a commit 9c172fb

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • packages/react-native/scripts/ios-prebuild

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,32 @@ async function computeNightlyTarballURL(
6565
artifactCoordinate /*: string */,
6666
artifactName /*: string */,
6767
) /*: Promise<string> */ {
68+
const urlLog = createLogger('NightlyURL');
6869
const xmlUrl = `https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/${artifactCoordinate}/${version}-SNAPSHOT/maven-metadata.xml`;
6970

71+
urlLog(`Attempting to download maven-metadata.xml from: ${xmlUrl}...`);
7072
const response = await fetch(xmlUrl);
7173
if (!response.ok) {
74+
urlLog(`Downloading maven-metadata.xml failed!`, 'error');
7275
return '';
7376
}
7477
const xmlText = await response.text();
7578

7679
// Extract the <snapshot> block
7780
const snapshotMatch = xmlText.match(/<snapshot>([\s\S]*?)<\/snapshot>/);
7881
if (!snapshotMatch) {
82+
urlLog(`Could not find a <snapshot> tag that matches the regex!`, 'error');
7983
return '';
8084
}
8185
const snapshotContent = snapshotMatch[1];
8286

8387
// Extract <timestamp> from the snapshot block
8488
const timestampMatch = snapshotContent.match(/<timestamp>(.*?)<\/timestamp>/);
8589
if (!timestampMatch) {
90+
urlLog(
91+
`Could not find a <timestamp> tag inside <snapshot> that matches the regex!`,
92+
'error',
93+
);
8694
return '';
8795
}
8896
const timestamp = timestampMatch[1];
@@ -92,12 +100,17 @@ async function computeNightlyTarballURL(
92100
/<buildNumber>(.*?)<\/buildNumber>/,
93101
);
94102
if (!buildNumberMatch) {
103+
urlLog(
104+
`Could not find a <buildNumber> tag that matches the regex!`,
105+
'error',
106+
);
95107
return '';
96108
}
97109
const buildNumber = buildNumberMatch[1];
98110

99111
const fullVersion = `${version}-${timestamp}-${buildNumber}`;
100112
const finalUrl = `https://central.sonatype.com/repository/maven-snapshots/com/facebook/react/${artifactCoordinate}/${version}-SNAPSHOT/${artifactCoordinate}-${fullVersion}-${artifactName}`;
113+
urlLog(`Final artifact URL found: ${finalUrl}`);
101114
return finalUrl;
102115
}
103116

0 commit comments

Comments
 (0)