DroidsOnRoids/composer-gradle-plugin

Name: composer-gradle-plugin

Owner: Droids On Roids

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

Forked from: trevjonez/composer-gradle-plugin

Created: 2017-11-23 23:24:16.0

Updated: 2017-11-23 23:24:18.0

Pushed: 2017-11-30 19:46:59.0

Homepage:

Size: 142

Language: Kotlin

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

composer-gradle-plugin

Gradle task type and plugin for running gojuno/composer from gradle.

Installation & Usage

In the appropriate build.gradle file add the jitpack repository and classpath dependency.

dscript {
repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    classpath 'com.github.trevjonez.composer-gradle-plugin:plugin:0.5.0'
}

This can be consumed in two ways, via a android variant aware plugin or as a pre-provided task type.

Plugin
y plugin: 'composer'

The above should be all you need to get started and will create a task for each testable variant in the project.

The tasks that are created will be of the form testFlavorTypeComposer

If you want to limit the variants that get tasks or provide custom configuration you can do so via the composer DSL block:

oser {
riants "redDebug" // optional, variant names to create composer tasks for. If empty all testable variants will receive a task.
strumentationArgument('key1', 'value1') //optional. args that apply to all created tasks
strumentationArgument('key2', 'value2')
strumentationArgument('keyN', 'valueN')

nfigs { 
redDebug {
  apk 'app/build/outputs/apk/example-debug.apk' //optional override
  testApk 'build/outputs/apk/example-debug-androidTest.apk' //optional override
  testPackage 'com.example.test' //optional override
  testRunner 'com.example.test.ExampleTestRunner' //optional override
  shard true //optional. default true
  outputDirectory 'artifacts/composer-output' //optional override. default 'build/reports/composer/redDebug'
  instrumentationArgument('key1', 'value1') //optional
  instrumentationArgument('key2', 'value2')
  instrumentationArgument('keyN', 'valueN')
  verboseOutput false //optional default false
  device 'emulator-5554' //optional, additive
  device 'emulator-5558'
  devices('emulator-5554', 'emulator-5558') //optional, additive
  devicePattern 'somePattern' //optional
  apkInstallTimeout 90 //optional, timeout in seconds default 120
}


Core

Manual task creation looks something like this:

 customTaskName(type: ComposerTask) {
k 'app/build/outputs/apk/example-debug.apk' //required
stApk 'build/outputs/apk/example-debug-androidTest.apk' //required
stPackage 'com.example.test' //required
stRunner 'com.example.test.ExampleTestRunner' //required
ard true //optional
tputDirectory 'artifacts/composer-output' //optional
strumentationArgument('key1', 'value1') //optional
strumentationArgument('key2', 'value2')
strumentationArgument('keyN', 'valueN')
rboseOutput false //optional
vice 'emulator-5554' //optional
vice 'emulator-5558'
vices('emulator-5554', 'emulator-5558') //optional
vicePattern 'somePattern' //optional
kInstallTimeout 90 //optional

Dependency Configuration

If you need to use a different version of the composer jar than this plugin uses by default, you can modify the composer configuration with normal gradle strategies. The composer configuration is added to your project once a ComposerTask has been created or the plugin has been applied to the project.

ndencies {
poser "com.gojuno.composer:composer:0.2.8"

Disclaimer

So far this plugin has had light use in the wild and the test cases only verify that composer is ran. Please give any feedback possible if you have issues so I can make things work as expected.

Notes on Compatibility

The plugin is developed against specific version of gradle and the android gradle plugin. In most cases using the latest version of gradle is safe but the minimum supported version of gradle is 4.0 or whatever minimum is mandated by the android gradle plugin.

Composer plugin version | Gradle version | Android plugin version —– | —- | —– 0.5.0 | 4.3.1 | 3.0.0

License
Copyright 2017 Trevor Jones

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.