forked from duckduckgo/Android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
123 lines (112 loc) · 4.52 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = '1.7.10'
spotless = "6.1.2"
anvil_version = "2.4.1"
gradle_plugin = "7.2.2" // When updating, also update lint_version
lint_version = "30.2.2" // This value must always be gradle_plugin + 23
min_sdk = 23
target_sdk = 30
compile_sdk = 33
fladle_version = "0.17.4"
}
repositories {
google()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "com.android.tools.build:gradle:$gradle_plugin"
classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless"
classpath "com.squareup.anvil:gradle-plugin:$anvil_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'com.osacky.fulladle' version "$fladle_version"
}
allprojects {
repositories {
google()
mavenCentral()
}
configurations.all {
resolutionStrategy.force 'org.objenesis:objenesis:2.6'
}
}
subprojects {
// Break build when using deprecated plugins
String[] allowDeprecatedModuleIn = ["app", "vpn-impl"]
project.plugins.withId('kotlin-android-extensions') {
if (!allowDeprecatedModuleIn.contains(project.name)) {
throw new GradleException("kotlin-android-extensions plugin is deprecated, DO NOT USE!")
}
}
String[] allowAndroidTestsIn = ["app"]
if (!allowAndroidTestsIn.contains(project.name)) {
project.projectDir.eachFile(groovy.io.FileType.DIRECTORIES) { File parent ->
if (parent.name == "src") {
parent.eachFile(groovy.io.FileType.DIRECTORIES) { child ->
if (child.name == "androidTest") {
throw new GradleException("Only the app module can have Android Tests. Perhaps you could use Robolectric?")
}
}
}
}
}
def projectPath = path
configurations.all {
if (name == "compileClasspath" || name.endsWith("CompileClasspath")) {
incoming.beforeResolve {
for (dependency in dependencies) {
if (dependency instanceof ProjectDependency) {
def dependencyPath = dependency.dependencyProject.path
if (dependencyPath == projectPath) continue
// vpn-internal is part of vpn-impl
if (projectPath.endsWith(':vpn-internal') && dependencyPath.endsWith(':vpn-impl')) continue
if (!projectPath.endsWith(":app") && dependencyPath.endsWith("impl")) {
throw new GradleException("Invalid dependency $projectPath -> $dependencyPath. " +
"Only :app module can depend on 'impl' modules")
}
if (projectPath.endsWith("api") && dependencyPath.endsWith("api")) {
throw new GradleException("Invalid dependency $projectPath -> $dependencyPath. " +
"'api' modules can't depend on other 'api' modules")
}
if (dependencyPath.endsWith(":app")) {
throw new GradleException("Invalid dependency $projectPath -> $dependencyPath. " +
"No other module can depend on ':app'")
}
}
}
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
fladle {
configs {
serviceAccountCredentials.set(project.layout.projectDirectory.file("flank.json"))
androidTests {
async.set(false)
flankVersion.set("21.+")
testShards.set(2)
useOrchestrator.set(false)
recordVideo.set(false)
testTargets.set([
"notAnnotation com.duckduckgo.espresso.PrivacyTest",
"notAnnotation com.duckduckgo.espresso.UserJourney",
])
devices.set([
["model": "Pixel3", "version": "30"],
["model": "Nexus6", "version": "23"]
])
localResultsDir.set("fladleResults")
}
}
}
apply plugin: 'android-reporting'