Files
pkurchatov b1c8f3beff build.gradle cleanup
commit_hash:55aba830b28c1f2838bcb5c2956f46f59f0117c0
2026-04-24 15:59:12 +03:00

150 lines
4.3 KiB
Groovy

import com.yandex.div.gradle.FileExtensions
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
FileExtensions.ifExists("${project.projectDir}/bootstrap.internal.gradle") {
apply from: it
}
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath libs.agp.gradle
classpath libs.appmetrica.plugin
classpath libs.nexusPublishPlugin
classpath libs.kotlin.allopen
classpath libs.kotlin.gradle.plugin
classpath libs.kotlin.binaryCompatibilityValidator
classpath libs.unmock.plugin
}
}
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.allopen) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
}
apply plugin: "org.jetbrains.kotlinx.binary-compatibility-validator"
apply from: "$projectDir/version.gradle"
ext {
minSdkVersion = 21
compileSdkVersion = 36
targetSdkVersion = 36
}
allprojects {
repositories {
google()
mavenCentral()
}
configurations.configureEach {
resolutionStrategy {
eachDependency { details ->
if (details.requested.group == "com.christophsturm" && details.requested.name == "filepeek") {
details.useVersion "0.1.3"
}
}
}
}
tasks.withType(KotlinCompile).configureEach {
compilerOptions {
freeCompilerArgs.addAll(
"-Xjvm-default=all",
"-opt-in=com.yandex.div.data.DivModelInternalApi",
"-opt-in=com.yandex.yatagan.ConditionsApi",
"-opt-in=com.yandex.div.core.annotations.InternalApi",
"-opt-in=com.yandex.div.core.annotations.ExperimentalApi",
)
if (name.toLowerCase().contains("release")) {
freeCompilerArgs.addAll(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions",
"-Xno-source-debug-extension",
)
}
languageVersion = KotlinVersion.KOTLIN_1_8
apiVersion = KotlinVersion.KOTLIN_1_8
jvmTarget = JvmTarget.JVM_1_8
}
}
}
subprojects {
tasks.withType(Test).configureEach {
// Do not use parallel forks, because profit from parallel execution is eaten by Robolectric initialization in every test process
maxParallelForks = 1
maxHeapSize = "4g"
failOnNoDiscoveredTests = false
}
configurations.configureEach {
exclude group: "com.intellij", module: "annotations"
exclude group: "io.appmetrica.analytics", module: "analytics-local-socket"
}
afterEvaluate {
project.tasks.withType(PublishToMavenRepository).configureEach { task ->
task.finalizedBy(reportBuildNumber)
}
project.tasks.withType(PublishToMavenLocal).configureEach { task ->
task.finalizedBy(reportVersion)
}
}
}
apiValidation {
ignoredProjects += [
"api-generator-test",
"compose",
"divkit-benchmark-app",
"divkit-demo-app",
"divkit-perftests",
"divkit-regression-testing",
"lint-rules",
"sample",
"screenshot-test-runtime",
"test-utils",
"ui-test-common",
]
ignoredPackages += ["com.yandex.div.internal"]
nonPublicMarkers += [
"com.yandex.yatagan.internal.YataganGenerated",
"com.yandex.div.core.annotations.ExperimentalApi",
"com.yandex.div.core.annotations.InternalApi"
]
}
tasks.register('reportVersion') {
def version = divkitVersion.releaseLibraryVersion
doLast {
println "DivKit version $version"
}
}
tasks.register('reportBuildNumber') {
def version = divkitVersion.releaseLibraryVersion
doLast {
println "buildNumber $version"
}
}
FileExtensions.ifExists("${project.projectDir}/build.internal.gradle") {
apply from: it
}