Skip to content

Commit 8d4a1b6

Browse files
Piotr Zawadzkizawadz88
authored andcommitted
Updated Gradle dependencies in general.
Prepared release 2.1.0. Exposed `AndroidJUnitXRunner#getTestDescriptionFromBundle` as `public`.
1 parent 9d97c50 commit 8d4a1b6

File tree

10 files changed

+46
-34
lines changed

10 files changed

+46
-34
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.{kt,kts}]
2+
insert_final_newline=true
3+
disabled_rules=import-ordering

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.1.0]
8+
### Changed
9+
- Updated dependencies to Android Test Runner 1.2.0 & Kotlin 1.3.41. Updated other dependencies as well.
10+
- Exposed `AndroidJUnitXRunner#getTestDescriptionFromBundle` as `public`.
11+
712
## [2.0.0]
813
### Changed
9-
Migrated to AndroidX and Android Test Runner 1.1.0
14+
- Migrated to AndroidX and Android Test Runner 1.1.0
1015

1116
## [1.0.0]
1217
### Added
13-
Initial release of the library.
18+
- Initial release of the library.
1419

20+
[2.1.0]: https://github.com/stepstone-tech/AndroidTestXRunner/compare/2.0.0...2.1.0
1521
[2.0.0]: https://github.com/stepstone-tech/AndroidTestXRunner/compare/1.0.0...2.0.0
1622
[1.0.0]: https://github.com/stepstone-tech/AndroidTestXRunner/tree/1.0.0

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ It heavily depends on [Android Test Orchestrator](https://medium.com/stepstone-t
1515
### 1. Add a Gradle dependency in your `build.gradle`
1616

1717
```groovy
18-
implementation 'com.stepstone.xrunner:xrunner-library:2.0.0'
18+
implementation 'com.stepstone.xrunner:xrunner-library:2.1.0'
1919
```
2020

2121
*NOTE:* not on AndroidX yet? See *Compatibility* section at the bottom.
@@ -46,7 +46,7 @@ android {
4646
}
4747
4848
dependencies {
49-
androidTestUtil 'androidx.test:orchestrator:1.1.0'
49+
androidTestUtil 'androidx.test:orchestrator:1.2.0'
5050
}
5151
```
5252

@@ -85,5 +85,6 @@ Here are some samples:
8585

8686
| XRunner version | Test runner version |
8787
|:------------------------------------------------------------------------:|:---------------------------------------:|
88+
| [2.1.0](https://github.com/stepstone-tech/AndroidTestXRunner/tree/2.1.0) | `androidx.test:runner:1.2.0` |
8889
| [2.0.0](https://github.com/stepstone-tech/AndroidTestXRunner/tree/2.0.0) | `androidx.test:runner:1.1.0` |
8990
| [1.0.0](https://github.com/stepstone-tech/AndroidTestXRunner/tree/1.0.0) | `com.android.support.test:runner:1.0.2` |

build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.KOTLIN_VERSION = '1.2.71'
5-
ext.ANDROID_GRADLE_PLUGIN_VERSION = '3.2.1'
4+
ext.KOTLIN_VERSION = '1.3.41'
5+
ext.ANDROID_GRADLE_PLUGIN_VERSION = '3.5.0'
66
ext.DOKKA_VERSION = '0.9.17'
77
ext.BINTRAY_VERSION = '1.7.3'
88
repositories {
@@ -33,16 +33,16 @@ configure(allprojects) {
3333
ANDROID_TARGET_SDK_VERSION = 28
3434
ANDROID_COMPILE_SDK_VERSION = 28
3535

36-
TEST_RUNNER_VERSION = '1.1.0'
36+
TEST_RUNNER_VERSION = '1.2.0'
3737
SUPER_REFLEKT_VERSION = '1.0.1'
3838

3939
// Sample app only
40-
TEST_RULES_VERSION = '1.1.0'
41-
TEST_EXT_VERSION = '1.0.0'
42-
TEST_ORCHESTRATOR_VERSION = '1.1.0'
43-
ESPRESSO_VERSION = '3.1.0'
44-
APPCOMPAT_VERSION = '1.0.2'
45-
MATERIAL_VERSION = '1.1.0-alpha01'
40+
TEST_RULES_VERSION = '1.2.0'
41+
TEST_EXT_VERSION = '1.1.1'
42+
TEST_ORCHESTRATOR_VERSION = '1.2.0'
43+
ESPRESSO_VERSION = '3.2.0'
44+
APPCOMPAT_VERSION = '1.1.0'
45+
MATERIAL_VERSION = '1.1.0-alpha10'
4646
CONSTRAINT_VERSION = '1.1.3'
4747
}
4848
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

ktlint.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ configurations {
1212
}
1313

1414
dependencies {
15-
ktlint "com.github.shyiko:ktlint:0.24.0"
15+
ktlint "com.pinterest:ktlint:0.34.2"
1616
// additional 3rd party ruleset(s) can be specified here
1717
// just add them to the classpath (e.g. ktlint 'groupId:artifactId:version') and
1818
// ktlint will pick them up
@@ -21,15 +21,15 @@ dependencies {
2121
task ktlint(type: JavaExec, group: "verification") {
2222
description = "Check Kotlin code style."
2323
classpath = configurations.ktlint
24-
main = "com.github.shyiko.ktlint.Main"
25-
args "src/**/*.kt", "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/reports/ktlint.xml"
24+
main = "com.pinterest.ktlint.Main"
25+
args "src/**/*.kt", "--reporter=plain", "--disabled_rules=import-ordering", "--reporter=checkstyle,output=${buildDir}/reports/ktlint.xml"
2626
standardOutput = System.err
2727

2828
}
2929

3030
task ktlintFormat(type: JavaExec, group: "formatting") {
3131
description = "Fix Kotlin code style deviations."
3232
classpath = configurations.ktlint
33-
main = "com.github.shyiko.ktlint.Main"
34-
args "-F", "src/**/*.kt"
33+
main = "com.pinterest.ktlint.Main"
34+
args "-F", "src/**/*.kt", "--disabled_rules=import-ordering"
3535
}

verification.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ echo "Test package run OK!"
3737
verifyJUnitReport 15 3 3
3838
echo "Test package with exclusions run OK!"
3939

40-
./gradlew clean assembleRelease publishToMavenLocal
40+
./gradlew clean assembleRelease
41+
./gradlew publishToMavenLocal

xrunner-library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ ext {
6767
siteUrl = 'https://github.com/stepstone-tech/AndroidTestXRunner'
6868
gitUrl = 'https://github.com/stepstone-tech/AndroidTestXRunner.git'
6969

70-
libraryVersion = '2.0.0'
70+
libraryVersion = '2.1.0'
7171

7272
licenseName = 'The Apache Software License, Version 2.0'
7373
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'

xrunner-library/src/main/java/com/stepstone/xrunner/AndroidJUnitXRunner.kt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ open class AndroidJUnitXRunner : AndroidJUnitRunner() {
7272
super.onStart()
7373
}
7474

75+
fun getTestDescriptionFromBundle(bundle: Bundle): Description {
76+
val runnerArgs = getRunnerArgsWithReflection()
77+
val builder: TestRequestBuilder = SuperReflect.on(this).call(RUNNER_METHOD_CREATE_TEST_REQUEST_BUILDER, this, bundle).get()
78+
builder.addPathsToScan(runnerArgs.classpathToScan)
79+
if (runnerArgs.classpathToScan.isEmpty()) {
80+
builder.addPathToScan(context.packageCodePath)
81+
}
82+
builder.addFromRunnerArgs(runnerArgs)
83+
val request = builder.build()
84+
return request.runner.description
85+
}
86+
87+
@Suppress("DEPRECATION")
7588
private fun isPrimaryInstrumentationProcess(): Boolean = isPrimaryInstrProcess(originalBundle.getString(ARGUMENT_TARGET_PROCESS))
7689

7790
private fun addXRunnerTestsWithOrchestrator(runCount: Int, bundle: Bundle, orchestratorListener: OrchestratedInstrumentationListener) {
@@ -110,18 +123,6 @@ open class AndroidJUnitXRunner : AndroidJUnitRunner() {
110123
SuperReflect.on(this).set(RUNNER_FIELD_ORCHESTRATOR_LISTENER, null)
111124
}
112125

113-
private fun getTestDescriptionFromBundle(bundle: Bundle): Description {
114-
val runnerArgs = getRunnerArgsWithReflection()
115-
val builder: TestRequestBuilder = SuperReflect.on(this).call(RUNNER_METHOD_CREATE_TEST_REQUEST_BUILDER, this, bundle).get()
116-
builder.addPathsToScan(runnerArgs.classpathToScan)
117-
if (runnerArgs.classpathToScan.isEmpty()) {
118-
builder.addPathToScan(context.packageCodePath)
119-
}
120-
builder.addFromRunnerArgs(runnerArgs)
121-
val request = builder.build()
122-
return request.runner.description
123-
}
124-
125126
private fun getRunnerArgsWithReflection() = SuperReflect.on(this).get<RunnerArgs>(RUNNER_FIELD_RUNNER_ARGS)
126127

127128
private fun Bundle.setTestArgumentsForXRunnerTestList() {

xrunner-library/src/main/java/com/stepstone/xrunner/internal/TestArgument.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fun parseTestClass(name: String?): TestArgument? {
3131
if (name.isNullOrEmpty()) {
3232
return null
3333
}
34-
val methodSeparatorIndex = name!!.indexOf(METHOD_SEPARATOR)
34+
val methodSeparatorIndex = name.indexOf(METHOD_SEPARATOR)
3535
return if (methodSeparatorIndex > 0) {
3636
val testMethodName = name.substring(methodSeparatorIndex + 1)
3737
val testClassName = name.substring(0, methodSeparatorIndex)

0 commit comments

Comments
 (0)