Skip to content

Conversation

ankitaj224
Copy link
Contributor

Patched and improved #1346

@vkryachko please merge your PR and I ll update the my branch accordingly.

@ankitaj224 ankitaj224 requested a review from vkryachko March 12, 2020 23:00
@googlebot googlebot added the cla: yes Override cla label Mar 12, 2020
@codecov
Copy link

codecov bot commented Mar 12, 2020

Codecov Report

Merging #1347 into master will increase coverage by 0.89%.
The diff coverage is n/a.

Flag Coverage Δ Complexity Δ
#Encoders_FirebaseEncodersJson 95.93% <ø> (ø) 68 <ø> (ø) ⬇️
#Encoders_FirebaseEncodersProcessor 100% <ø> (ø) 0 <ø> (ø) ⬇️
#Encoders_FirebaseEncodersReflective 73.97% <ø> (ø) 20 <ø> (ø) ⬇️
#FirebaseAbt 80.21% <ø> (ø) 47 <ø> (ø) ⬇️
#FirebaseCommon 50.69% <ø> (ø) 64 <ø> (ø) ⬇️
#FirebaseCommon_DataCollectionTests 100% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseCommon_Ktx 90% <ø> (ø) 1 <ø> (ø) ⬇️
#FirebaseComponents 87.44% <ø> (ø) 145 <ø> (ø) ⬇️
#FirebaseConfig 87.22% <ø> (ø) 307 <ø> (ø) ⬇️
#FirebaseConfig_Ktx 75% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseCrashlytics 2.29% <ø> (ø) 22 <ø> (ø) ⬇️
#FirebaseDatabase 48.39% <ø> (+0.02%) 1808 <ø> (+2) ⬆️
#FirebaseDatabaseCollection 72.62% <ø> (ø) 169 <ø> (ø) ⬇️
#FirebaseDatabase_Ktx 85.71% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseDatatransport 100% <ø> (ø) 3 <ø> (ø) ⬇️
#FirebaseDynamicLinks 77.24% <ø> (ø) 89 <ø> (ø) ⬇️
#FirebaseDynamicLinks_Ktx 75.67% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseFirestore 61.85% <ø> (ø) 2228 <ø> (ø) ⬇️
#FirebaseFirestore_Ktx 41.17% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseFunctions 5.31% <ø> (ø) 2 <ø> (ø) ⬇️
#FirebaseFunctions_Ktx 100% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseInappmessaging 68.56% <ø> (+17.04%) 399 <ø> (-129) ⬇️
#FirebaseInappmessagingDisplay ? ?
#FirebaseInappmessagingDisplay_Ktx 100% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseInappmessaging_Ktx 100% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseInstallations 58.42% <ø> (ø) 110 <ø> (ø) ⬇️
#FirebaseSegmentation 52.63% <ø> (ø) 29 <ø> (ø) ⬇️
#FirebaseStorage 77.06% <ø> (ø) 522 <ø> (ø) ⬇️
#FirebaseStorage_Ktx 100% <ø> (ø) 0 <ø> (ø) ⬇️
#Tools_Errorprone 100% <ø> (ø) 0 <ø> (ø) ⬇️
#Tools_Lint 100% <ø> (ø) 0 <ø> (ø) ⬇️
#Transport_TransportBackendCct 91.38% <ø> (ø) 96 <ø> (ø) ⬇️
#Transport_TransportRuntime 75.53% <ø> (ø) 191 <ø> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af0a38f...19bc81d. Read the comment docs.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 12, 2020

Binary Size Report

Affected SDKs

SDKTypeBase (af0a38f)Head (19bc81d)Diff
firebase-inappmessagingapk (release)?3256454.00? (?)
aar?468226.00? (?)
apk (aggressive)?601532.00? (?)
firebase-common:ktxaar?5965.00? (?)
protolite-well-known-typesapk (release)?561089.00? (?)
aar?1203203.00? (?)
apk (aggressive)?122384.00? (?)
firebase-inappmessaging:ktxaar?5003.00? (?)
firebase-segmentationapk (release)?1667839.00? (?)
aar?35427.00? (?)
apk (aggressive)?1017144.00? (?)
firebase-database:ktxaar?6706.00? (?)
firebase-functions:ktxaar?5844.00? (?)
firebase-storageapk (release)?976604.00? (?)
aar?119257.00? (?)
apk (aggressive)?325635.00? (?)
firebase-commonapk (release)?646638.00? (?)
aar?34517.00? (?)
apk (aggressive)?82939.00? (?)
encoders:firebase-encoders-jsonaar?15334.00? (?)
firebase-firestore:ktxaar?7093.00? (?)
firebase-crashlytics-ndkapk (release)?1930184.00? (?)
aar?598164.00? (?)
apk (aggressive)?1163153.00? (?)
transport:transport-apiaar?6439.00? (?)
transport:transport-backend-cctaar?38343.00? (?)
firebase-inappmessaging-display:ktxaar?21928.00? (?)
firebase-databaseapk (release)?1101570.00? (?)
aar?480458.00? (?)
apk (aggressive)?325592.00? (?)
encoders:firebase-encoders-reflectiveaar?7650.00? (?)
firebase-crashlyticsapk (release)?1347845.00? (?)
aar?376556.00? (?)
apk (aggressive)?580158.00? (?)
transport:transport-runtimeaar?122725.00? (?)
firebase-installationsapk (release)?665330.00? (?)
aar?54392.00? (?)
apk (aggressive)?84614.00? (?)
firebase-config:ktxaar?6162.00? (?)
firebase-dynamic-linksapk (release)?951227.00? (?)
aar?51149.00? (?)
apk (aggressive)?327458.00? (?)
firebase-storage:ktxaar?6143.00? (?)
firebase-installations-interopapk (release)?616109.00? (?)
aar?7509.00? (?)
apk (aggressive)?61720.00? (?)
firebase-componentsapk (release)?25749.00? (?)
aar?34495.00? (?)
apk (aggressive)?10959.00? (?)
firebase-abtapk (release)?746406.00? (?)
aar?35383.00? (?)
apk (aggressive)?85716.00? (?)
firebase-configapk (release)?1143995.00? (?)
aar?214548.00? (?)
apk (aggressive)?395821.00? (?)
firebase-datatransportapk (release)?711399.00? (?)
aar?5041.00? (?)
apk (aggressive)?116347.00? (?)
firebase-dynamic-links:ktxaar?7877.00? (?)
firebase-inappmessaging-displayapk (release)?4776659.00? (?)
aar?165668.00? (?)
apk (aggressive)?1742790.00? (?)
firebase-functionsapk (release)?1178560.00? (?)
aar?25859.00? (?)
apk (aggressive)?393470.00? (?)
firebase-database-collectionapk (release)?912665.00? (?)
aar?34214.00? (?)
apk (aggressive)?313619.00? (?)
firebase-firestoreapk (release)?3140031.00? (?)
aar?1067197.00? (?)
apk (aggressive)?443189.00? (?)
baseapk (release)?8754.00? (?)
apk (aggressive)?10676.00? (?)
Metric Unit: byte

