|
| 1 | +import net.ltgt.gradle.errorprone.errorprone |
| 2 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 3 | + |
| 4 | +plugins { |
| 5 | + `java-library` |
| 6 | + kotlin("jvm") |
| 7 | + jacoco |
| 8 | + id(Config.QualityPlugins.errorProne) |
| 9 | + id(Config.QualityPlugins.gradleVersions) |
| 10 | + id(Config.BuildPlugins.buildConfig) version Config.BuildPlugins.buildConfigVersion |
| 11 | +} |
| 12 | + |
| 13 | +configure<JavaPluginExtension> { |
| 14 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 15 | + targetCompatibility = JavaVersion.VERSION_17 |
| 16 | +} |
| 17 | + |
| 18 | +tasks.withType<KotlinCompile>().configureEach { |
| 19 | + kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() |
| 20 | + kotlinOptions.languageVersion = Config.kotlinCompatibleLanguageVersion |
| 21 | +} |
| 22 | + |
| 23 | +dependencies { |
| 24 | + api(projects.sentry) |
| 25 | + compileOnly(Config.Libs.reactorCore) |
| 26 | + compileOnly(Config.Libs.contextPropagation) |
| 27 | + |
| 28 | + compileOnly(Config.CompileOnly.nopen) |
| 29 | + errorprone(Config.CompileOnly.nopenChecker) |
| 30 | + errorprone(Config.CompileOnly.errorprone) |
| 31 | + errorprone(Config.CompileOnly.errorProneNullAway) |
| 32 | + compileOnly(Config.CompileOnly.jetbrainsAnnotations) |
| 33 | + |
| 34 | + // tests |
| 35 | + testImplementation(projects.sentryTestSupport) |
| 36 | + testImplementation(kotlin(Config.kotlinStdLib)) |
| 37 | + testImplementation(Config.TestLibs.kotlinTestJunit) |
| 38 | + testImplementation(Config.TestLibs.mockitoKotlin) |
| 39 | + |
| 40 | + testImplementation(Config.Libs.reactorCore) |
| 41 | + testImplementation(Config.Libs.contextPropagation) |
| 42 | + |
| 43 | + testImplementation(platform("org.junit:junit-bom:5.10.0")) |
| 44 | + testImplementation("org.junit.jupiter:junit-jupiter") |
| 45 | +} |
| 46 | + |
| 47 | +configure<SourceSetContainer> { |
| 48 | + test { |
| 49 | + java.srcDir("src/test/java") |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +jacoco { |
| 54 | + toolVersion = Config.QualityPlugins.Jacoco.version |
| 55 | +} |
| 56 | + |
| 57 | +tasks.jacocoTestReport { |
| 58 | + reports { |
| 59 | + xml.required.set(true) |
| 60 | + html.required.set(false) |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +tasks { |
| 65 | + jacocoTestCoverageVerification { |
| 66 | + violationRules { |
| 67 | + rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } |
| 68 | + } |
| 69 | + } |
| 70 | + check { |
| 71 | + dependsOn(jacocoTestCoverageVerification) |
| 72 | + dependsOn(jacocoTestReport) |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +buildConfig { |
| 77 | + useJavaOutput() |
| 78 | + packageName("io.sentry.reactor") |
| 79 | + buildConfigField("String", "SENTRY_REACTOR_SDK_NAME", "\"${Config.Sentry.SENTRY_REACTOR_SDK_NAME}\"") |
| 80 | + buildConfigField("String", "VERSION_NAME", "\"${project.version}\"") |
| 81 | +} |
| 82 | + |
| 83 | +val generateBuildConfig by tasks |
| 84 | +tasks.withType<JavaCompile>().configureEach { |
| 85 | + dependsOn(generateBuildConfig) |
| 86 | + options.errorprone { |
| 87 | + check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) |
| 88 | + option("NullAway:AnnotatedPackages", "io.sentry") |
| 89 | + } |
| 90 | +} |
| 91 | + |
| 92 | +repositories { |
| 93 | + mavenCentral() |
| 94 | +} |
0 commit comments