Skip to content

Commit

Permalink
Use defaultPublishConfig if possible for android modules
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelreiter committed Dec 1, 2020
1 parent 162fd3c commit 5e1d3dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repositories {
mavenCentral()
jcenter()
gradlePluginPortal()
google()
}

sourceSets {
Expand All @@ -30,6 +31,7 @@ dependencies {
implementation("org.ow2.asm:asm-tree:6.0")
implementation("com.googlecode.java-diff-utils:diffutils:1.3.0")
compileOnly("org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:1.3.61")
compileOnly("com.android.tools.build:gradle:3.6.4")
testImplementation(kotlin("test-junit"))
}

Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.gradle.api.tasks.*
import org.jetbrains.kotlin.gradle.dsl.*
import org.jetbrains.kotlin.gradle.plugin.*
import java.io.*
import com.android.build.gradle.BaseExtension as AndroidBaseExtension

const val API_DIR = "api"

Expand Down Expand Up @@ -48,8 +49,10 @@ class BinaryCompatibilityValidatorPlugin : Plugin<Project> {
project.pluginManager.withPlugin("kotlin-android") {
if (project.name in project.rootProject.ignoredProjects()) return@withPlugin
val extension = project.extensions.getByName("kotlin") as KotlinAndroidProjectExtension
val androidBase = project.extensions.getByName("android") as AndroidBaseExtension
val defaultPublishName = androidBase.defaultPublishConfig ?: "release"
extension.target.compilations.matching {
it.compilationName == "release"
it.compilationName == defaultPublishName
}.all {
project.configureKotlinCompilation(it, useOutput = true)
}
Expand Down

0 comments on commit 5e1d3dc

Please sign in to comment.