[build-tools] report app and build version from final archive#3499
[build-tools] report app and build version from final archive#3499kadikraman wants to merge 8 commits intomainfrom
Conversation
|
Subscribed to pull request
Generated by CodeMention |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3499 +/- ##
==========================================
+ Coverage 53.56% 53.60% +0.04%
==========================================
Files 815 816 +1
Lines 34566 34670 +104
Branches 7175 7198 +23
==========================================
+ Hits 18513 18580 +67
- Misses 15971 16009 +38
+ Partials 82 81 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sjchmiela
left a comment
There was a problem hiding this comment.
Also: you're rightly adding this to eas/build. This is not the only place that the build process is defined. There's also
eas-cli/packages/build-tools/src/builders/ios.ts
Lines 178 to 184 in 789cf62
eas-cli/packages/build-tools/src/builders/android.ts
Lines 161 to 167 in 789cf62
| const artifactPattern = iosJob.applicationArchivePath ?? 'ios/build/*.ipa'; | ||
| const artifacts = await findArtifacts({ | ||
| rootDir: workingDirectory, | ||
| patternOrPath: artifactPattern, | ||
| logger, | ||
| }); |
There was a problem hiding this comment.
Instead of looking for artifacts again, could we use value from the previous step?
Right above these functions we usually do createFindAndUploadBuildArtifactsBuildFunction. We could add output to it that would point to the first (?) uploaded application archive. Then you would use that output as an input to this, sort of like we do in
eas-cli/packages/build-tools/src/steps/functionGroups/build.ts
Lines 207 to 210 in 789cf62
|
❌ It looks like a changelog entry is missing for this PR. Add it manually to CHANGELOG.md. |
sjchmiela
left a comment
There was a problem hiding this comment.
nit: not sure if "report" is the right verb here? like… you usually report bugs… maybe "update" is better?
| logger, | ||
| }); | ||
|
|
||
| return applicationArchives[0]; |
There was a problem hiding this comment.
nit: let's return all archives and pick only the first one in the consumer?
| appVersion: appVersion ?? null, | ||
| appBuildVersion: appBuildVersion ?? null, |
There was a problem hiding this comment.
honest question — if appVersion is missing here, but it is present in a metadata, is this going to clear the appVersion or leave it as it is?
| appVersion?: string; | ||
| appBuildVersion?: string; |
There was a problem hiding this comment.
| appVersion?: string; | |
| appBuildVersion?: string; | |
| appVersion: string | undefined; | |
| appBuildVersion: string | undefined; |
Less easy to forget
| }); | ||
| }); | ||
|
|
||
| if (archivePath) { |
There was a problem hiding this comment.
We need it to be inside a build phase, otherwise if the users are oging to see "Unnamed build phase" logs which I've seen people complain about before. Maybe we can move it inside upload application archive?
| }); | ||
| }); | ||
|
|
||
| if (archivePath) { |
Why
For projects that don't use CNG, the app version and build number can be evaluated dynamically in the native code. However we detect and save the value when the build is first created (so the actual resolved value is never shown).
See https://exponent-internal.slack.com/archives/C02123T524U/p1772205677890089
How
After the build is finished, read the actual versions for app and build from the archive and updater the eas metadata.
Test Plan
Unit and integration tests.
Also tested locally when possible:
aapt2 dump badging ~/Downloads/application-ba69caff-3ddd-45b3-b766-c74eed33aea3.apk(& parse versionName / versionCode from output)bundletool dump manifest --bundle ~/Downloads/application-083f9788-b177-4094-8f06-7b52eb2ef709.aab(& parse versionName / versionCode from output)readIpaInfoAsync(NOT tested locally)plutil -convert xml1 -o - <path-to>.app/Info.plist | grep -A1 'CFBundleShortVersionString\|CFBundleVersion'