Skip to content

Commit

Permalink
feat: allow to set annotation version (#787)
Browse files Browse the repository at this point in the history
* feat: allow to set annotation version

* add annotation

* tweak

* override androidx.annotation:annotation

* keep annotation
  • Loading branch information
KazuCocoa authored Jun 9, 2022
1 parent 3481318 commit 60fd588
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ composeVersion | The version for the Jetpack Compose dependencies to use for Esp
sourceCompatibility | The minimum version of JVM the project sources are compatible with. The default value is `VERSION_1_8` | VERSION_12
targetCompatibility | The target version of JVM the project sources are compatible with. The default value is `VERSION_1_8` | VERSION_12
jvmTarget | Target version of the generated JVM bytecode as a string. The default value is `1_8` | `1_10`
annotationVersion | The target version of `androidx.annotation:annotation` pakage. By default the version from the app [build.gradle.kts](https://github.com/appium/appium-espresso-driver/blob/master/espresso-server/app/build.gradle.kts) is used | '1.2.0'

### additionalAppDependencies

Expand Down
14 changes: 12 additions & 2 deletions espresso-server/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ android {

val kotlinVersion = rootProject.extra["appiumKotlin"]
val composeVersion = getStringProperty("appiumComposeVersion", Version.compose)
val annotationVersion = getStringProperty("appiumAnnotationVersion", Version.annotation)

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
Expand All @@ -95,7 +96,7 @@ dependencies {
testImplementation("org.powermock:powermock-classloading-xstream:${Version.mocklib}")
testImplementation("org.powermock:powermock-module-junit4-rule:${Version.mocklib}")
testImplementation("org.powermock:powermock-module-junit4:${Version.mocklib}")
testImplementation("androidx.annotation:annotation:${Version.annotation}")
testImplementation("androidx.annotation:annotation:${annotationVersion}")
testImplementation("androidx.test.espresso:espresso-contrib:${Version.espresso}")
testImplementation("androidx.test.espresso:espresso-core:${Version.espresso}")
testImplementation("androidx.test.espresso:espresso-web:${Version.espresso}")
Expand All @@ -114,7 +115,7 @@ dependencies {
testImplementation("androidx.compose.ui:ui-test:${composeVersion}")
testImplementation("androidx.compose.ui:ui-test-junit4:${composeVersion}")

androidTestImplementation("androidx.annotation:annotation:${Version.annotation}")
androidTestImplementation("androidx.annotation:annotation:${annotationVersion}")
androidTestImplementation("androidx.test.espresso:espresso-contrib:${Version.espresso}") {
// Exclude transitive dependencies to limit conflicts with AndroidX libraries from AUT.
// Link to PR with fix and discussion https://github.com/appium/appium-espresso-driver/pull/596
Expand All @@ -137,6 +138,15 @@ dependencies {
// additionalAndroidTestDependencies placeholder (don't change or delete this line)
}

configurations.all {
resolutionStrategy.eachDependency {
// To avoid "androidx.annotation:annotation" version conflict.
if (requested.group == "androidx.annotation" && !requested.name.contains("annotation")) {
useVersion(annotationVersion)
}
}
}

tasks.withType<Test> {
systemProperty("skipespressoserver", "true")
}
Expand Down
3 changes: 2 additions & 1 deletion lib/server-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const VERSION_KEYS = [
'sourceCompatibility',
'targetCompatibility',
'jvmTarget',
'composeVersion'
'composeVersion',
'annotationVersion'
];

function buildServerSigningConfig (args) {
Expand Down

0 comments on commit 60fd588

Please sign in to comment.