forked from flashcatcloud/fc-sdk-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
129 lines (107 loc) · 3.27 KB
/
build.gradle.kts
File metadata and controls
129 lines (107 loc) · 3.27 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
/*
* 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.
*/
import com.datadog.gradle.config.AndroidConfig
import com.datadog.gradle.config.MavenConfig
plugins {
`java-library`
id("com.gradleup.shadow")
`maven-publish`
}
dependencies {
implementation(libs.jctools)
implementation(libs.re2j)
}
tasks.named<Jar>("jar") {
// Move the default (empty) jar out of the way to avoid name collision
archiveClassifier.set("raw")
}
tasks.shadowJar {
// Make shadowJar the primary artifact by removing the 'all' classifier
archiveClassifier.set("")
relocate("org.jctools", "cloud.flashcat.shaded.jctools")
relocate("com.google.re2j", "cloud.flashcat.shaded.re2j")
// Use runtimeClasspath which is resolvable
configurations = listOf(project.configurations.runtimeClasspath.get())
}
publishing {
publications {
register<MavenPublication>("maven") {
groupId = MavenConfig.GROUP_ID
artifactId = project.name
version = AndroidConfig.VERSION.name
artifact(tasks.shadowJar)
}
}
}
// Force the shadowJar to be the ONLY exported artifact for this module
// This prevents R8 duplicate class errors while ensuring the file exists for KSP
configurations.apiElements {
outgoing.artifacts.clear()
outgoing.artifact(tasks.shadowJar)
}
configurations.runtimeElements {
outgoing.artifacts.clear()
outgoing.artifact(tasks.shadowJar)
}
tasks.assemble {
dependsOn(tasks.shadowJar)
}
if (tasks.findByName("assembleDebug") == null) {
tasks.register("assembleDebug") {
dependsOn("assemble")
}
}
if (tasks.findByName("assembleRelease") == null) {
tasks.register("assembleRelease") {
dependsOn("assemble")
}
}
// Shadow tasks to satisfy Android aggregation tasks
if (tasks.findByName("testDebugUnitTest") == null) {
tasks.register("testDebugUnitTest") {
dependsOn("test")
}
}
if (tasks.findByName("testReleaseUnitTest") == null) {
tasks.register("testReleaseUnitTest") {
dependsOn("test")
}
}
if (tasks.findByName("lintRelease") == null) {
tasks.register("lintRelease") {
// No-op for this Java library
}
}
if (tasks.findByName("checkDependencyLicenses") == null) {
tasks.register("checkDependencyLicenses") {
// No-op for this Java library
}
}
if (tasks.findByName("checkApiSurfaceChanges") == null) {
tasks.register("checkApiSurfaceChanges") {
// No-op for this Java library
}
}
if (tasks.findByName("checkCompilerMetadataChanges") == null) {
tasks.register("checkCompilerMetadataChanges") {
// No-op for this Java library
}
}
if (tasks.findByName("checkTransitiveDependenciesList") == null) {
tasks.register("checkTransitiveDependenciesList") {
// No-op for this Java library
}
}
if (tasks.findByName("koverXmlReportRelease") == null) {
tasks.register("koverXmlReportRelease") {
// No-op or depends on koverXmlReport if applied
}
}
if (tasks.findByName("printDetektClasspath") == null) {
tasks.register("printDetektClasspath") {
// No-op
}
}