trevjonez / composer-gradle-plugin

Gradle task type and plugin for interacting with https://github.com/gojuno/composer
Apache License 2.0
54 stars 18 forks source link

`verboseOutput` `keepOutput` args are not passed to commander #59

Closed plastiv closed 4 years ago

plastiv commented 4 years ago

It looks like verbose and output flags are not passed to the commander process.

1) Process logs are guarded:

https://github.com/trevjonez/composer-gradle-plugin/blob/271a5a5ebceb1ea779c800cbcdd1e1a82648f337/commander/os/src/main/kotlin/com/gojuno/commander/os/Processes.kt#L105-L107

2) Logs are turned off by default:

https://github.com/trevjonez/composer-gradle-plugin/blob/271a5a5ebceb1ea779c800cbcdd1e1a82648f337/commander/os/src/main/kotlin/com/gojuno/commander/os/Processes.kt#L29-L32

3) process is unconditionally being called AFAIS:

https://github.com/trevjonez/composer-gradle-plugin/blob/271a5a5ebceb1ea779c800cbcdd1e1a82648f337/commander/android/src/main/kotlin/com/gojuno/commander/android/Adb.kt#L94-L98

My use case.

I am running composer. APK install is failing on the CI and I don't see adb message to get a sense why is it failing. Turning verboseOutput=true keepOutput=true flags in plugin doesn't help, since apparently flags are not being passed down. So at the end all I see is next:

> Task :storage:testDebugComposer
[Tue Feb 25 19:35:37 CET 2020]: Args(appApkPath=/Users/user/Projects/project/storage/build/outputs/apk/androidTest/debug/storage-debug-androidTest.apk, testApkPath=/Users/user/Projects/project/storage/build/outputs/apk/androidTest/debug/storage-debug-androidTest.apk, testRunner=, shard=true, outputDirectory=/Users/user/Projects/project/storage/build/reports/composer/debug, instrumentationArguments=[disableAnalytics, true], verboseOutput=true, keepOutputOnExit=true, devices=[], devicePattern=, installTimeoutSeconds=120, failIfNoTests=true, runWithOrchestrator=false, extraApks=[])
[Tue Feb 25 19:35:37 CET 2020]: 1 connected adb device(s): [AdbDevice(id=emulator-5554, model=Android SDK built for x86_64, online=true)]
[Tue Feb 25 19:35:37 CET 2020]: [emulator-5554] 1 APK to install
[Tue Feb 25 19:35:37 CET 2020]: [emulator-5554] Acquiring lock
[Tue Feb 25 19:35:37 CET 2020]: [emulator-5554] Lock acquired
[Tue Feb 25 19:35:37 CET 2020]: [emulator-5554] Installing apk... pathToApk = /Users/user/Projects/project/storage/build/outputs/apk/androidTest/debug/storage-debug-androidTest.apk
[Tue Feb 25 19:35:47 CET 2020]: [emulator-5554] Failed to install apk /Users/user/Projects/project/storage/build/outputs/apk/androidTest/debug/storage-debug-androidTest.apk
Task :storage:testDebugComposer in storage Finished

> Task :storage:testDebugComposer FAILED
:storage:testDebugComposer (Thread[Execution worker for ':' Thread 5,5,main]) completed. Took 10.469 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':storage:testDebugComposer'.
> Process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

Which isn't very helpful since it doesn't contain any error message.

trevjonez commented 4 years ago

should™ be a pretty straight forward fix. Feel free to open a PR, ideally with a test case to cover it. But i'll still see how quickly I can get to this.

trevjonez commented 4 years ago

just published 1.0.0-rc06 with your fix for this issue, sorry for the delay in publishing and thank you for your patience.