-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathAndroidConfig.kt
More file actions
89 lines (75 loc) · 2.72 KB
/
Copy pathAndroidConfig.kt
File metadata and controls
89 lines (75 loc) · 2.72 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
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/
package com.datadog.gradle.config
import com.android.build.api.dsl.CompileOptions
import com.android.build.api.dsl.LibraryExtension
import com.datadog.gradle.utils.Version
import org.gradle.api.JavaVersion
import org.gradle.api.Project
object AndroidConfig {
const val TARGET_SDK = 36
const val MIN_SDK = 23
const val MIN_SDK_FOR_AUTO = 29
const val BUILD_TOOLS_VERSION = "36.0.0"
val VERSION = Version(3, 11, 0, Version.Type.Snapshot())
}
// TODO RUM-628 Switch to Java 17 bytecode
fun CompileOptions.java11() {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
fun CompileOptions.java17() {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
fun Project.androidLibraryConfig() {
extensionConfig<LibraryExtension> {
compileSdk = AndroidConfig.TARGET_SDK
buildToolsVersion = AndroidConfig.BUILD_TOOLS_VERSION
defaultConfig {
minSdk = AndroidConfig.MIN_SDK
}
compileOptions {
java11()
}
sourceSets.all {
java.srcDir("src/$name/kotlin")
}
sourceSets.named("main") {
java.srcDir("build/generated/json2kotlin/main/kotlin")
}
@Suppress("UnstableApiUsage")
testOptions {
unitTests.isReturnDefaultValues = true
}
lint {
warningsAsErrors = true
abortOnError = true
checkReleaseBuilds = false
checkGeneratedSources = true
ignoreTestSources = true
val disabledChecks = listOf(
// https://googlesamples.github.io/android-custom-lint-rules/checks/AndroidGradlePluginVersion.md.html
"AndroidGradlePluginVersion",
// https://googlesamples.github.io/android-custom-lint-rules/checks/GradleDependency.md.html
"GradleDependency",
// https://googlesamples.github.io/android-custom-lint-rules/checks/Aligned16KB.md.html
"Aligned16KB",
"UseKtx" // https://googlesamples.github.io/android-custom-lint-rules/checks/UseKtx.md.html
)
disable.addAll(disabledChecks)
}
packaging {
resources {
excludes += listOf(
"META-INF/jvm.kotlin_module",
"META-INF/LICENSE.md",
"META-INF/LICENSE-notice.md"
)
}
}
}
}