[mpp] Minor: drop support for "kotlin.native.restrictedDistribution"
This commit is contained in:
-10
@@ -173,16 +173,6 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testDeprecatedRestrictedDistributionProperty() = with(platformLibrariesProject("linuxX64")) {
|
|
||||||
// We allow using this deprecated property for 1.4 too. Just download the distribution without platform libs in this case.
|
|
||||||
build("tasks", "-Pkotlin.native.restrictedDistribution=true") {
|
|
||||||
assertSuccessful()
|
|
||||||
assertContains("Warning: Project property 'kotlin.native.restrictedDistribution' is deprecated. Please use 'kotlin.native.distribution.type=light' instead")
|
|
||||||
assertContainsRegex("Kotlin/Native distribution: .*kotlin-native-$platformName".toRegex())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSettingGenerationMode() = with(platformLibrariesProject("linuxX64")) {
|
fun testSettingGenerationMode() = with(platformLibrariesProject("linuxX64")) {
|
||||||
// Check that user can change generation mode used by the cinterop tool.
|
// Check that user can change generation mode used by the cinterop tool.
|
||||||
|
|||||||
-6
@@ -314,12 +314,6 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
|||||||
val nativeDownloadFromMaven: Boolean
|
val nativeDownloadFromMaven: Boolean
|
||||||
get() = this.booleanProperty("kotlin.native.distribution.downloadFromMaven") ?: false
|
get() = this.booleanProperty("kotlin.native.distribution.downloadFromMaven") ?: false
|
||||||
|
|
||||||
/**
|
|
||||||
* A property that was used to choose a restricted distribution in 1.3.
|
|
||||||
*/
|
|
||||||
val nativeDeprecatedRestricted: Boolean?
|
|
||||||
get() = booleanProperty("kotlin.native.restrictedDistribution")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows a user to force a particular cinterop mode for platform libraries generation. Available modes: sourcecode, metadata.
|
* Allows a user to force a particular cinterop mode for platform libraries generation. Available modes: sourcecode, metadata.
|
||||||
* A main purpose of this property is working around potential problems with the metadata mode.
|
* A main purpose of this property is working around potential problems with the metadata mode.
|
||||||
|
|||||||
+3
-3
@@ -48,7 +48,7 @@ class NativeCompilerDownloader(
|
|||||||
private val kotlinProperties get() = PropertiesProvider(project)
|
private val kotlinProperties get() = PropertiesProvider(project)
|
||||||
|
|
||||||
private val distributionType: NativeDistributionType
|
private val distributionType: NativeDistributionType
|
||||||
get() = NativeDistributionTypeProvider(project).getDistributionType(compilerVersion)
|
get() = NativeDistributionTypeProvider(project).getDistributionType()
|
||||||
|
|
||||||
private val simpleOsName: String
|
private val simpleOsName: String
|
||||||
get() = HostManager.platformName()
|
get() = HostManager.platformName()
|
||||||
@@ -207,8 +207,8 @@ internal fun Project.setupNativeCompiler(konanTarget: KonanTarget) {
|
|||||||
logger.info("User-provided Kotlin/Native distribution: $konanHome")
|
logger.info("User-provided Kotlin/Native distribution: $konanHome")
|
||||||
}
|
}
|
||||||
|
|
||||||
val distributionType = NativeDistributionTypeProvider(project).getDistributionType(konanVersion)
|
val distributionType = NativeDistributionTypeProvider(project).getDistributionType()
|
||||||
if (distributionType.mustGeneratePlatformLibs) {
|
if (distributionType.mustGeneratePlatformLibs) {
|
||||||
PlatformLibrariesGenerator(project, konanTarget).generatePlatformLibsIfNeeded()
|
PlatformLibrariesGenerator(project, konanTarget).generatePlatformLibsIfNeeded()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-38
@@ -14,10 +14,6 @@ import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
|||||||
internal enum class NativeDistributionType(val suffix: String?, val mustGeneratePlatformLibs: Boolean) {
|
internal enum class NativeDistributionType(val suffix: String?, val mustGeneratePlatformLibs: Boolean) {
|
||||||
LIGHT(null, true),
|
LIGHT(null, true),
|
||||||
PREBUILT("prebuilt", false),
|
PREBUILT("prebuilt", false),
|
||||||
|
|
||||||
// Distribution types for 1.3:
|
|
||||||
LIGHT_1_3("restricted", false), // aka "restricted" distribution without platform libs for Apple targets.
|
|
||||||
PREBUILT_1_3(null, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class NativeDistributionTypeProvider(private val project: Project) {
|
internal class NativeDistributionTypeProvider(private val project: Project) {
|
||||||
@@ -25,42 +21,15 @@ internal class NativeDistributionTypeProvider(private val project: Project) {
|
|||||||
|
|
||||||
private fun warning(message: String) = SingleWarningPerBuild.show(project, "Warning: $message")
|
private fun warning(message: String) = SingleWarningPerBuild.show(project, "Warning: $message")
|
||||||
|
|
||||||
private fun chooseDistributionType(
|
fun getDistributionType(): NativeDistributionType {
|
||||||
prebuiltType: NativeDistributionType,
|
return when (propertiesProvider.nativeDistributionType?.toLowerCaseAsciiOnly()) {
|
||||||
lightType: NativeDistributionType,
|
null -> PREBUILT
|
||||||
defaultType: NativeDistributionType
|
"prebuilt" -> PREBUILT
|
||||||
): NativeDistributionType {
|
"light" -> LIGHT
|
||||||
val requestedByUser = propertiesProvider.nativeDistributionType?.toLowerCaseAsciiOnly()
|
|
||||||
val deprecatedRestricted = propertiesProvider.nativeDeprecatedRestricted
|
|
||||||
|
|
||||||
// A case when a deprecated property (kotlin.native.restrictedDistribution) is used to choose the restricted distribution.
|
|
||||||
// Effectively the restricted distribution from 1.3 and the light distribution from 1.4 are the same,
|
|
||||||
// so we allow user to specify kotlin.native.restrictedDistribution in both 1.3 and 1.4
|
|
||||||
if (requestedByUser == null && deprecatedRestricted != null) {
|
|
||||||
return if (deprecatedRestricted) {
|
|
||||||
lightType
|
|
||||||
} else {
|
|
||||||
defaultType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// A normal path: no deprecated properties, only kotlin.native.distribution.type.
|
|
||||||
return when (requestedByUser) {
|
|
||||||
null -> defaultType
|
|
||||||
"prebuilt" -> prebuiltType
|
|
||||||
"light" -> lightType
|
|
||||||
else -> {
|
else -> {
|
||||||
warning("Unknown Kotlin/Native distribution type: $requestedByUser. Available values: prebuilt, light")
|
warning("Unknown Kotlin/Native distribution type: ${propertiesProvider.nativeDistributionType?.toLowerCaseAsciiOnly()}. Available values: prebuilt, light")
|
||||||
defaultType
|
PREBUILT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDistributionType(version: String): NativeDistributionType {
|
|
||||||
if (propertiesProvider.nativeDeprecatedRestricted != null) {
|
|
||||||
warning("Project property 'kotlin.native.restrictedDistribution' is deprecated. Please use 'kotlin.native.distribution.type=light' instead")
|
|
||||||
}
|
|
||||||
|
|
||||||
return chooseDistributionType(prebuiltType = PREBUILT, lightType = LIGHT, defaultType = PREBUILT)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user