|
| 1 | +import net.ltgt.gradle.errorprone.errorprone |
| 2 | +import org.jetbrains.kotlin.config.KotlinCompilerVersion |
| 3 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 4 | + |
| 5 | +plugins { |
| 6 | + `java-library` |
| 7 | + kotlin("jvm") |
| 8 | + jacoco |
| 9 | + id("io.sentry.javadoc") |
| 10 | + alias(libs.plugins.errorprone) |
| 11 | + alias(libs.plugins.gradle.versions) |
| 12 | + alias(libs.plugins.buildconfig) |
| 13 | +} |
| 14 | + |
| 15 | +tasks.withType<KotlinCompile>().configureEach { |
| 16 | + kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString() |
| 17 | +} |
| 18 | + |
| 19 | +kotlin { explicitApi() } |
| 20 | + |
| 21 | +dependencies { |
| 22 | + api(projects.sentry) |
| 23 | + |
| 24 | + implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) |
| 25 | + api(projects.sentryKotlinExtensions) |
| 26 | + |
| 27 | + compileOnly(libs.jetbrains.annotations) |
| 28 | + compileOnly(libs.nopen.annotations) |
| 29 | + compileOnly(libs.ktor.client.core) |
| 30 | + errorprone(libs.errorprone.core) |
| 31 | + errorprone(libs.nopen.checker) |
| 32 | + errorprone(libs.nullaway) |
| 33 | + |
| 34 | + testImplementation(projects.sentryTestSupport) |
| 35 | + testImplementation(libs.kotlin.test.junit) |
| 36 | + testImplementation(libs.mockito.kotlin) |
| 37 | + testImplementation(libs.mockito.inline) |
| 38 | + testImplementation(libs.ktor.client.core) |
| 39 | + testImplementation(libs.ktor.client.java) |
| 40 | + testImplementation(libs.okhttp.mockwebserver) |
| 41 | +} |
| 42 | + |
| 43 | +configure<SourceSetContainer> { test { java.srcDir("src/test/java") } } |
| 44 | + |
| 45 | +jacoco { toolVersion = libs.versions.jacoco.get() } |
| 46 | + |
| 47 | +tasks.jacocoTestReport { |
| 48 | + reports { |
| 49 | + xml.required.set(true) |
| 50 | + html.required.set(false) |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +tasks { |
| 55 | + jacocoTestCoverageVerification { |
| 56 | + violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } |
| 57 | + } |
| 58 | + check { |
| 59 | + dependsOn(jacocoTestCoverageVerification) |
| 60 | + dependsOn(jacocoTestReport) |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +buildConfig { |
| 65 | + useJavaOutput() |
| 66 | + packageName("io.sentry.ktorClient") |
| 67 | + buildConfigField( |
| 68 | + "String", |
| 69 | + "SENTRY_KTOR_CLIENT_SDK_NAME", |
| 70 | + "\"${Config.Sentry.SENTRY_KTOR_CLIENT_SDK_NAME}\"", |
| 71 | + ) |
| 72 | + buildConfigField("String", "VERSION_NAME", "\"${project.version}\"") |
| 73 | +} |
| 74 | + |
| 75 | +tasks.withType<JavaCompile>().configureEach { |
| 76 | + dependsOn(tasks.generateBuildConfig) |
| 77 | + options.errorprone { |
| 78 | + check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) |
| 79 | + option("NullAway:AnnotatedPackages", "io.sentry") |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +tasks.jar { |
| 84 | + manifest { |
| 85 | + attributes( |
| 86 | + "Sentry-Version-Name" to project.version, |
| 87 | + "Sentry-SDK-Name" to Config.Sentry.SENTRY_KTOR_CLIENT_SDK_NAME, |
| 88 | + "Sentry-SDK-Package-Name" to "maven:io.sentry:sentry-ktor-client", |
| 89 | + "Implementation-Vendor" to "Sentry", |
| 90 | + "Implementation-Title" to project.name, |
| 91 | + "Implementation-Version" to project.version, |
| 92 | + ) |
| 93 | + } |
| 94 | +} |
0 commit comments