Test Logs

Comment on lines 71 to 73
// firebase-iid v20.1.0 already depended on FirebaseInstallations for identifier creation,
// but had an issue of possible silent failures. Thus, v20.1.1 or later is recommended.
val validIidVersionWithFis = "20.1.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think developers need this kind of context.
Just tell them which version to use.

If this comment is meant for us, then I would recommend to rephrase:
"firebase-iid v20.1.0 is compatible with FirebaseInstallations, but contains a bug that was fixed in v20.1.1"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.


explanation = """
These versions of FirebaseInstanceId and FirebaseInstallations can not be used in parallel.
Please update your Firebase Instance ID to a version 20.1.0 or later.
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to be an inconsistent Inconsistent use of versions!
Sometimes it's 20.1.0, sometimes 20.1.1 (see below).
I assume that you want to prevent usage of <20.1.0 and recommend usage of v20.1.1...

I think, you would make your life easier by just marking everything before v20.1.1 as incompatible and keep it consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Thanks for catching this.

Copy link
Member

Choose a reason for hiding this comment

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

This explanation is not the part that developers are most likely to see, instead this is the error they will see in their build:

/Users/vkryachko/Code/firebase/firebase-android-sdk/firebase-inappmessaging-display: Error: Incompatible IID version found in variant debug: com.google.firebase:firebase-iid:20.0.1@aar [IncompatibleIidVersion] 

With that in mind I think it could be improved in a few ways:

  1. Most likely developers don't have a direct dependency on iid and don't even know what iid is, it might make sense mention that the dependency may be transitive and how it most likely ended up in their build
  2. "@aar" part may confuse developers, consider dropping it
  3. Consider adding a call for action here like how exactly the problem can be solved with a code example to copy paste into their build file.
Comment on lines 80 to 101
private fun compareVersions(versionA: String, versionB: String): Int {
val versionAComponents = versionA.split('.').toTypedArray()
val versionBComponents = versionB.split('.').toTypedArray()
val k = Math.min(versionAComponents.size, versionBComponents.size)
for (i in 0..k - 1) {
if (versionAComponents.get(i) > versionBComponents.get(i)) {
return 1
}
if (versionAComponents.get(i) < versionBComponents.get(i)) {
return -1
}
}

if (versionAComponents.size == versionBComponents.size) {
return 0
}
if (versionAComponents.size < versionBComponents.size) {
return -1
} else {
return 1
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This method seems unnecessarily complicated.
Can't we just check for the version that we are interested in?
kind of like this (pseudo code):

versionComponents = version.split('.')
// check if correct SemVer format
return FALSE if 3 != versionComponents.size
// major version before v20? => incompatible
return FALSE if 20 > versionComponants[0].asInt
// major version after v21? => compatible
return TRUE if 21 <= versionComponants[0].asInt
// major version is v20 and minor version major version after v20.1? => compatible
return (1 <= versionComponants[1].asInt)

@vkryachko
Copy link
Member

@ankitaj224 ptal at #1346

@vkryachko
Copy link
Member

@ankitaj224 a few points:

  • we should try to support as many android gradle plugin versions as possible, right now it's >= 3.4 but we can make it 3.2+ I believe and this change should do it: 0e779e9
  • ask lint folks for feedback on the implementation before/after merging this change
import com.android.tools.lint.detector.api.Location
import com.android.tools.lint.detector.api.Scope
import com.android.tools.lint.detector.api.Severity
import com.android.tools.lint.detector.api.*
Copy link
Contributor

Choose a reason for hiding this comment

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

This is against Java readability rules in Google I think. Not sure how this is handled here?

return true
}
// Incompatible if major version is before v20
if (20 > versionComponents.get(0).toInt()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can #toInt throw an exception?
Do we care?

private fun isIncompatibleVersion(coordinates: MavenCoordinates): Boolean {
// TODO: implement version check
return coordinates.version == "0.0.0"
val versionComponents = coordinates.version.split('.').toTypedArray()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you tell split to split this into maximum 3 components?
If yes, please do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes Override cla size/M

5 participants