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