Skip to content

Remove Desugaring Requirement By Removing Instant.now() #154

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 6 commits into from
Apr 20, 2023

Conversation

didiergarcia
Copy link
Contributor

No description provided.

@didiergarcia didiergarcia requested a review from wenxi-zeng April 19, 2023 03:58
@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2023

Codecov Report

Patch coverage: 71.42% and project coverage change: -0.05 ⚠️

Comparison is base (be3d5b6) 79.31% compared to head (1d54abd) 79.26%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #154      +/-   ##
============================================
- Coverage     79.31%   79.26%   -0.05%     
+ Complexity      479      474       -5     
============================================
  Files            74       74              
  Lines          5979     5965      -14     
  Branches        719      719              
============================================
- Hits           4742     4728      -14     
  Misses          670      670              
  Partials        567      567              
Impacted Files Coverage Δ
...t/analytics/kotlin/core/utilities/DateTimeUtils.kt 0.00% <0.00%> (ø)
...egment/analytics/kotlin/android/EventsFileTests.kt 100.00% <100.00%> (ø)
...n/java/com/segment/analytics/kotlin/core/Events.kt 46.03% <100.00%> (-1.40%) ⬇️
...alytics/kotlin/core/utilities/EventsFileManager.kt 93.24% <100.00%> (ø)
...om/segment/analytics/kotlin/core/AnalyticsTests.kt 72.17% <100.00%> (+0.16%) ⬆️
.../analytics/kotlin/core/compat/JavaAnalyticsTest.kt 67.01% <100.00%> (+0.23%) ⬆️
...ics/kotlin/core/utilities/EventsFileManagerTest.kt 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@wenxi-zeng wenxi-zeng left a comment

Choose a reason for hiding this comment

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

LGTM. let's remove all the desugaring setup and dependencies before merge in

@@ -89,6 +89,7 @@ open class Analytics protected constructor(
Analytics.segmentLog(
"Caught Exception in Analytics Scope: ${t}"
)
t.printStackTrace()
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm....No. I will add that and probably more like it in a follow up PR. It's a nice to have.

@@ -32,6 +33,8 @@ class EventsFileTests {

init {
mockkStatic(Instant::class)
mockkStatic(::dateTimeNowString)
every { dateTimeNowString() } returns Date(0).toInstant().toString()
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to replace toInstant too? looks like it's returning an Instant value. would that require desugaring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in our tests. I let all of those keep the use of the Instant classes. Instant was only removed from code that runs on the device.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm. I wonder if it's still available after we removed all the desugaring setup and the dependency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It is still available because the test run locally using java 11. I have updated the code to remove desugaring from the android build.gradle and re-run the test and they still all pass.

@didiergarcia didiergarcia merged commit 4f1fc73 into main Apr 20, 2023
@didiergarcia didiergarcia deleted the desugar-android branch April 20, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants