Skip to content

Add runtime kotlin version detection for platform info purposes. #693

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
merged 3 commits into from
Aug 8, 2019

Conversation

vkryachko
Copy link
Member

No description provided.

@googlebot googlebot added the cla: yes Override cla label Aug 7, 2019
try {
return kotlin.KotlinVersion.CURRENT.toString();
} catch (NoClassDefFoundError ex) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write this as "no_kotlin_version" or "-1". Could give us a sense of what portion of clients do not have kotlin. I realise this can be derived already. But, seems more convenient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I erred on the side of not populating what's not present, e.g. it's consistent with what is done for unity, flutter, cpp, etc. So I think I prefer to do it this way, but @davidair could correct me if that's not the case and/or your suggestion adds convenience.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We normally only put things into the platform info that "are there" - and they vary between platform. It doesn't make sense to put the Xcode version into the Android string, so I would recommend omitting Kotlin if not present.

This is done to minimize the scope of `-dontwarn` in the consumer proguard spec
which is required for proguard to succeed in developers' apps.

Note: the `-dontwarn` does not seem to be required when building the app
with R8 instead of proguard.
@vkryachko vkryachko requested a review from ashwinraghav August 8, 2019 14:28
@@ -42,7 +42,7 @@ class VersionTests {
fun libraryVersions_shouldBeRegisteredWithRuntime() {
withApp("ktxTestApp") {
val uaPublisher = get(UserAgentPublisher::class.java)
assertThat(uaPublisher.userAgent).contains("kotlin")
assertThat(uaPublisher.userAgent).contains("fire-kotlin")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep as "kotlin" since it's not a Firebase product

@vkryachko vkryachko merged commit e58f07c into master Aug 8, 2019
@vkryachko vkryachko deleted the vk.kotlin_pinfo branch August 21, 2019 21:37
@firebase firebase locked and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants