File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
plugin/main/src/kotlinx/benchmark/gradle Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,24 @@ fun Project.processAndroidCompilation(target: KotlinJvmAndroidCompilation) {
18
18
it.dependsOn(" bundle${target.name.capitalize(Locale .getDefault())} Aar" )
19
19
it.doLast {
20
20
unpackAndProcessAar(target)
21
- generateAndroidExecFile()
21
+ // generateAndroidExecFile()
22
+ detectAndroidDevice()
22
23
}
23
24
}
24
25
}
26
+
27
+ fun Project.detectAndroidDevice () {
28
+ val devices = ProcessBuilder (" adb" , " devices" )
29
+ .start()
30
+ .inputStream
31
+ .bufferedReader()
32
+ .useLines { lines ->
33
+ lines.filter { it.endsWith(" device" ) }
34
+ .map { it.substringBefore(" \t " ) }
35
+ .toList()
36
+ }
37
+ devices.takeIf { it.isNotEmpty() }
38
+ ?.let {
39
+ println (" Connected Android devices/emulators:\n\t ${it.joinToString(" \n\t " )} " )
40
+ } ? : throw RuntimeException (" No Android devices/emulators found, please start an emulator or connect a device." )
41
+ }
You can’t perform that action at this time.
0 commit comments