diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt index 495d8f3..e7e3d59 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt @@ -12,35 +12,36 @@ import ru.mipt.npm.gradle.internal.defaultPlatform import ru.mipt.npm.gradle.internal.useCommonDependency import ru.mipt.npm.gradle.internal.useFx +enum class FXModule(val artifact: String, vararg val dependencies: FXModule) { + BASE("javafx-base"), + GRAPHICS("javafx-graphics", BASE), + CONTROLS("javafx-controls", GRAPHICS, BASE), + FXML("javafx-fxml", BASE), + MEDIA("javafx-media", GRAPHICS, BASE), + SWING("javafx-swing", GRAPHICS, BASE), + WEB("javafx-web", CONTROLS, GRAPHICS, BASE) +} + +enum class FXPlatform(val id: String) { + WINDOWS("win"), + LINUX("linux"), + MAC("mac") +} + +enum class DependencyConfiguration { + API, + IMPLEMENTATION, + COMPILE_ONLY +} + +enum class DependencySourceSet(val setName: String, val suffix: String) { + MAIN("main", "Main"), + TEST("test", "Test") +} + + class KScienceExtension(val project: Project) { - enum class FXModule(val artifact: String, vararg val dependencies: FXModule) { - BASE("javafx-base"), - GRAPHICS("javafx-graphics", BASE), - CONTROLS("javafx-controls", GRAPHICS, BASE), - FXML("javafx-fxml", BASE), - MEDIA("javafx-media", GRAPHICS, BASE), - SWING("javafx-swing", GRAPHICS, BASE), - WEB("javafx-web", CONTROLS, GRAPHICS, BASE) - } - - enum class FXPlatform(val id: String) { - WINDOWS("win"), - LINUX("linux"), - MAC("mac") - } - - enum class DependencyConfiguration { - API, - IMPLEMENTATION, - COMPILE_ONLY - } - - enum class DependencySourceSet(val setName: String, val suffix: String) { - MAIN("main", "Main"), - TEST("test", "Test") - } - fun useCoroutines( version: String = KScienceVersions.coroutinesVersion, sourceSet: DependencySourceSet = DependencySourceSet.MAIN, diff --git a/src/main/kotlin/ru/mipt/npm/gradle/SerializationTargets.kt b/src/main/kotlin/ru/mipt/npm/gradle/SerializationTargets.kt index 0b672f1..0868496 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/SerializationTargets.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/SerializationTargets.kt @@ -3,8 +3,6 @@ package ru.mipt.npm.gradle import org.gradle.api.Project import org.gradle.kotlin.dsl.maven import org.gradle.kotlin.dsl.repositories -import ru.mipt.npm.gradle.KScienceExtension.DependencyConfiguration -import ru.mipt.npm.gradle.KScienceExtension.DependencySourceSet import ru.mipt.npm.gradle.internal.useCommonDependency import ru.mipt.npm.gradle.internal.useDependency diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/dependencies.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/dependencies.kt index d1f2237..eaf260b 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/dependencies.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/dependencies.kt @@ -6,8 +6,8 @@ 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 ru.mipt.npm.gradle.KScienceExtension.DependencyConfiguration -import ru.mipt.npm.gradle.KScienceExtension.DependencySourceSet +import ru.mipt.npm.gradle.DependencyConfiguration +import ru.mipt.npm.gradle.DependencySourceSet internal fun Project.useDependency( vararg pairs: Pair, diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/fx.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/fx.kt index 66a4e22..83c07df 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/fx.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/fx.kt @@ -6,7 +6,9 @@ import org.gradle.kotlin.dsl.findByType import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler -import ru.mipt.npm.gradle.KScienceExtension.* +import ru.mipt.npm.gradle.DependencyConfiguration +import ru.mipt.npm.gradle.FXModule +import ru.mipt.npm.gradle.FXPlatform val defaultPlatform: FXPlatform = when { Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS @@ -36,7 +38,7 @@ internal fun Project.useFx( configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY, version: String = "14", platform: FXPlatform = defaultPlatform -): Unit = afterEvaluate{ +): Unit = afterEvaluate { pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { extensions.findByType()?.apply { sourceSets.findByName("jvmMain")?.apply {