Dev #5

Merged
altavir merged 24 commits from dev into master 2020-12-28 09:44:15 +03:00
4 changed files with 34 additions and 33 deletions
Showing only changes of commit 1b7a2038ed - Show all commits

View File

@ -12,9 +12,7 @@ import ru.mipt.npm.gradle.internal.defaultPlatform
import ru.mipt.npm.gradle.internal.useCommonDependency import ru.mipt.npm.gradle.internal.useCommonDependency
import ru.mipt.npm.gradle.internal.useFx import ru.mipt.npm.gradle.internal.useFx
class KScienceExtension(val project: Project) { enum class FXModule(val artifact: String, vararg val dependencies: FXModule) {
enum class FXModule(val artifact: String, vararg val dependencies: FXModule) {
BASE("javafx-base"), BASE("javafx-base"),
GRAPHICS("javafx-graphics", BASE), GRAPHICS("javafx-graphics", BASE),
CONTROLS("javafx-controls", GRAPHICS, BASE), CONTROLS("javafx-controls", GRAPHICS, BASE),
@ -22,24 +20,27 @@ class KScienceExtension(val project: Project) {
MEDIA("javafx-media", GRAPHICS, BASE), MEDIA("javafx-media", GRAPHICS, BASE),
SWING("javafx-swing", GRAPHICS, BASE), SWING("javafx-swing", GRAPHICS, BASE),
WEB("javafx-web", CONTROLS, GRAPHICS, BASE) WEB("javafx-web", CONTROLS, GRAPHICS, BASE)
} }
enum class FXPlatform(val id: String) { enum class FXPlatform(val id: String) {
WINDOWS("win"), WINDOWS("win"),
LINUX("linux"), LINUX("linux"),
MAC("mac") MAC("mac")
} }
enum class DependencyConfiguration { enum class DependencyConfiguration {
API, API,
IMPLEMENTATION, IMPLEMENTATION,
COMPILE_ONLY COMPILE_ONLY
} }
enum class DependencySourceSet(val setName: String, val suffix: String) { enum class DependencySourceSet(val setName: String, val suffix: String) {
MAIN("main", "Main"), MAIN("main", "Main"),
TEST("test", "Test") TEST("test", "Test")
} }
class KScienceExtension(val project: Project) {
fun useCoroutines( fun useCoroutines(
version: String = KScienceVersions.coroutinesVersion, version: String = KScienceVersions.coroutinesVersion,

View File

@ -3,8 +3,6 @@ package ru.mipt.npm.gradle
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.maven import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.repositories 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.useCommonDependency
import ru.mipt.npm.gradle.internal.useDependency import ru.mipt.npm.gradle.internal.useDependency

View File

@ -6,8 +6,8 @@ import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import ru.mipt.npm.gradle.KScienceExtension.DependencyConfiguration import ru.mipt.npm.gradle.DependencyConfiguration
import ru.mipt.npm.gradle.KScienceExtension.DependencySourceSet import ru.mipt.npm.gradle.DependencySourceSet
internal fun Project.useDependency( internal fun Project.useDependency(
vararg pairs: Pair<String, String>, vararg pairs: Pair<String, String>,

View File

@ -6,7 +6,9 @@ import org.gradle.kotlin.dsl.findByType
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler 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 { val defaultPlatform: FXPlatform = when {
Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS
@ -36,7 +38,7 @@ internal fun Project.useFx(
configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY, configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY,
version: String = "14", version: String = "14",
platform: FXPlatform = defaultPlatform platform: FXPlatform = defaultPlatform
): Unit = afterEvaluate{ ): Unit = afterEvaluate {
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
extensions.findByType<KotlinMultiplatformExtension>()?.apply { extensions.findByType<KotlinMultiplatformExtension>()?.apply {
sourceSets.findByName("jvmMain")?.apply { sourceSets.findByName("jvmMain")?.apply {