-
Notifications
You must be signed in to change notification settings - Fork 24
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
RSDK-8304 - send version metadata #251
Conversation
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.
Can we have the make buf
command grab the apiTag
from this file?
lib/src/utils.dart
Outdated
String getVersionMetadata() { | ||
const String sdkVersion = 'v0.0.18'; | ||
const String apiTag = 'v0.1.328'; | ||
return format('flutter;{};{}', sdkVersion, apiTag); |
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.
Don't need the format library -- you can use format strings:
return 'flutter;$sdkVersion;$apiTag'
pubspec.yaml
Outdated
@@ -20,6 +20,7 @@ dependencies: | |||
collection: ^1.17.1 | |||
async: ^2.11.0 | |||
bonsoir: ^5.1.8 | |||
format: ^1.5.2 |
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.
Won't be needed
.github/workflows/update_protos.yml
Outdated
- name: Update Proto Tag | ||
run: sed -i -e "s/apiTag = 'v[0-9]*\.[0-9]*\.[0-9]*'/api_tag = '${{ github.event.client_payload.tag }}'" > lib/src/utils.dart | ||
|
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.
Can we update the proto tag earlier, and then update the Makefile so that it reads the lib/src/utils.dart
file and grabs the apiTag
, and then generates that specific api tag?
How it works:
update-protos.yml
updates theapiTag
value in thegetVersionMetadata
functionrelease.yml
updates thesdkVersion
value in thegetVersionMetadata
functionviam_client
equal to the output ofgetVersionMetadata
Note that this is a bit of a bummer because we're storing the SDK version in two places (
pubspec.yml
andutils.dart
). I spent a good amount of time trying to find some alternative whereby we'd get the version info out ofpubspec.yml
instead. The potential solutions and (seemingly intractable) problems I encountered were:pubspec.yml
directly in a synchronous way, which means that readingpubspec.yml
data would require polluting our API with async, which would be a significant breaking change and open tons of new cans of worms.pubspec.yml
and convert it into a map that I can parse). This seemed promising and tests passed, but the problem I found was the absolute path topubspec.yml
can't be reliably assumed, and setting a relative path meant the file couldn't always be found (it was found successfully for a unit test, but not by theflutter-rc-app
running from a sibling directory). So, this approach was too fragile to work.pubspec.yml
as per the first option above. But, the function to do so is deprecated, will be removed soon, and its use is strongly discouraged. So that approach is neither future proof nor idiomatic.Given the above, I opted for the simple and consistent, but sadly duplicative, approach that we wound up with here.