[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
|
||||
fun testSettingGenerationMode() = with(platformLibrariesProject("linuxX64")) {
|
||||
// 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
|
||||
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.
|
||||
* 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 distributionType: NativeDistributionType
|
||||
get() = NativeDistributionTypeProvider(project).getDistributionType(compilerVersion)
|
||||
get() = NativeDistributionTypeProvider(project).getDistributionType()
|
||||
|
||||
private val simpleOsName: String
|
||||
get() = HostManager.platformName()
|
||||
@@ -207,8 +207,8 @@ internal fun Project.setupNativeCompiler(konanTarget: KonanTarget) {
|
||||
logger.info("User-provided Kotlin/Native distribution: $konanHome")
|
||||
}
|
||||
|
||||
val distributionType = NativeDistributionTypeProvider(project).getDistributionType(konanVersion)
|
||||
val distributionType = NativeDistributionTypeProvider(project).getDistributionType()
|
||||
if (distributionType.mustGeneratePlatformLibs) {
|
||||
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) {
|
||||
LIGHT(null, true),
|
||||
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) {
|
||||
@@ -25,42 +21,15 @@ internal class NativeDistributionTypeProvider(private val project: Project) {
|
||||
|
||||
private fun warning(message: String) = SingleWarningPerBuild.show(project, "Warning: $message")
|
||||
|
||||
private fun chooseDistributionType(
|
||||
prebuiltType: NativeDistributionType,
|
||||
lightType: NativeDistributionType,
|
||||
defaultType: NativeDistributionType
|
||||
): NativeDistributionType {
|
||||
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
|
||||
fun getDistributionType(): NativeDistributionType {
|
||||
return when (propertiesProvider.nativeDistributionType?.toLowerCaseAsciiOnly()) {
|
||||
null -> PREBUILT
|
||||
"prebuilt" -> PREBUILT
|
||||
"light" -> LIGHT
|
||||
else -> {
|
||||
warning("Unknown Kotlin/Native distribution type: $requestedByUser. Available values: prebuilt, light")
|
||||
defaultType
|
||||
warning("Unknown Kotlin/Native distribution type: ${propertiesProvider.nativeDistributionType?.toLowerCaseAsciiOnly()}. Available values: prebuilt, light")
|
||||
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