trevjonez / composer-gradle-plugin

Gradle task type and plugin for interacting with https://github.com/gojuno/composer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support library modules

CristianGM opened this issue · comments

I was adding Composer to one of our libraries and I found that message:
composer plugin only applicable to android application projects, open an issue if you need something else.

Why?
Currently libraries can run UI tests, and with Instant Apps and App Bundle it will happen more frequently.

In this case we where using Spoon and they do support libraries ( hacky code here )
and you need to add something else ( issue to update the readme )

Would be possible to do something similar here?

It shouldn't be too much work to add. i'll see if I can get something up shortly

Any luck?

Been busy with that pesky full time job thing. I should have some time this week to get it brought up to date.

My plan is to break the current application plugin logic into a seperate new plugin (same jar) and then create one for a library and have the existing plugin automatically configure one or the other based on the android plugin on the project. after that it should be fairly straight forward. Only thing I am not sure about is the composer invocation for single apk tests.

if would be helpful if you could post your invocation params in this issue thread to bootstrap the trial and error iterations.

@CristianGM give 0.8.0 a try. DSL might behave a bit different than 0.7.0 but it should be for the better. let me know how it goes.

Thanks!
I'll try it ASAP ( maybe next week because I have lots of meetings ) and let you know the result.

Sorry I didn't even answer you with the invocation params.

Exception in thread "main" java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.collections.ArraysKt___ArraysKt.sortedArray, parameter $receiver
at kotlin.collections.ArraysKt___ArraysKt.sortedArray(_Arrays.kt)
at com.gojuno.commander.android.AdbKt$buildTools$2.invoke(Adb.kt:19)
at com.gojuno.commander.android.AdbKt$buildTools$2.invoke(Adb.kt)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at com.gojuno.commander.android.AdbKt.getBuildTools(Adb.kt)
at com.gojuno.commander.android.AdbKt.access$getBuildTools$p(Adb.kt:1)
at com.gojuno.commander.android.AdbKt$aapt$2.invoke(Adb.kt:23)
at com.gojuno.commander.android.AdbKt$aapt$2.invoke(Adb.kt)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at com.gojuno.commander.android.AdbKt.getAapt(Adb.kt)
at com.gojuno.composer.ApkKt.parseTestPackage(Apk.kt:18)
at com.gojuno.composer.MainKt.main(Main.kt:40)

I have no Composer options set, it's a library module, I have AGP 3.1.4 and Gradle 4.10, and no idea what else you may need to look at the issue.

The stacktrace:

Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:395)
at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:37)
at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:79)
at com.trevjonez.composer.ComposerTask.exec(ComposerTask.kt:99)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
...

The issue was: #25