Skip to content
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

Bump Android compile version to 33 #189

Merged
merged 3 commits into from
Oct 4, 2022
Merged

Bump Android compile version to 33 #189

merged 3 commits into from
Oct 4, 2022

Conversation

twyatt
Copy link
Member

@twyatt twyatt commented Oct 1, 2022

No description provided.

@twyatt twyatt requested review from a team and cedrickcooke as code owners October 1, 2022 16:56
@twyatt twyatt requested a review from QuantumRand October 1, 2022 16:56
@twyatt twyatt added the maintenance General maintenance that doesn't effect the public API. label Oct 1, 2022
@twyatt
Copy link
Member Author

twyatt commented Oct 1, 2022

It looks like Android 33 introduced an additional lint that is failing:

> Task :kanvas:lintDebug FAILED
/Users/runner/work/krayon/krayon/kanvas/src/androidMain/kotlin/AndroidPaint.kt:124: Error: Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)). [DiscouragedApi]
                        context.resources.getIdentifier(name, "font", context.packageName)
                                          ~~~~~~~~~~~~~

   Explanation for issues of type "DiscouragedApi":
   Discouraged APIs are allowed and are not deprecated, but they may be unfit

@cedrickcooke which action should we take?

  1. Change the API we're using (if there is an alternative)
  2. Figure out @Supress annotation to use
  3. Setup baseline lint rules (in order to ignore this one)

@cedrickcooke
Copy link
Contributor

cedrickcooke commented Oct 1, 2022

2 is my preferred option, I believe it's @SuppressLint("DiscouragedApi"). Per the docs:

use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.

Here we're using it only as fallback behavior if we find a font-name that has not been manually associated with a resource, and once we make this fallback decision we cache the result to avoid calling it again. I feel like Krayon is doing it's part to avoid it, but I also feel like it's valuable when it comes up.

@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Test Results

14 files  14 suites   21s ⏱️
45 tests 45 ✔️ 0 💤 0
90 runs  90 ✔️ 0 💤 0

Results for commit 389d3e4.

@codecov
Copy link

codecov bot commented Oct 1, 2022

Codecov Report

Merging #189 (389d3e4) into main (8c86321) will increase coverage by 9.44%.
The diff coverage is 72.44%.

@@             Coverage Diff              @@
##               main     #189      +/-   ##
============================================
+ Coverage     70.47%   79.91%   +9.44%     
- Complexity       67       90      +23     
============================================
  Files            31       25       -6     
  Lines           918     1240     +322     
  Branches         83      124      +41     
============================================
+ Hits            647      991     +344     
+ Misses          236      190      -46     
- Partials         35       59      +24     
Impacted Files Coverage Δ
color/src/commonMain/kotlin/NextColor.kt 75.00% <ø> (ø)
kanvas/src/commonMain/kotlin/svg/PathString.kt 0.00% <0.00%> (-43.59%) ⬇️
shape/src/commonMain/kotlin/curve/Linear.kt 0.00% <0.00%> (ø)
kanvas/src/commonMain/kotlin/Ellipse.kt 81.25% <25.00%> (-4.47%) ⬇️
kanvas/src/commonMain/kotlin/Clip.kt 66.66% <40.00%> (+6.66%) ⬆️
...vas/src/commonMain/kotlin/svg/PathStringBuilder.kt 56.00% <56.00%> (ø)
kanvas/src/commonMain/kotlin/SegmentedPath.kt 58.76% <58.76%> (ø)
color/src/commonMain/kotlin/Color.kt 89.47% <83.33%> (+1.23%) ⬆️
kanvas/src/commonMain/kotlin/svg/StringToPath.kt 83.53% <83.53%> (ø)
kanvas/src/commonMain/kotlin/svg/SvgKanvas.kt 60.13% <85.71%> (+9.19%) ⬆️
... and 20 more

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

Copy link
Contributor

@QuantumRand QuantumRand left a comment

Choose a reason for hiding this comment

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

I'm honestly surprised only one thing broke.

@twyatt twyatt merged commit ce3d8d9 into main Oct 4, 2022
@twyatt twyatt deleted the twyatt/android-33 branch October 4, 2022 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance General maintenance that doesn't effect the public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants