kotlin.script.experimental.jvm.compat.expectedLocationUtil.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-main-kts Show documentation
Show all versions of kotlin-main-kts Show documentation
Kotlin "main" script definition
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("DEPRECATION")
package kotlin.script.experimental.jvm.compat
import kotlin.script.experimental.api.ScriptAcceptedLocation
import kotlin.script.experimental.location.ScriptExpectedLocation
fun List.mapToLegacyExpectedLocations(): List = map {
when (it) {
ScriptAcceptedLocation.Sources -> ScriptExpectedLocation.SourcesOnly
ScriptAcceptedLocation.Tests -> ScriptExpectedLocation.TestsOnly
ScriptAcceptedLocation.Libraries -> ScriptExpectedLocation.Libraries
ScriptAcceptedLocation.Project -> ScriptExpectedLocation.Project
ScriptAcceptedLocation.Everywhere -> ScriptExpectedLocation.Everywhere
}
}
fun List.mapLegacyExpectedLocations(): List = map {
when (it) {
ScriptExpectedLocation.SourcesOnly -> ScriptAcceptedLocation.Sources
ScriptExpectedLocation.TestsOnly -> ScriptAcceptedLocation.Tests
ScriptExpectedLocation.Libraries -> ScriptAcceptedLocation.Libraries
ScriptExpectedLocation.Project -> ScriptAcceptedLocation.Project
ScriptExpectedLocation.Everywhere -> ScriptAcceptedLocation.Everywhere
}
}