-
-
Notifications
You must be signed in to change notification settings - Fork 470
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
142 lines (120 loc) · 5.06 KB
/
build.gradle.kts
File metadata and controls
142 lines (120 loc) · 5.06 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import io.gitlab.arturbosch.detekt.Detekt
import net.ltgt.gradle.errorprone.errorprone
plugins {
id("com.android.application")
kotlin("android")
alias(libs.plugins.errorprone)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.detekt)
}
android {
compileSdk = Config.Android.compileSdkVersion
namespace = "io.sentry.uitest.android"
defaultConfig {
minSdk = Config.Android.minSdkVersion
targetSdk = Config.Android.targetSdkVersion
versionCode = 1
versionName = "1.0.0"
testInstrumentationRunner = Config.TestLibs.androidJUnitRunner
// Runs each test in its own instance of Instrumentation. This way they are isolated from
// one another and get their own Application instance.
// https://developer.android.com/training/testing/instrumented-tests/androidx-test-libraries/runner#enable-gradle
// This doesn't work on some devices with Android 11+. Clearing package data resets permissions.
// Check the readme for more info.
testInstrumentationRunnerArguments["clearPackageData"] = "true"
buildConfigField("String", "ENVIRONMENT", "\"${System.getProperty("environment", "")}\"")
}
testOptions {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
}
buildFeatures {
// Determines whether to support View Binding.
// Note that the viewBinding.enabled property is now deprecated.
viewBinding = true
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = Config.androidComposeCompilerVersion
}
signingConfigs {
getByName("debug") {
storeFile = rootProject.file("debug.keystore")
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
}
testBuildType = System.getProperty("testBuildType", "debug")
buildTypes {
getByName("debug") {
isMinifyEnabled = true
signingConfig = signingConfigs.getByName("debug")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
getByName("release") {
isMinifyEnabled = true
isShrinkResources = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.getByName("debug") // to be able to run release mode
testProguardFiles("proguard-rules.pro")
}
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
lint {
warningsAsErrors = true
checkDependencies = true
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}
androidComponents.beforeVariants {
it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType)
}
}
val applySentryIntegrations = System.getenv("APPLY_SENTRY_INTEGRATIONS")?.toBoolean() ?: true
dependencies {
implementation(kotlin(Config.kotlinStdLib, org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION))
if (applySentryIntegrations) {
implementation(projects.sentryAndroid)
implementation(projects.sentryCompose)
} else {
implementation(projects.sentryAndroidCore)
}
implementation(Config.Libs.appCompat)
implementation(libs.androidx.core)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.compose.material3)
implementation(Config.Libs.androidxRecylerView)
implementation(Config.Libs.constraintLayout)
implementation(libs.androidx.test.espresso.idling.resource)
implementation(Config.Libs.leakCanary)
compileOnly(Config.CompileOnly.nopen)
errorprone(Config.CompileOnly.nopenChecker)
errorprone(Config.CompileOnly.errorprone)
errorprone(Config.CompileOnly.errorProneNullAway)
androidTestUtil(libs.androidx.test.orchestrator)
androidTestImplementation(projects.sentryTestSupport)
androidTestImplementation(libs.kotlin.test.junit)
androidTestImplementation(libs.androidx.test.core.ktx)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.okhttp.mockwebserver)
androidTestImplementation(Config.TestLibs.leakCanaryInstrumentation)
androidTestImplementation(Config.TestLibs.awaitility3)
}
tasks.withType<JavaCompile>().configureEach {
options.errorprone {
check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR)
option("NullAway:AnnotatedPackages", "io.sentry")
option("NullAway:UnannotatedSubPackages", "io.sentry.uitest.android.databinding")
}
}
tasks.withType<Detekt>().configureEach {
// Target version of the generated JVM bytecode. It is used for type resolution.
jvmTarget = JavaVersion.VERSION_1_8.toString()
}