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