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

Convert test code to kotlin #179

Merged
merged 3 commits into from
Feb 10, 2021

Conversation

utzcoz
Copy link
Contributor

@utzcoz utzcoz commented Feb 8, 2021

  1. Use Android Studio tool to convert test code to kotlin.
  2. Fix null checking error, just adding !! and remove some ?.
  3. Fix incompatibility of type between Int and Long in assert.

Test: ./gradlew test

Close #177

@codecov
Copy link

codecov bot commented Feb 8, 2021

Codecov Report

Merging #179 (85fe1c2) into master (9977080) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #179   +/-   ##
=========================================
  Coverage     14.67%   14.67%           
  Complexity      442      442           
=========================================
  Files           125      125           
  Lines          8459     8459           
  Branches       1434     1434           
=========================================
  Hits           1241     1241           
  Misses         7062     7062           
  Partials        156      156           

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 b51557d...2f9a714. Read the comment docs.

@utzcoz
Copy link
Contributor Author

utzcoz commented Feb 8, 2021

@farmerbb could you help to review this PR? Thanks.

@utzcoz
Copy link
Contributor Author

utzcoz commented Feb 8, 2021

The generated kotlin project by Android Studio uses test/java for kotlin test code, so I keep it.

Copy link
Owner

@farmerbb farmerbb left a comment

Choose a reason for hiding this comment

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

Could you please change the variables in each test from private var to private lateinit var? That way we don't have to worry about overriding the null safety with !! when accessing these variables. I personally prefer to avoid using !! wherever possible, only using it as a very last resort.

dependencies.gradle Outdated Show resolved Hide resolved
1. Use Android Studio tool to convert test code to kotlin.
2. Fix null checking error, just adding !! and remove some ?.
3. Fix incompatibility of type between Int and Long in assert.

Test: ./gradlew test

Signed-off-by: utzcoz <utzcoz@outlook.com>
Test: ./gradlew test

Signed-off-by: utzcoz <utzcoz@outlook.com>
It will help to reduce many !!.

Test: ./gradlew test

Signed-off-by: utzcoz <utzcoz@outlook.com>
@utzcoz
Copy link
Contributor Author

utzcoz commented Feb 10, 2021

Could you please change the variables in each test from private var to private lateinit var? That way we don't have to worry about overriding the null safety with !! when accessing these variables. I personally prefer to avoid using !! wherever possible, only using it as a very last resort.

The new commit processes it.

@utzcoz
Copy link
Contributor Author

utzcoz commented Feb 10, 2021

The new commit also rebases on master.

@farmerbb farmerbb merged commit 8b59d83 into farmerbb:master Feb 10, 2021
@farmerbb
Copy link
Owner

Thanks for doing that!

Do you happen to know how we can add Kotlin support to the main codebase while still being able to compile on Android-x86? I think it involves converting our Android.mk file to Android.bp, but I'm not sure how to go about doing that and I'm not setup to compile Android-x86.

@utzcoz utzcoz deleted the convert-test-code-to-kotlin branch February 10, 2021 16:13
@utzcoz
Copy link
Contributor Author

utzcoz commented Feb 10, 2021

Thanks for doing that!

Do you happen to know how we can add Kotlin support to the main codebase while still being able to compile on Android-x86? I think it involves converting our Android.mk file to Android.bp, but I'm not sure how to go about doing that and I'm not setup to compile Android-x86.

Yes, The Android.bp can do it. From AOSP 10, the SystemUI uses kotlin to write some logic, and its Android.bp can be an example. If we start to use Android.bp for kotlin, we will drop the support for Android-x86 pie for its later version. I know jon has worked with you to release Taskbar prebuilt apk for BlissOS, maybe it is the perfect solution for Android-x86's Taskbar release, and we can change all source code to kotlin after that.

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.

Convert test code to kotlin
2 participants