Skip to content

Commit

Permalink
Merge pull request #24 from trevjonez/tjones/overhaul
Browse files Browse the repository at this point in the history
Tjones/overhaul
  • Loading branch information
trevjonez authored Sep 18, 2018
2 parents 25e03f8 + 97aa370 commit f9303a6
Show file tree
Hide file tree
Showing 35 changed files with 1,770 additions and 727 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ build/
*.iml
.idea/
!.idea/codeStyleSettings.xml
!.idea/copyright
!.idea/copyright
local.properties
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelist
Items listed here may not be exhaustive, if you are seeing issues, check the git commits for more specific change information &| open an issue.

## 0.8.0
Large implementation overhaul:
- User facing plugin delegates to AGP specific plugin.
- Support for android library module integration.
- Default output directory has changed to use the `dirName` provided on android variant objects.
- DSL api's have been rewritten. *Should* be source compatible.
- The composer dsl block now has more global options. See readme for details specific behaviors

## 0.7.0
Composer gradle plugin requires gradle 4.10 or newer:
- Use new lazy task registration/configuration API to minimize config time overhead.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.github.trevjonez.composer-gradle-plugin:plugin:0.7.0'
classpath 'com.github.trevjonez.composer-gradle-plugin:plugin:0.8.0'
}
}
```
Expand All @@ -33,23 +33,37 @@ If you want to limit the variants that get tasks or provide custom configuration
```groovy
composer {
variants "redDebug" // optional, variant names to create composer tasks for. If empty all testable variants will receive a task.
instrumentationArgument('key1', 'value1') //optional. args that apply to all created tasks
//These dsl functions are combined with variant specific config additively
instrumentationArgument('key1', 'value1')
instrumentationArgument('key2', 'value2')
instrumentationArgument('keyN', 'valueN')
device 'emulator-5558'
devices(['emulator-5558', 'emulator-5559'])
//These dsl functions are overwritten by variant specific config if any exists
shard false
verboseOutput false
keepOutput true
devicePattern 'somePattern'
apkInstallTimeout 90
configs {
redDebug {
apk "build/outputs/apk/debug/example-debug.apk" //optional override, string paths are evaluated as per {@link org.gradle.api.Project#file(Object)}.
testApk = new File(buildDir, "outputs/apk/androidTest/debug/example-debug-androidTest.apk") //optional override
shard true //optional. default true
outputDirectory 'artifacts/composer-output' //optional override. default 'build/reports/composer/redDebug'
instrumentationArgument('key1', 'value1') //optional
shard true //optional. default true
instrumentationArgument('key1', 'value1') //optional, additive
instrumentationArgument('key2', 'value2')
instrumentationArgument('keyN', 'valueN')
verboseOutput false //optional default false
keepOutput true //optional, default false
device 'emulator-5554' //optional, additive
device 'emulator-5558'
devices('emulator-5554', 'emulator-5558') //optional, additive
devices(['emulator-5554', 'emulator-5558']) //optional, additive
devicePattern 'somePattern' //optional
apkInstallTimeout 90 //optional, timeout in seconds default 120
}
Expand Down Expand Up @@ -136,7 +150,7 @@ version of gradle is 4.0 or whatever minimum is mandated by the android gradle p

Composer plugin version | Gradle version | Android plugin version
----- | ---- | -----
0.7.0 | 4.10 | 3.1.4
0.8.0 | 4.10 | 3.1.4

## License

Expand Down
61 changes: 61 additions & 0 deletions and-app/build-cascade-dsl.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2018 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.
*/

plugins {
id "com.android.application"
id "composer"
}

repositories {
google()
jcenter()
}

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.trevjonez.andapp"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resValue "string", "app_name", "Example"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}

composer {
verboseOutput true
instrumentationArgument('screenshotsDisabled', 'false')
apkInstallTimeout 10
configs {
debug {
instrumentationArgument('screenshotsEngine', 'uiAutomator')
keepOutput true
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Trevor Jones
* Copyright 2018 Trevor Jones
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,32 +14,22 @@
* limitations under the License.
*/

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath files("libs/core.jar")
classpath files("libs/plugin.jar")
}
plugins {
id "com.android.application"
id "composer"
}

repositories {
google()
jcenter()
}

apply plugin: 'com.android.application'
apply plugin: 'composer'

android {
compileSdkVersion 26
compileSdkVersion 28
defaultConfig {
applicationId "com.trevjonez.example"
applicationId "com.trevjonez.andapp"
minSdkVersion 21
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -54,26 +44,13 @@ android {
}

dependencies {
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.0'
androidTestCompile 'com.android.support.test:runner:1.0.0'

composer "com.gojuno.composer:composer:0.3.2"
}

composer {
configs {
debug {
verboseOutput true
device "emulator-5554"
instrumentationArgument('screenshotsDisabled', 'false')
instrumentationArgument('screenshotsEngine', 'uiAutomator')
keepOutput true
}
}
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestCompile 'com.android.support.test:runner:1.0.2'
}

import com.trevjonez.composer.ComposerTask
task customTask(type: ComposerTask, dependsOn: ['assembleDebug', 'assembleDebugAndroidTest']) {
apk "${project.projectDir}/build/outputs/apk/debug/vanilla-debug.apk"
testApk "${project.projectDir}/build/outputs/apk/androidTest/debug/vanilla-debug-androidTest.apk"
apk "${project.projectDir}/build/outputs/apk/debug/customTask-debug.apk"
testApk "${project.projectDir}/build/outputs/apk/androidTest/debug/customTask-debug-androidTest.apk"
verboseOutput true
}
49 changes: 49 additions & 0 deletions and-app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2018 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.
*/

plugins {
id "com.android.application"
id "composer"
}

repositories {
google()
jcenter()
}

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.trevjonez.andapp"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resValue "string", "app_name", "Example"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
1 change: 1 addition & 0 deletions and-app/gradle.properties
29 changes: 9 additions & 20 deletions build.gradle → and-app/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Trevor Jones
* Copyright 2018 Trevor Jones
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,29 +14,18 @@
* limitations under the License.
*/

buildscript {
ext.kotlin_version = '1.2.61'

pluginManagement {
repositories {
jcenter()
google()
}
dependencies {
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: kotlin_version
classpath group: 'com.netflix.nebula', name: 'nebula-kotlin-plugin', version: kotlin_version
}
}

allprojects {
repositories {
mavenLocal()
jcenter()
google()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id.startsWith("com.android"))
useModule("com.android.tools.build:gradle:$AGP_VERSION")
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

group = 'com.github.trevjonez.composer-gradle-plugin'
rootProject.name = "and-app"
21 changes: 21 additions & 0 deletions and-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.trevjonez.andapp">
<application android:label="@string/app_name" />
</manifest>
41 changes: 41 additions & 0 deletions and-lib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2018 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.
*/

plugins {
id "com.android.library"
id "composer"
}

repositories {
google()
jcenter()
}

android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
1 change: 1 addition & 0 deletions and-lib/gradle.properties
Loading

0 comments on commit f9303a6

Please sign in to comment.