generated from segment-integrations/analytics-kotlin-destination-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
122 lines (97 loc) · 3.59 KB
/
build.gradle.kts
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
plugins {
id("com.android.library")
kotlin("android")
id("org.jetbrains.kotlin.plugin.serialization")
id("mvn-publish")
}
val VERSION_NAME: String by project
android {
compileSdk = 33
buildToolsVersion = "33.0.1"
defaultConfig {
multiDexEnabled = true
minSdk = 16
targetSdk = 33
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles("proguard-consumer-rules.pro")
buildConfigField("String", "VERSION_NAME", "\"$VERSION_NAME\"")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.2")
implementation("com.segment.analytics.kotlin:android:1.10.3")
implementation("androidx.multidex:multidex:2.0.1")
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.5.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.lifecycle:lifecycle-process:2.4.1")
implementation("androidx.lifecycle:lifecycle-common-java8:2.4.1")
}
// Partner Dependencies
dependencies {
implementation("com.mixpanel.android:mixpanel-android:7.3.3")
}
// Test Dependencies
dependencies {
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
testImplementation("io.mockk:mockk:1.12.4")
testImplementation(platform("org.junit:junit-bom:5.7.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
// Add Roboelectric dependencies.
testImplementation("org.robolectric:robolectric:4.7.3")
testImplementation("androidx.test:core:1.5.0")
// Add JUnit4 legacy dependencies.
testImplementation("junit:junit:4.13.2")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.8.2")
// For JSON Object testing
testImplementation("org.json:json:20200518")
testImplementation("org.skyscreamer:jsonassert:1.5.0")
}
tasks.withType<Test> {
useJUnitPlatform()
}
// required for mvn-publish
// too bad we can't move it into mvn-publish plugin because `android`is only accessible here
tasks {
val sourceFiles = android.sourceSets.getByName("main").java.srcDirs
register<Javadoc>("withJavadoc") {
isFailOnError = false
setSource(sourceFiles)
// add Android runtime classpath
android.bootClasspath.forEach { classpath += project.fileTree(it) }
// add classpath for all dependencies
android.libraryVariants.forEach { variant ->
variant.javaCompileProvider.get().classpath.files.forEach { file ->
classpath += project.fileTree(file)
}
}
}
register<Jar>("withJavadocJar") {
archiveClassifier.set("javadoc")
dependsOn(named("withJavadoc"))
val destination = named<Javadoc>("withJavadoc").get().destinationDir
from(destination)
}
register<Jar>("withSourcesJar") {
archiveClassifier.set("sources")
from(sourceFiles)
}
}