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

Implement support for Android target #250

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

kx412764776
Copy link

No description provided.

androidTarget {
// Android target does not have any compilations
println("android compilations: ${compilations.size()}")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

JFYI: when implementation project(":kotlinx-benchmark-runtime") is replaced with a dependency on actual artifact (for instance, published to a local maven repo), :compileReleaseKotlinAndroid fails due to unresolved kotlinx.benchnark symbols:

e: file:///Users/filipp.zhinkin/Development/kx-benchmark-android/examples/kotlin-multiplatform/src/androidMain/kotlin/AndroidTestBenchmark.kt:6:7 This class does not have a constructor
e: file:///Users/filipp.zhinkin/Development/kx-benchmark-android/examples/kotlin-multiplatform/src/androidMain/kotlin/AndroidTestBenchmark.kt:6:14 Unresolved reference: Benchmark
e: file:///Users/filipp.zhinkin/Development/kx-benchmark-android/examples/kotlin-multiplatform/src/androidMain/kotlin/AndroidTestBenchmark.kt:7:8 This class does not have a constructor
e: file:///Users/filipp.zhinkin/Development/kx-benchmark-android/examples/kotlin-multiplatform/src/androidMain/kotlin/AndroidTestBenchmark.kt:8:13 This class does not have a constructor

It does not make much sense to redefine a dependency for this sample project, but the same issue is also reproduced on kotlinx-io when I tried to apply kx-benchmark w/ android support.


private fun detectAndroidDevice() {
println("Detect running Android devices...")
val devices = ProcessBuilder("adb", "devices")
Copy link
Contributor

Choose a reason for hiding this comment

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

adb may not be on a PATH.
In that case it makes sense to check sdk.dir property, ANDROID_HOME env variable, or , what seems to be a proper way, ask Android plugin for an ADB path.


android {
namespace = "kotlinx.benchmark.android.microbenchmark"
compileSdk = 34
Copy link
Contributor

Choose a reason for hiding this comment

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

When generating a project, compile SDK and runtime SDK versions as well as other properties, like defaultConfig and compileOptions, should be overridden by values inferred from a project the plugin was applied to.

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

In future, it would be nice to provide a way to supply a user-defined config (it may be required to setup profiling, for example).

@kx412764776 kx412764776 force-pushed the android-support branch 4 times, most recently from 6d1c56e to a681cdc Compare September 13, 2024 11:08
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