-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
162 lines (144 loc) · 5.54 KB
/
build.gradle.kts
File metadata and controls
162 lines (144 loc) · 5.54 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import com.datadog.build.ProjectConfig
import com.datadog.build.utils.taskConfig
import io.github.gradlenexus.publishplugin.AbstractNexusStagingRepositoryTask
/*
* 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.
*/
plugins {
// trick: for the same plugin versions in all sub-modules
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinCocoapods) apply false
alias(libs.plugins.dependencyLicense) apply false
alias(libs.plugins.mokkery) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.nexusPublish)
id("datadog-ios-build-pods")
// false - just to load classes into a classpath
id("datadog-build-config") apply false
}
datadogPodsBuild {
podVersion.set(libs.versions.datadog.ios.get())
}
nexusPublishing {
repositories {
sonatype {
val sonatypeUsername = System.getenv("CENTRAL_PUBLISHER_USERNAME")
val sonatypePassword = System.getenv("CENTRAL_PUBLISHER_PASSWORD")
stagingProfileId.set("378eecbbe2cf9")
if (sonatypeUsername != null) username.set(sonatypeUsername)
if (sonatypePassword != null) password.set(sonatypePassword)
// see https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-central
// For official documentation:
// staging repo publishing https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
}
}
}
// nexus-publish plugin creates repository tasks only for the root project, so we cannot set a
// sub-project-specific description
project.taskConfig<AbstractNexusStagingRepositoryTask> {
repositoryDescription.set(
"${ProjectConfig.GROUP_ID}:dd-sdk-kotlin-multiplatform:${ProjectConfig.VERSION.name}"
)
}
/**
* Task necessary to be compliant with the shared Android static analysis pipeline
*/
tasks.register("checkGeneratedFiles") { }
/**
* Creates a task aggregating a task on all projects.
* @param aggregationTaskName the name of the aggregating task
* @param projectTaskName the name of the task to aggregate from each module
* @param pluginName the name of the plugin to expect on modules
*/
fun registerPluginSpecificAggregationTask(
aggregationTaskName: String,
projectTaskName: String,
pluginName: String
) {
tasks.register(aggregationTaskName) {
val aggregationTask = this
allprojects.forEach {
it.pluginManager.withPlugin(pluginName) {
val projectTask = it.tasks.named(projectTaskName)
aggregationTask.dependsOn(projectTask)
}
}
}
}
registerPluginSpecificAggregationTask(
"checkApiSurfaceChangesAll",
"checkApiSurfaceChanges",
"api-surface"
)
registerPluginSpecificAggregationTask(
"generateApiSurfaceAll",
"generateApiSurface",
"api-surface"
)
registerPluginSpecificAggregationTask(
"listTransitiveDependenciesAll",
"listTransitiveDependencies",
"transitive-dependencies"
)
val publishableProjects = listOf(
projects.core,
projects.features.logs,
projects.features.rum,
projects.features.webview,
projects.features.sessionReplay,
projects.integrations.ktor,
projects.integrations.ktor3
)
val jvmUnitTestDebugAllTask = tasks.register("jvmUnitTestDebugAll") {
val subProjectsTestTasks = publishableProjects.map {
"${it.targetProjectIdentity.buildTreePath.path}:testDebugUnitTest"
}
dependsOn(subProjectsTestTasks)
}
val jvmUnitTestReleaseAllTask = tasks.register("jvmUnitTestReleaseAll") {
val subProjectsTestTasks = publishableProjects.map {
"${it.targetProjectIdentity.buildTreePath.path}:testReleaseUnitTest"
}
dependsOn(subProjectsTestTasks)
}
// will cover Android-specific tests + tests from common source set
val jvmUnitTestAllTask = tasks.register("jvmUnitTestAll") {
dependsOn(
jvmUnitTestDebugAllTask,
jvmUnitTestReleaseAllTask,
gradle.includedBuild("build-plugins").task(":test")
)
}
val iosUnitTestAllTask = tasks.register("iosUnitTestAll") {
val subProjectsTestTasks = publishableProjects.map {
"${it.targetProjectIdentity.buildTreePath.path}:iosSimulatorArm64Test"
}
dependsOn(subProjectsTestTasks)
}
val tvosUnitTestAllTask = tasks.register("tvosUnitTestAll") {
val subProjectsTestTasks = publishableProjects
// by some reason something like `projects.features.webview == projects.features.webview` evaluates to false
.filter {
it.targetProjectIdentity.buildTreePath.path !in setOf(":features:session-replay", ":features:webview")
}
.map { "${it.targetProjectIdentity.buildTreePath.path}:tvosSimulatorArm64Test" }
dependsOn(subProjectsTestTasks)
}
val appleUnitTestAllTask = tasks.register("appleUnitTestAll") {
dependsOn(iosUnitTestAllTask, tvosUnitTestAllTask)
}
tasks.register("unitTestAll") {
dependsOn(jvmUnitTestAllTask, appleUnitTestAllTask)
}
tasks.register("lintCheckAll") {
val subProjectsLintTasks = publishableProjects.map {
"${it.targetProjectIdentity.buildTreePath.path}:lintRelease"
}
dependsOn(subProjectsLintTasks)
}