| author | Da Risk <da_risk@geekorum.com> |
| Mon, 23 Feb 2026 17:55:34 -0400 | |
| changeset 1393 | 1ef1b100045d |
| parent 1370 | 13e39ef920a8 |
| permissions | -rw-r--r-- |
|
137
5464f07a306c
Update copyright headers for 2019
Da Risk <da_risk@geekorum.com>
parents:
128
diff
changeset
|
1 |
/* |
| 0 | 2 |
* Geekttrss is a RSS feed reader application on the Android Platform. |
3 |
* |
|
| 1370 | 4 |
* Copyright (C) 2017-2025 by Frederic-Charles Barthelery. |
| 0 | 5 |
* |
6 |
* This file is part of Geekttrss. |
|
7 |
* |
|
8 |
* Geekttrss is free software: you can redistribute it and/or modify |
|
9 |
* it under the terms of the GNU General Public License as published by |
|
10 |
* the Free Software Foundation, either version 3 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* Geekttrss is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with Geekttrss. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
21 |
package com.geekorum.build |
|
22 |
||
|
1393
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
23 |
import com.android.build.api.dsl.ApplicationExtension |
|
1013
18d820f292d6
build: rework buildSrc to use agp-api
Da Risk <da_risk@geekorum.com>
parents:
1010
diff
changeset
|
24 |
import com.android.build.api.dsl.CommonExtension |
|
1393
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
25 |
import com.android.build.api.dsl.LibraryExtension |
| 0 | 26 |
import org.gradle.api.Project |
27 |
import org.gradle.api.artifacts.Dependency |
|
| 357 | 28 |
import org.gradle.api.artifacts.DependencyConstraint |
|
201
f89d3c622b33
tests: Update espresso and truth
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
29 |
import org.gradle.api.artifacts.ExternalModuleDependency |
| 357 | 30 |
import org.gradle.api.artifacts.dsl.DependencyConstraintHandler |
| 0 | 31 |
import org.gradle.api.artifacts.dsl.DependencyHandler |
|
1013
18d820f292d6
build: rework buildSrc to use agp-api
Da Risk <da_risk@geekorum.com>
parents:
1010
diff
changeset
|
32 |
import org.gradle.kotlin.dsl.* |
| 0 | 33 |
|
|
1293
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
34 |
const val espressoVersion = "3.6.1" |
|
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
35 |
const val androidxTestRunnerVersion = "1.6.2" |
|
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
36 |
const val androidxTestCoreVersion = "1.6.1" |
|
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
37 |
const val robolectricVersion = "4.14.1" |
| 0 | 38 |
|
39 |
||
40 |
/* |
|
41 |
* Configuration for espresso and robolectric usage in an Android project |
|
42 |
*/ |
|
43 |
internal fun Project.configureTests() {
|
|
|
1393
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
44 |
extensions.configure<CommonExtension>("android") {
|
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
45 |
if (this is ApplicationExtension) {
|
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
46 |
defaultConfig {
|
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
47 |
testInstrumentationRunner = "com.geekorum.ttrss.HiltRunner" |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
48 |
testInstrumentationRunnerArguments += mapOf( |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
49 |
"clearPackageData" to "true", |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
50 |
"disableAnalytics" to "true" |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
51 |
) |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
52 |
} |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
53 |
} |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
54 |
if (this is LibraryExtension) {
|
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
55 |
defaultConfig {
|
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
56 |
testInstrumentationRunner = "com.geekorum.ttrss.HiltRunner" |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
57 |
testInstrumentationRunnerArguments += mapOf( |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
58 |
"clearPackageData" to "true", |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
59 |
"disableAnalytics" to "true" |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
60 |
) |
|
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
61 |
} |
| 0 | 62 |
} |
63 |
||
|
1393
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
64 |
testOptions.apply {
|
| 0 | 65 |
execution = "ANDROIDX_TEST_ORCHESTRATOR" |
|
128
e48c1ddb578f
Disable animation during instrumentation tests
Da Risk <da_risk@geekorum.com>
parents:
64
diff
changeset
|
66 |
animationsDisabled = true |
| 0 | 67 |
|
| 1010 | 68 |
unitTests {
|
| 0 | 69 |
isIncludeAndroidResources = true |
| 1010 | 70 |
} |
| 0 | 71 |
} |
72 |
} |
|
73 |
||
74 |
dependencies {
|
|
| 397 | 75 |
dualTestImplementation(kotlin("test-junit"))
|
| 0 | 76 |
|
|
1293
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
77 |
androidTestUtil("androidx.test:orchestrator:1.5.1")
|
| 0 | 78 |
androidTestImplementation("androidx.test:runner:$androidxTestRunnerVersion")
|
|
1293
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
79 |
dualTestImplementation("androidx.test.ext:junit-ktx:1.2.1")
|
| 0 | 80 |
|
|
64
0b7cf61c75e5
buildSrc: AndroidTests update dependencies version
Da Risk <da_risk@geekorum.com>
parents:
19
diff
changeset
|
81 |
dualTestImplementation("androidx.test:core-ktx:$androidxTestCoreVersion")
|
|
1293
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
82 |
dualTestImplementation("androidx.test:rules:1.6.1")
|
| 0 | 83 |
|
| 357 | 84 |
// fragment testing is usually declared on debugImplementation configuration and need these dependencies |
85 |
constraints {
|
|
86 |
debugImplementation("androidx.test:core:$androidxTestCoreVersion")
|
|
|
1293
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
87 |
debugImplementation("androidx.test:monitor:1.7.2")
|
| 357 | 88 |
} |
89 |
||
| 0 | 90 |
dualTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion")
|
91 |
dualTestImplementation("androidx.test.espresso:espresso-contrib:$espressoVersion")
|
|
92 |
dualTestImplementation("androidx.test.espresso:espresso-intents:$espressoVersion")
|
|
93 |
||
94 |
// assertions |
|
|
1393
1ef1b100045d
build: start update to agp 9.0.1
Da Risk <da_risk@geekorum.com>
parents:
1370
diff
changeset
|
95 |
dualTestImplementation("com.google.truth:truth:1.4.4")
|
|
1293
2e3867bdab1f
build: update robolectric, espresso and various tests libraries
Da Risk <da_risk@geekorum.com>
parents:
1199
diff
changeset
|
96 |
dualTestImplementation("androidx.test.ext:truth:1.6.0")
|
| 0 | 97 |
|
98 |
// mock |
|
|
1158
20cd659d4fbf
build: update a few test dependencies
Da Risk <da_risk@geekorum.com>
parents:
1138
diff
changeset
|
99 |
testImplementation("io.mockk:mockk:1.13.8")
|
|
20cd659d4fbf
build: update a few test dependencies
Da Risk <da_risk@geekorum.com>
parents:
1138
diff
changeset
|
100 |
androidTestImplementation("io.mockk:mockk-android:1.13.8")
|
| 0 | 101 |
testImplementation("org.robolectric:robolectric:$robolectricVersion")
|
102 |
||
|
635
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
103 |
constraints {
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
104 |
dualTestImplementation(kotlin("reflect")) {
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
105 |
because("Use the kotlin version that we use")
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
106 |
} |
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
107 |
androidTestImplementation("org.objenesis:objenesis") {
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
108 |
because("3.x version use instructions only available with minSdk 26 (Android O)")
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
109 |
version {
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
110 |
strictly("2.6")
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
111 |
} |
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
112 |
} |
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
113 |
} |
| 0 | 114 |
} |
115 |
} |
|
116 |
||
|
19
5dcfa95ec99b
buildscript: expose dualTestImplementation method
Da Risk <da_risk@geekorum.com>
parents:
0
diff
changeset
|
117 |
fun DependencyHandler.dualTestImplementation(dependencyNotation: Any) {
|
| 0 | 118 |
add("androidTestImplementation", dependencyNotation)
|
119 |
add("testImplementation", dependencyNotation)
|
|
120 |
} |
|
121 |
||
|
201
f89d3c622b33
tests: Update espresso and truth
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
122 |
fun DependencyHandler.dualTestImplementation(dependencyNotation: Any, action: ExternalModuleDependency.() -> Unit) {
|
|
f89d3c622b33
tests: Update espresso and truth
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
123 |
val closure = closureOf(action) |
|
f89d3c622b33
tests: Update espresso and truth
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
124 |
add("androidTestImplementation", dependencyNotation, closure)
|
|
f89d3c622b33
tests: Update espresso and truth
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
125 |
add("testImplementation", dependencyNotation, closure)
|
|
f89d3c622b33
tests: Update espresso and truth
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
126 |
} |
|
f89d3c622b33
tests: Update espresso and truth
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
127 |
|
| 357 | 128 |
internal fun DependencyHandler.androidTestImplementation(dependencyNotation: Any): Dependency? = |
| 0 | 129 |
add("androidTestImplementation", dependencyNotation)
|
130 |
||
|
635
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
131 |
internal fun DependencyHandler.androidTestImplementation(dependencyNotation: Any, action: ExternalModuleDependency.() -> Unit) {
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
132 |
val closure = closureOf(action) |
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
133 |
add("androidTestImplementation", dependencyNotation, closure)
|
|
1c1d190b326a
build: update to agp 4.0.0-beta1 and latest play-publisher plugin
Da Risk <da_risk@geekorum.com>
parents:
611
diff
changeset
|
134 |
} |
| 0 | 135 |
|
| 357 | 136 |
internal fun DependencyHandler.androidTestUtil(dependencyNotation: Any): Dependency? = |
| 0 | 137 |
add("androidTestUtil", dependencyNotation)
|
138 |
||
| 357 | 139 |
internal fun DependencyHandler.testImplementation(dependencyNotation: Any): Dependency? = |
| 0 | 140 |
add("testImplementation", dependencyNotation)
|
141 |
||
| 357 | 142 |
|
143 |
internal fun DependencyConstraintHandler.debugImplementation(dependencyConstraintNotation: Any): DependencyConstraint? = |
|
144 |
add("debugImplementation", dependencyConstraintNotation)
|