forked from getsentry/sentry-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
201 lines (182 loc) · 7.02 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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import com.diffplug.spotless.LineEnding
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.MavenPublishPluginExtension
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
`java-library`
id(Config.QualityPlugins.spotless) version Config.QualityPlugins.spotlessVersion apply true
jacoco
id(Config.QualityPlugins.detekt) version Config.QualityPlugins.detektVersion
`maven-publish`
id(Config.QualityPlugins.binaryCompatibilityValidator) version Config.QualityPlugins.binaryCompatibilityValidatorVersion
}
buildscript {
repositories {
google()
}
dependencies {
classpath(Config.BuildPlugins.androidGradle)
classpath(kotlin(Config.BuildPlugins.kotlinGradlePlugin, version = Config.kotlinVersion))
classpath(Config.BuildPlugins.gradleMavenPublishPlugin)
// dokka is required by gradle-maven-publish-plugin.
classpath(Config.BuildPlugins.dokkaPlugin)
classpath(Config.QualityPlugins.errorpronePlugin)
classpath(Config.QualityPlugins.gradleVersionsPlugin)
// add classpath of androidNativeBundle
// com.ydq.android.gradle.build.tool:nativeBundle:{version}}
classpath(Config.NativePlugins.nativeBundlePlugin)
// add classpath of sentry android gradle plugin
// classpath("io.sentry:sentry-android-gradle-plugin:{version}")
classpath(Config.QualityPlugins.binaryCompatibilityValidatorPlugin)
classpath(Config.BuildPlugins.composeGradlePlugin)
}
}
apiValidation {
ignoredPackages.addAll(
setOf(
"io.sentry.android.core.internal"
)
)
ignoredProjects.addAll(
listOf(
"sentry-samples-android",
"sentry-samples-console",
"sentry-samples-jul",
"sentry-samples-log4j2",
"sentry-samples-logback",
"sentry-samples-openfeign",
"sentry-samples-servlet",
"sentry-samples-spring",
"sentry-samples-spring-jakarta",
"sentry-spring-jakarta",
"sentry-spring-boot-starter-jakarta",
"sentry-samples-spring-boot",
"sentry-samples-spring-boot-jakarta",
"sentry-samples-spring-boot-webflux",
"sentry-samples-netflix-dgs",
"sentry-uitest-android",
"sentry-uitest-android-benchmark",
"test-app-plain",
"test-app-sentry"
)
)
}
allprojects {
repositories {
google()
mavenCentral()
}
group = Config.Sentry.group
version = properties[Config.Sentry.versionNameProp].toString()
description = Config.Sentry.description
tasks {
withType<Test> {
testLogging.showStandardStreams = true
testLogging.exceptionFormat = TestExceptionFormat.FULL
testLogging.events = setOf(
TestLogEvent.SKIPPED,
TestLogEvent.PASSED,
TestLogEvent.FAILED
)
dependsOn("cleanTest")
}
withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing"))
}
}
}
subprojects {
plugins.withId(Config.QualityPlugins.detektPlugin) {
configure<DetektExtension> {
buildUponDefaultConfig = true
allRules = true
config.setFrom("${rootProject.rootDir}/detekt.yml")
}
}
if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-test-support") {
apply<DistributionPlugin>()
val sep = File.separator
configure<DistributionContainer> {
if ([email protected]("-compose")) {
this.configureForMultiplatform(this@subprojects)
} else {
this.getByName("main").contents {
// non android modules
from("build${sep}libs")
from("build${sep}publications${sep}maven")
// android modules
from("build${sep}outputs${sep}aar")
from("build${sep}publications${sep}release")
}
}
}
tasks.named("distZip").configure {
this.dependsOn("publishToMavenLocal")
this.doLast {
val distributionFilePath = "${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
val file = File(distributionFilePath)
if (!file.exists()) throw IllegalStateException("Distribution file: $distributionFilePath does not exist")
if (file.length() == 0L) throw IllegalStateException("Distribution file: $distributionFilePath is empty")
}
}
afterEvaluate {
apply<MavenPublishPlugin>()
configure<MavenPublishPluginExtension> {
// signing is done when uploading files to MC
// via gpg:sign-and-deploy-file (release.kts)
releaseSigningEnabled = false
}
// maven central info go to:
// ~/.gradle/gradle.properties
// maven central info:
// mavenCentralUsername=user name
// mavenCentralPassword=password
}
}
}
spotless {
lineEndings = LineEnding.UNIX
java {
target("**/*.java")
removeUnusedImports()
googleJavaFormat()
targetExclude("**/generated/**", "**/vendor/**", "sentry-spring-jakarta/**", "sentry-spring-boot-starter-jakarta/**")
}
kotlin {
target("**/*.kt")
ktlint()
targetExclude("sentry-spring-jakarta/**", "sentry-spring-boot-starter-jakarta/**")
}
kotlinGradle {
target("**/*.kts")
ktlint()
}
}
gradle.projectsEvaluated {
tasks.create("aggregateJavadocs", Javadoc::class.java) {
setDestinationDir(file("$buildDir/docs/javadoc"))
title = "${project.name} $version API"
val opts = options as StandardJavadocDocletOptions
opts.quiet()
opts.encoding = "UTF-8"
opts.memberLevel = JavadocMemberLevel.PROTECTED
opts.stylesheetFile(file("$projectDir/docs/stylesheet.css"))
opts.links = listOf(
"https://docs.oracle.com/javase/8/docs/api/",
"https://docs.spring.io/spring-framework/docs/current/javadoc-api/",
"https://docs.spring.io/spring-boot/docs/current/api/"
)
subprojects
.filter { !it.name.contains("sample") && !it.name.contains("integration-tests") }
.forEach { proj ->
proj.tasks.withType<Javadoc>().forEach { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += javadocTask.includes
}
}
}
}