Fix compilation warnings in 'pill-importer' project
These warnings have fail compilation with bootstrap.
This commit is contained in:
+3
-2
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
fun main() {
|
||||
generateAbstractKotlinArtifactsExtensionImplementation()
|
||||
@@ -58,9 +59,9 @@ private fun generateAbstractKotlinArtifactsExtensionImplementation() {
|
||||
val name = nameParts.drop(1).joinToString(
|
||||
separator = "",
|
||||
prefix = nameParts.first(),
|
||||
transform = String::capitalize
|
||||
transform = String::capitalizeUS
|
||||
)
|
||||
"val $name = KonanTarget.${it.name.toUpperCase()}"
|
||||
"val $name = KonanTarget.${it.name.uppercase(Locale.US)}"
|
||||
}.indented(4)
|
||||
|
||||
val code = listOf(
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ package org.jetbrains.kotlin.generators.gradle.dsl
|
||||
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.presetName
|
||||
import java.util.*
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.writeText
|
||||
@@ -96,7 +97,7 @@ private fun allVariantConstructors() = allKonanTargets()
|
||||
|
||||
private val KonanTarget.variantClassName
|
||||
get() = presetName
|
||||
.capitalize()
|
||||
.capitalizeUS()
|
||||
.let { "Kotlin${it}Variant" }
|
||||
|
||||
private val KonanTarget.className get() = javaClass.simpleName
|
||||
+2
-2
@@ -33,8 +33,8 @@ private fun binaryType(
|
||||
typeName("$MPP_PACKAGE.$className"),
|
||||
typeName("${nativeOutputKindClass.fqName}.$outputKind"),
|
||||
baseMethodName,
|
||||
"get${baseMethodName.capitalize()}",
|
||||
"find${baseMethodName.capitalize()}",
|
||||
"get${baseMethodName.capitalizeUS()}",
|
||||
"find${baseMethodName.capitalizeUS()}",
|
||||
defaultBaseName
|
||||
)
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.generators.gradle.dsl
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun String.capitalizeUS() = replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.US) else it.toString() }
|
||||
@@ -91,14 +91,14 @@ class JpsCompatiblePluginTasks(
|
||||
fun pill() {
|
||||
initEnvironment(rootProject)
|
||||
|
||||
val variantOptionValue = System.getProperty("pill.variant", "base").toUpperCase()
|
||||
val variantOptionValue = System.getProperty("pill.variant", "base").uppercase(Locale.US)
|
||||
val variant = PillExtensionMirror.Variant.values().firstOrNull { it.name == variantOptionValue }
|
||||
?: run {
|
||||
rootProject.logger.error("Invalid variant name: $variantOptionValue")
|
||||
return
|
||||
}
|
||||
|
||||
rootProject.logger.lifecycle("Pill: Setting up project for the '${variant.name.toLowerCase()}' variant...")
|
||||
rootProject.logger.lifecycle("Pill: Setting up project for the '${variant.name.lowercase(Locale.US)}' variant...")
|
||||
|
||||
val modulePrefix = System.getProperty("pill.module.prefix", "")
|
||||
val modelParser = ModelParser(variant, modulePrefix)
|
||||
@@ -161,14 +161,14 @@ class JpsCompatiblePluginTasks(
|
||||
private fun removeJpsAndPillRunConfigurations() {
|
||||
File(projectDir, ".idea/runConfigurations")
|
||||
.walk()
|
||||
.filter { (it.name.startsWith("JPS_") || it.name.startsWith("Pill_")) && it.extension.toLowerCase() == "xml" }
|
||||
.filter { (it.name.startsWith("JPS_") || it.name.startsWith("Pill_")) && it.extension.lowercase(Locale.US) == "xml" }
|
||||
.forEach { it.delete() }
|
||||
}
|
||||
|
||||
private fun removeArtifactConfigurations() {
|
||||
File(projectDir, ".idea/artifacts")
|
||||
.walk()
|
||||
.filter { it.extension.toLowerCase() == "xml" && ALLOWED_ARTIFACT_PATTERNS.none { p -> p.matches(it.name) } }
|
||||
.filter { it.extension.lowercase(Locale.US) == "xml" && ALLOWED_ARTIFACT_PATTERNS.none { p -> p.matches(it.name) } }
|
||||
.forEach { it.delete() }
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.gradle.api.Project
|
||||
import org.jetbrains.kotlin.pill.model.PModule
|
||||
import org.jetbrains.kotlin.pill.model.PProject
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
private val USER_HOME_DIR_PATH = System.getProperty("user.home").withSlash()
|
||||
|
||||
@@ -29,7 +30,7 @@ interface PathContext {
|
||||
|
||||
fun url(file: File): Pair<String, String> {
|
||||
val path = when {
|
||||
file.isFile && file.extension.toLowerCase() == "jar" -> "jar://" + this(file) + "!/"
|
||||
file.isFile && file.extension.lowercase(Locale.US) == "jar" -> "jar://" + this(file) + "!/"
|
||||
else -> "file://" + this(file)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user