summaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin/Bom.kt
blob: 7f93ed38abfcca5b356c78ae8dd7f0ea8f607481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.*

fun Project.addBomApiDependency(bomProjectPath: String) {
    val isMultiplatform = plugins.hasPlugin("kotlin-multiplatform")

    if (isMultiplatform) {
        kotlinExtension.sourceSets.getByName("jvmMain").dependencies {
            api(project.dependencies.platform(project(bomProjectPath)))
        }
    } else {
        dependencies {
            "api"(platform(project(bomProjectPath)))
        }
    }
}