Fix dependency configuration
This commit is contained in:
parent
723a959a0b
commit
be571a9028
@ -112,7 +112,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
extensions.findByType<JavaPluginExtension>()?.apply {
|
extensions.findByType<JavaPluginExtension>()?.apply {
|
||||||
targetCompatibility = KScienceVersions.JVM_TARGET
|
targetCompatibility = KScienceVersions.JVM_TARGET
|
||||||
withSourcesJar()
|
//withSourcesJar()
|
||||||
//withJavadocJar()
|
//withJavadocJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package ru.mipt.npm.gradle
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.configure
|
import org.gradle.kotlin.dsl.configure
|
||||||
import org.gradle.kotlin.dsl.invoke
|
import org.gradle.kotlin.dsl.invoke
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
|
|
||||||
enum class DependencyConfiguration {
|
enum class DependencyConfiguration {
|
||||||
@ -37,39 +39,41 @@ internal fun Project.useDependency(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pairs.find { it.first == "jvm" }?.let { dep ->
|
||||||
pairs.find { it.first == "jvm" }?.let { dep ->
|
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
configure<KotlinJvmProjectExtension> {
|
||||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||||
dependencies.apply {
|
dependencies.apply {
|
||||||
val configurationName = when (dependencyConfiguration) {
|
val configurationName = when (dependencyConfiguration) {
|
||||||
DependencyConfiguration.API -> apiConfigurationName
|
DependencyConfiguration.API -> apiConfigurationName
|
||||||
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
||||||
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
||||||
}
|
|
||||||
add(configurationName, dep.second)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pairs.find { it.first == "js" }?.let { dep ->
|
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
|
||||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
|
||||||
dependencies.apply {
|
|
||||||
val configurationName = when (dependencyConfiguration) {
|
|
||||||
DependencyConfiguration.API -> apiConfigurationName
|
|
||||||
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
|
||||||
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
|
||||||
}
|
|
||||||
add(configurationName, dep.second)
|
|
||||||
}
|
}
|
||||||
|
add(configurationName, dep.second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pairs.find { it.first == "js" }?.let { dep ->
|
||||||
|
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
||||||
|
configure<KotlinJsProjectExtension> {
|
||||||
|
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||||
|
dependencies.apply {
|
||||||
|
val configurationName = when (dependencyConfiguration) {
|
||||||
|
DependencyConfiguration.API -> apiConfigurationName
|
||||||
|
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
||||||
|
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
||||||
|
}
|
||||||
|
add(configurationName, dep.second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,29 +93,34 @@ internal fun Project.useCommonDependency(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
withPlugin("org.jetbrains.kotlin.jvm") {
|
|
||||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
withPlugin("org.jetbrains.kotlin.jvm") {
|
||||||
dependencies.apply {
|
configure<KotlinJvmProjectExtension> {
|
||||||
val configurationName = when (dependencyConfiguration) {
|
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||||
DependencyConfiguration.API -> apiConfigurationName
|
dependencies.apply {
|
||||||
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
val configurationName = when (dependencyConfiguration) {
|
||||||
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
DependencyConfiguration.API -> apiConfigurationName
|
||||||
}
|
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
||||||
add(configurationName, dep)
|
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
||||||
}
|
}
|
||||||
|
add(configurationName, dep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
withPlugin("org.jetbrains.kotlin.js") {
|
}
|
||||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
}
|
||||||
dependencies.apply {
|
withPlugin("org.jetbrains.kotlin.js") {
|
||||||
val configurationName = when (dependencyConfiguration) {
|
configure<KotlinJsProjectExtension> {
|
||||||
DependencyConfiguration.API -> apiConfigurationName
|
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||||
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
dependencies.apply {
|
||||||
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
val configurationName = when (dependencyConfiguration) {
|
||||||
}
|
DependencyConfiguration.API -> apiConfigurationName
|
||||||
add(configurationName, dep)
|
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
|
||||||
|
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
|
||||||
}
|
}
|
||||||
|
add(configurationName, dep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user