[Gradle] Replace toLowerCase/toUpperCase with ASCII-only variants
^KT-38712 Verification Pending
This commit is contained in:
committed by
Space Team
parent
afb2bfe492
commit
36591ab8a0
+1
-1
@@ -27,7 +27,7 @@ enum class KotlinJsCompilerType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val KotlinJsCompilerType.lowerName
|
val KotlinJsCompilerType.lowerName
|
||||||
get() = name.toLowerCase()
|
get() = name.toLowerCase(Locale.ENGLISH)
|
||||||
|
|
||||||
fun String.removeJsCompilerSuffix(compilerType: KotlinJsCompilerType): String {
|
fun String.removeJsCompilerSuffix(compilerType: KotlinJsCompilerType): String {
|
||||||
val truncatedString = removeSuffix(compilerType.lowerName)
|
val truncatedString = removeSuffix(compilerType.lowerName)
|
||||||
|
|||||||
+2
-1
@@ -10,6 +10,7 @@ import org.gradle.api.Named
|
|||||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||||
import org.jetbrains.kotlin.konan.target.Family.*
|
import org.jetbrains.kotlin.konan.target.Family.*
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
enum class NativeBuildType(
|
enum class NativeBuildType(
|
||||||
val optimized: Boolean,
|
val optimized: Boolean,
|
||||||
@@ -18,7 +19,7 @@ enum class NativeBuildType(
|
|||||||
RELEASE(true, false),
|
RELEASE(true, false),
|
||||||
DEBUG(false, true);
|
DEBUG(false, true);
|
||||||
|
|
||||||
override fun getName(): String = name.toLowerCase()
|
override fun getName(): String = name.toLowerCase(Locale.ENGLISH)
|
||||||
|
|
||||||
@Suppress("UNUSED_PARAMETER")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
|
|||||||
+2
-1
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.daemon.client.launchProcessWithFallback
|
|||||||
import org.jetbrains.kotlin.gradle.logging.GradleErrorMessageCollector
|
import org.jetbrains.kotlin.gradle.logging.GradleErrorMessageCollector
|
||||||
import org.jetbrains.kotlin.gradle.logging.GradleKotlinLogger
|
import org.jetbrains.kotlin.gradle.logging.GradleKotlinLogger
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilerExecutionStrategy
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilerExecutionStrategy
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||||
import org.jetbrains.org.objectweb.asm.FieldVisitor
|
import org.jetbrains.org.objectweb.asm.FieldVisitor
|
||||||
@@ -59,7 +60,7 @@ internal fun loadCompilerVersion(compilerClasspath: Iterable<File>): String {
|
|||||||
try {
|
try {
|
||||||
val versionClassFileName = KotlinCompilerVersion::class.java.name.replace('.', '/') + ".class"
|
val versionClassFileName = KotlinCompilerVersion::class.java.name.replace('.', '/') + ".class"
|
||||||
for (cpFile in compilerClasspath) {
|
for (cpFile in compilerClasspath) {
|
||||||
if (cpFile.isFile && cpFile.extension.toLowerCase() == "jar") {
|
if (cpFile.isFile && cpFile.extension.toLowerCaseAsciiOnly() == "jar") {
|
||||||
ZipFile(cpFile).use { jar ->
|
ZipFile(cpFile).use { jar ->
|
||||||
val versionFileEntry = jar.getEntry(KotlinCompilerVersion.VERSION_FILE_PATH)
|
val versionFileEntry = jar.getEntry(KotlinCompilerVersion.VERSION_FILE_PATH)
|
||||||
if (versionFileEntry != null) {
|
if (versionFileEntry != null) {
|
||||||
|
|||||||
+11
-10
@@ -4,6 +4,7 @@ import org.gradle.api.Action
|
|||||||
import org.gradle.api.DomainObjectSet
|
import org.gradle.api.DomainObjectSet
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly
|
||||||
|
|
||||||
// DO NOT EDIT MANUALLY! Generated by org.jetbrains.kotlin.generators.gradle.dsl.MppNativeBinaryDSLCodegenKt
|
// DO NOT EDIT MANUALLY! Generated by org.jetbrains.kotlin.generators.gradle.dsl.MppNativeBinaryDSLCodegenKt
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns an executable with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns an executable with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getExecutable(namePrefix: String, buildType: String): Executable =
|
fun getExecutable(namePrefix: String, buildType: String): Executable =
|
||||||
getExecutable(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
getExecutable(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns an executable with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns an executable with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getExecutable(buildType: NativeBuildType): Executable = getExecutable("", buildType)
|
fun getExecutable(buildType: NativeBuildType): Executable = getExecutable("", buildType)
|
||||||
@@ -55,7 +56,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns an executable with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
/** Returns an executable with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
||||||
fun findExecutable(namePrefix: String, buildType: String): Executable? =
|
fun findExecutable(namePrefix: String, buildType: String): Executable? =
|
||||||
findExecutable(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
findExecutable(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns an executable with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
/** Returns an executable with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
||||||
fun findExecutable(buildType: NativeBuildType): Executable? = findExecutable("", buildType)
|
fun findExecutable(buildType: NativeBuildType): Executable? = findExecutable("", buildType)
|
||||||
@@ -68,7 +69,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns a static library with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns a static library with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getStaticLib(namePrefix: String, buildType: String): StaticLibrary =
|
fun getStaticLib(namePrefix: String, buildType: String): StaticLibrary =
|
||||||
getStaticLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
getStaticLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns a static library with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns a static library with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getStaticLib(buildType: NativeBuildType): StaticLibrary = getStaticLib("", buildType)
|
fun getStaticLib(buildType: NativeBuildType): StaticLibrary = getStaticLib("", buildType)
|
||||||
@@ -81,7 +82,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns a static library with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
/** Returns a static library with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
||||||
fun findStaticLib(namePrefix: String, buildType: String): StaticLibrary? =
|
fun findStaticLib(namePrefix: String, buildType: String): StaticLibrary? =
|
||||||
findStaticLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
findStaticLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns a static library with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
/** Returns a static library with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
||||||
fun findStaticLib(buildType: NativeBuildType): StaticLibrary? = findStaticLib("", buildType)
|
fun findStaticLib(buildType: NativeBuildType): StaticLibrary? = findStaticLib("", buildType)
|
||||||
@@ -94,7 +95,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns a shared library with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns a shared library with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getSharedLib(namePrefix: String, buildType: String): SharedLibrary =
|
fun getSharedLib(namePrefix: String, buildType: String): SharedLibrary =
|
||||||
getSharedLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
getSharedLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns a shared library with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns a shared library with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getSharedLib(buildType: NativeBuildType): SharedLibrary = getSharedLib("", buildType)
|
fun getSharedLib(buildType: NativeBuildType): SharedLibrary = getSharedLib("", buildType)
|
||||||
@@ -107,7 +108,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns a shared library with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
/** Returns a shared library with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
||||||
fun findSharedLib(namePrefix: String, buildType: String): SharedLibrary? =
|
fun findSharedLib(namePrefix: String, buildType: String): SharedLibrary? =
|
||||||
findSharedLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
findSharedLib(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns a shared library with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
/** Returns a shared library with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
||||||
fun findSharedLib(buildType: NativeBuildType): SharedLibrary? = findSharedLib("", buildType)
|
fun findSharedLib(buildType: NativeBuildType): SharedLibrary? = findSharedLib("", buildType)
|
||||||
@@ -120,7 +121,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns an Objective-C framework with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns an Objective-C framework with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getFramework(namePrefix: String, buildType: String): Framework =
|
fun getFramework(namePrefix: String, buildType: String): Framework =
|
||||||
getFramework(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
getFramework(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns an Objective-C framework with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns an Objective-C framework with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getFramework(buildType: NativeBuildType): Framework = getFramework("", buildType)
|
fun getFramework(buildType: NativeBuildType): Framework = getFramework("", buildType)
|
||||||
@@ -133,7 +134,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns an Objective-C framework with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
/** Returns an Objective-C framework with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
||||||
fun findFramework(namePrefix: String, buildType: String): Framework? =
|
fun findFramework(namePrefix: String, buildType: String): Framework? =
|
||||||
findFramework(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
findFramework(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns an Objective-C framework with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
/** Returns an Objective-C framework with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
||||||
fun findFramework(buildType: NativeBuildType): Framework? = findFramework("", buildType)
|
fun findFramework(buildType: NativeBuildType): Framework? = findFramework("", buildType)
|
||||||
@@ -146,7 +147,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns a test executable with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns a test executable with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getTest(namePrefix: String, buildType: String): TestExecutable =
|
fun getTest(namePrefix: String, buildType: String): TestExecutable =
|
||||||
getTest(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
getTest(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns a test executable with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
/** Returns a test executable with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
|
||||||
fun getTest(buildType: NativeBuildType): TestExecutable = getTest("", buildType)
|
fun getTest(buildType: NativeBuildType): TestExecutable = getTest("", buildType)
|
||||||
@@ -159,7 +160,7 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
|
|||||||
|
|
||||||
/** Returns a test executable with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
/** Returns a test executable with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
|
||||||
fun findTest(namePrefix: String, buildType: String): TestExecutable? =
|
fun findTest(namePrefix: String, buildType: String): TestExecutable? =
|
||||||
findTest(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
|
findTest(namePrefix, NativeBuildType.valueOf(buildType.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/** Returns a test executable with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
/** Returns a test executable with the empty name prefix and the given build type. Returns null if there is no such binary. */
|
||||||
fun findTest(buildType: NativeBuildType): TestExecutable? = findTest("", buildType)
|
fun findTest(buildType: NativeBuildType): TestExecutable? = findTest("", buildType)
|
||||||
|
|||||||
+2
-1
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.gradle.internal.kapt.incremental.KaptIncrementalChan
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.Kapt
|
import org.jetbrains.kotlin.gradle.tasks.Kapt
|
||||||
import org.jetbrains.kotlin.gradle.tasks.toSingleCompilerPluginOptions
|
import org.jetbrains.kotlin.gradle.tasks.toSingleCompilerPluginOptions
|
||||||
import org.jetbrains.kotlin.gradle.utils.listPropertyWithConvention
|
import org.jetbrains.kotlin.gradle.utils.listPropertyWithConvention
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import org.jetbrains.kotlin.utils.PathUtil
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -157,7 +158,7 @@ abstract class KaptWithoutKotlincTask @Inject constructor(
|
|||||||
// as user may set JDK with same major Java version, but from different vendor
|
// as user may set JDK with same major Java version, but from different vendor
|
||||||
val isRunningOnGradleJvm = gradleJvm.javaVersion == toolchainProvider.javaVersion.get() &&
|
val isRunningOnGradleJvm = gradleJvm.javaVersion == toolchainProvider.javaVersion.get() &&
|
||||||
gradleJvm.javaExecutable.absolutePath == toolchainProvider.javaExecutable.get().asFile.absolutePath
|
gradleJvm.javaExecutable.absolutePath == toolchainProvider.javaExecutable.get().asFile.absolutePath
|
||||||
val isolationModeStr = getValue("kapt.workers.isolation")?.toLowerCase()
|
val isolationModeStr = getValue("kapt.workers.isolation")?.toLowerCaseAsciiOnly()
|
||||||
return when {
|
return when {
|
||||||
(isolationModeStr == null || isolationModeStr == "none") && isRunningOnGradleJvm -> IsolationMode.NONE
|
(isolationModeStr == null || isolationModeStr == "none") && isRunningOnGradleJvm -> IsolationMode.NONE
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
+3
-2
@@ -9,6 +9,7 @@ import org.gradle.api.artifacts.transform.*
|
|||||||
import org.gradle.api.file.FileSystemLocation
|
import org.gradle.api.file.FileSystemLocation
|
||||||
import org.gradle.api.provider.Provider
|
import org.gradle.api.provider.Provider
|
||||||
import org.gradle.api.tasks.Classpath
|
import org.gradle.api.tasks.Classpath
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||||
import org.jetbrains.org.objectweb.asm.ClassWriter
|
import org.jetbrains.org.objectweb.asm.ClassWriter
|
||||||
import java.io.*
|
import java.io.*
|
||||||
@@ -72,7 +73,7 @@ private fun visitDirectory(directory: File): ClasspathEntryData {
|
|||||||
|
|
||||||
directory.walk().filter {
|
directory.walk().filter {
|
||||||
it.extension == "class"
|
it.extension == "class"
|
||||||
&& !it.relativeTo(directory).toString().toLowerCase().startsWith("meta-inf")
|
&& !it.relativeTo(directory).toString().toLowerCaseAsciiOnly().startsWith("meta-inf")
|
||||||
&& it.name != MODULE_INFO
|
&& it.name != MODULE_INFO
|
||||||
}.forEach {
|
}.forEach {
|
||||||
val internalName = it.relativeTo(directory).invariantSeparatorsPath.dropLast(".class".length)
|
val internalName = it.relativeTo(directory).invariantSeparatorsPath.dropLast(".class".length)
|
||||||
@@ -93,7 +94,7 @@ private fun visitJar(jar: File): ClasspathEntryData {
|
|||||||
val entry = entries.nextElement()
|
val entry = entries.nextElement()
|
||||||
|
|
||||||
if (entry.name.endsWith("class")
|
if (entry.name.endsWith("class")
|
||||||
&& !entry.name.toLowerCase().startsWith("meta-inf")
|
&& !entry.name.toLowerCaseAsciiOnly().startsWith("meta-inf")
|
||||||
&& entry.name != MODULE_INFO
|
&& entry.name != MODULE_INFO
|
||||||
) {
|
) {
|
||||||
BufferedInputStream(zipFile.getInputStream(entry)).use { inputStream ->
|
BufferedInputStream(zipFile.getInputStream(entry)).use { inputStream ->
|
||||||
|
|||||||
+3
-2
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.locateOrRegisterTask
|
import org.jetbrains.kotlin.gradle.tasks.locateOrRegisterTask
|
||||||
import org.jetbrains.kotlin.gradle.tasks.registerTask
|
import org.jetbrains.kotlin.gradle.tasks.registerTask
|
||||||
import org.jetbrains.kotlin.gradle.utils.*
|
import org.jetbrains.kotlin.gradle.utils.*
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
import kotlin.reflect.KMutableProperty1
|
import kotlin.reflect.KMutableProperty1
|
||||||
import kotlin.reflect.full.memberProperties
|
import kotlin.reflect.full.memberProperties
|
||||||
@@ -289,7 +290,7 @@ abstract class KotlinOnlyTargetConfigurator<KotlinCompilationType : KotlinCompil
|
|||||||
target.compilations.all { compilation ->
|
target.compilations.all { compilation ->
|
||||||
buildCompilationProcessor(compilation).run()
|
buildCompilationProcessor(compilation).run()
|
||||||
if (compilation.isMain()) {
|
if (compilation.isMain()) {
|
||||||
sourcesJarTask(compilation, target.targetName, target.targetName.toLowerCase())
|
sourcesJarTask(compilation, target.targetName, target.targetName.toLowerCaseAsciiOnly())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,7 +316,7 @@ abstract class KotlinOnlyTargetConfigurator<KotlinCompilationType : KotlinCompil
|
|||||||
|
|
||||||
target.disambiguationClassifier?.let { classifier ->
|
target.disambiguationClassifier?.let { classifier ->
|
||||||
task.configure { taskInstance ->
|
task.configure { taskInstance ->
|
||||||
taskInstance.archiveAppendix.set(classifier.toLowerCase())
|
taskInstance.archiveAppendix.set(classifier.toLowerCaseAsciiOnly())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -38,6 +38,8 @@ import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
|||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
import org.jetbrains.kotlin.konan.target.presetName
|
import org.jetbrains.kotlin.konan.target.presetName
|
||||||
import org.jetbrains.kotlin.statistics.metrics.StringMetrics
|
import org.jetbrains.kotlin.statistics.metrics.StringMetrics
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly
|
||||||
import org.jetbrains.kotlin.util.prefixIfNot
|
import org.jetbrains.kotlin.util.prefixIfNot
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -434,7 +436,9 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
|||||||
get() = this.property("kotlin.daemon.jvmargs")
|
get() = this.property("kotlin.daemon.jvmargs")
|
||||||
|
|
||||||
val kotlinCompilerExecutionStrategy: KotlinCompilerExecutionStrategy
|
val kotlinCompilerExecutionStrategy: KotlinCompilerExecutionStrategy
|
||||||
get() = KotlinCompilerExecutionStrategy.fromProperty(this.property("kotlin.compiler.execution.strategy")?.toLowerCase())
|
get() = KotlinCompilerExecutionStrategy.fromProperty(
|
||||||
|
this.property("kotlin.compiler.execution.strategy")?.toLowerCaseAsciiOnly()
|
||||||
|
)
|
||||||
|
|
||||||
val kotlinDaemonUseFallbackStrategy: Boolean
|
val kotlinDaemonUseFallbackStrategy: Boolean
|
||||||
get() = booleanProperty("kotlin.daemon.useFallbackStrategy") ?: true
|
get() = booleanProperty("kotlin.daemon.useFallbackStrategy") ?: true
|
||||||
@@ -460,7 +464,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
|||||||
private inline fun <reified T : Enum<T>> enumProperty(
|
private inline fun <reified T : Enum<T>> enumProperty(
|
||||||
propName: String,
|
propName: String,
|
||||||
defaultValue: T
|
defaultValue: T
|
||||||
): T = this.property(propName)?.let { enumValueOf<T>(it.toUpperCase()) } ?: defaultValue
|
): T = this.property(propName)?.let { enumValueOf<T>(it.toUpperCaseAsciiOnly()) } ?: defaultValue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up the property in the following sources with decreasing priority:
|
* Looks up the property in the following sources with decreasing priority:
|
||||||
|
|||||||
+5
-1
@@ -72,7 +72,11 @@ abstract class AbstractKotlinTarget(
|
|||||||
targetName
|
targetName
|
||||||
else PRIMARY_SINGLE_COMPONENT_NAME
|
else PRIMARY_SINGLE_COMPONENT_NAME
|
||||||
|
|
||||||
val sourcesArtifact = configureSourcesJarArtifact(mainCompilation, componentName, dashSeparatedName(targetName.toLowerCase()))
|
val sourcesArtifact = configureSourcesJarArtifact(
|
||||||
|
mainCompilation,
|
||||||
|
componentName,
|
||||||
|
dashSeparatedName(targetName.toLowerCaseAsciiOnly())
|
||||||
|
)
|
||||||
if (sourcesArtifact != null) {
|
if (sourcesArtifact != null) {
|
||||||
usageContexts += DefaultKotlinUsageContext(
|
usageContexts += DefaultKotlinUsageContext(
|
||||||
compilation = mainCompilation,
|
compilation = mainCompilation,
|
||||||
|
|||||||
+2
-1
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.gradle.targets.metadata.COMMON_MAIN_ELEMENTS_CONFIGU
|
|||||||
import org.jetbrains.kotlin.gradle.targets.metadata.isCompatibilityMetadataVariantEnabled
|
import org.jetbrains.kotlin.gradle.targets.metadata.isCompatibilityMetadataVariantEnabled
|
||||||
import org.jetbrains.kotlin.gradle.targets.metadata.isKotlinGranularMetadataEnabled
|
import org.jetbrains.kotlin.gradle.targets.metadata.isKotlinGranularMetadataEnabled
|
||||||
import org.jetbrains.kotlin.gradle.utils.setProperty
|
import org.jetbrains.kotlin.gradle.utils.setProperty
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
|
||||||
abstract class KotlinSoftwareComponent(
|
abstract class KotlinSoftwareComponent(
|
||||||
private val project: Project,
|
private val project: Project,
|
||||||
@@ -107,7 +108,7 @@ abstract class KotlinSoftwareComponent(
|
|||||||
name,
|
name,
|
||||||
project,
|
project,
|
||||||
lazy { allPublishableCommonSourceSets().associate { it.name to it.kotlin } },
|
lazy { allPublishableCommonSourceSets().associate { it.name to it.kotlin } },
|
||||||
name.toLowerCase()
|
name.toLowerCaseAsciiOnly()
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun addSourcesJarArtifactToConfiguration(configurationName: String): PublishArtifact {
|
private fun addSourcesJarArtifactToConfiguration(configurationName: String): PublishArtifact {
|
||||||
|
|||||||
+2
-1
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.gradle.tasks.locateOrRegisterTask
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.registerTask
|
import org.jetbrains.kotlin.gradle.tasks.registerTask
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
private object XcodeEnvironment {
|
private object XcodeEnvironment {
|
||||||
@@ -35,7 +36,7 @@ private object XcodeEnvironment {
|
|||||||
get() {
|
get() {
|
||||||
val configuration = System.getenv("CONFIGURATION") ?: return null
|
val configuration = System.getenv("CONFIGURATION") ?: return null
|
||||||
|
|
||||||
fun String.toNativeBuildType() = when (this.toLowerCase()) {
|
fun String.toNativeBuildType() = when (this.toLowerCaseAsciiOnly()) {
|
||||||
"debug" -> NativeBuildType.DEBUG
|
"debug" -> NativeBuildType.DEBUG
|
||||||
"release" -> NativeBuildType.RELEASE
|
"release" -> NativeBuildType.RELEASE
|
||||||
else -> null
|
else -> null
|
||||||
|
|||||||
+2
-1
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinTargetComponentWithPublicati
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.external.ExternalKotlinTargetComponent.TargetProvider
|
import org.jetbrains.kotlin.gradle.plugin.mpp.external.ExternalKotlinTargetComponent.TargetProvider
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.getCoordinatesFromPublicationDelegateAndProject
|
import org.jetbrains.kotlin.gradle.plugin.mpp.getCoordinatesFromPublicationDelegateAndProject
|
||||||
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
|
||||||
internal class ExternalKotlinTargetComponent(
|
internal class ExternalKotlinTargetComponent(
|
||||||
val targetProvider: TargetProvider
|
val targetProvider: TargetProvider
|
||||||
@@ -45,7 +46,7 @@ internal class ExternalKotlinTargetComponent(
|
|||||||
get() = true
|
get() = true
|
||||||
|
|
||||||
override val defaultArtifactId: String
|
override val defaultArtifactId: String
|
||||||
get() = dashSeparatedName(target.project.name, target.name.toLowerCase())
|
get() = dashSeparatedName(target.project.name, target.name.toLowerCaseAsciiOnly())
|
||||||
|
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
message = "Sources artifacts are now published as separate variant " +
|
message = "Sources artifacts are now published as separate variant " +
|
||||||
|
|||||||
+4
-3
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinTargetComponent
|
|||||||
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||||
import org.jetbrains.kotlin.gradle.utils.getValue
|
import org.jetbrains.kotlin.gradle.utils.getValue
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
|
||||||
internal interface KotlinTargetComponentWithPublication : KotlinTargetComponent {
|
internal interface KotlinTargetComponentWithPublication : KotlinTargetComponent {
|
||||||
// This property is declared in the separate parent type to allow the usages to reference it without forcing the subtypes to load,
|
// This property is declared in the separate parent type to allow the usages to reference it without forcing the subtypes to load,
|
||||||
@@ -88,7 +89,7 @@ open class KotlinVariant(
|
|||||||
internal var defaultArtifactIdSuffix: String? = null
|
internal var defaultArtifactIdSuffix: String? = null
|
||||||
|
|
||||||
override val defaultArtifactId: String
|
override val defaultArtifactId: String
|
||||||
get() = dashSeparatedName(target.project.name, artifactTargetName.toLowerCase(), defaultArtifactIdSuffix)
|
get() = dashSeparatedName(target.project.name, artifactTargetName.toLowerCaseAsciiOnly(), defaultArtifactIdSuffix)
|
||||||
|
|
||||||
override var publicationDelegate: MavenPublication? = null
|
override var publicationDelegate: MavenPublication? = null
|
||||||
}
|
}
|
||||||
@@ -126,8 +127,8 @@ class JointAndroidKotlinTargetComponent(
|
|||||||
override val defaultArtifactId: String =
|
override val defaultArtifactId: String =
|
||||||
dashSeparatedName(
|
dashSeparatedName(
|
||||||
target.project.name,
|
target.project.name,
|
||||||
target.targetName.toLowerCase(),
|
target.targetName.toLowerCaseAsciiOnly(),
|
||||||
*flavorNames.map { it.toLowerCase() }.toTypedArray()
|
*flavorNames.map { it.toLowerCaseAsciiOnly() }.toTypedArray()
|
||||||
)
|
)
|
||||||
|
|
||||||
override var publicationDelegate: MavenPublication? = null
|
override var publicationDelegate: MavenPublication? = null
|
||||||
|
|||||||
+2
-1
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.publishedConfigurationName
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.usageByName
|
import org.jetbrains.kotlin.gradle.plugin.usageByName
|
||||||
import org.jetbrains.kotlin.gradle.tasks.withType
|
import org.jetbrains.kotlin.gradle.tasks.withType
|
||||||
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -192,7 +193,7 @@ open class GradleKpmVariantPublishingConfigurator @Inject constructor(
|
|||||||
publishedModuleHolder.assignMavenPublication(this)
|
publishedModuleHolder.assignMavenPublication(this)
|
||||||
artifactId = dashSeparatedName(
|
artifactId = dashSeparatedName(
|
||||||
project.name, publishedModuleHolder.defaultPublishedModuleSuffix
|
project.name, publishedModuleHolder.defaultPublishedModuleSuffix
|
||||||
).toLowerCase(Locale.ENGLISH)
|
).toLowerCaseAsciiOnly()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -9,11 +9,12 @@ import org.gradle.api.Project
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_BUILD_REPORT_SINGLE_FILE
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_BUILD_REPORT_SINGLE_FILE
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_BUILD_REPORT_HTTP_URL
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_BUILD_REPORT_HTTP_URL
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly
|
||||||
|
|
||||||
internal fun reportingSettings(rootProject: Project): ReportingSettings {
|
internal fun reportingSettings(rootProject: Project): ReportingSettings {
|
||||||
val properties = PropertiesProvider(rootProject)
|
val properties = PropertiesProvider(rootProject)
|
||||||
val buildReportOutputTypes = properties.buildReportOutputs.map {
|
val buildReportOutputTypes = properties.buildReportOutputs.map {
|
||||||
BuildReportType.values().firstOrNull { brt -> brt.name == it.trim().toUpperCase() }
|
BuildReportType.values().firstOrNull { brt -> brt.name == it.trim().toUpperCaseAsciiOnly() }
|
||||||
?: throw IllegalStateException("Unknown output type: $it")
|
?: throw IllegalStateException("Unknown output type: $it")
|
||||||
}.toMutableList() //temporary solution. support old property
|
}.toMutableList() //temporary solution. support old property
|
||||||
val buildReportMode =
|
val buildReportMode =
|
||||||
|
|||||||
+5
-4
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
|||||||
import org.jetbrains.kotlin.gradle.utils.forAllAndroidVariants
|
import org.jetbrains.kotlin.gradle.utils.forAllAndroidVariants
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
import org.jetbrains.kotlin.gradle.utils.setProperty
|
import org.jetbrains.kotlin.gradle.utils.setProperty
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
abstract class KotlinAndroidTarget @Inject constructor(
|
abstract class KotlinAndroidTarget @Inject constructor(
|
||||||
@@ -138,7 +139,7 @@ abstract class KotlinAndroidTarget @Inject constructor(
|
|||||||
defaultArtifactIdSuffix =
|
defaultArtifactIdSuffix =
|
||||||
dashSeparatedName(
|
dashSeparatedName(
|
||||||
(getFlavorNames(androidVariant) + getBuildTypeName(androidVariant).takeIf { it != "release" })
|
(getFlavorNames(androidVariant) + getBuildTypeName(androidVariant).takeIf { it != "release" })
|
||||||
.map { it?.toLowerCase() }
|
.map { it?.toLowerCaseAsciiOnly() }
|
||||||
).takeIf { it.isNotEmpty() }
|
).takeIf { it.isNotEmpty() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,9 +192,9 @@ abstract class KotlinAndroidTarget @Inject constructor(
|
|||||||
compilation,
|
compilation,
|
||||||
compilation.disambiguateName(""),
|
compilation.disambiguateName(""),
|
||||||
dashSeparatedName(
|
dashSeparatedName(
|
||||||
compilation.target.name.toLowerCase(),
|
compilation.target.name.toLowerCaseAsciiOnly(),
|
||||||
*flavorNames.map { it.toLowerCase() }.toTypedArray(),
|
*flavorNames.map { it.toLowerCaseAsciiOnly() }.toTypedArray(),
|
||||||
buildTypeName.takeIf { it != "release" }?.toLowerCase()
|
buildTypeName.takeIf { it != "release" }?.toLowerCaseAsciiOnly()
|
||||||
),
|
),
|
||||||
classifierPrefix = artifactClassifier,
|
classifierPrefix = artifactClassifier,
|
||||||
sourcesElementsConfigurationName = sourcesElementsConfigurationName
|
sourcesElementsConfigurationName = sourcesElementsConfigurationName
|
||||||
|
|||||||
+2
-1
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.gradle.testing.testTaskName
|
|||||||
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
import org.jetbrains.kotlin.gradle.utils.setProperty
|
import org.jetbrains.kotlin.gradle.utils.setProperty
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
abstract class KotlinJsTarget
|
abstract class KotlinJsTarget
|
||||||
@@ -80,7 +81,7 @@ constructor(
|
|||||||
irTarget?.let { targetName.removeJsCompilerSuffix(LEGACY) } ?: targetName
|
irTarget?.let { targetName.removeJsCompilerSuffix(LEGACY) } ?: targetName
|
||||||
else PRIMARY_SINGLE_COMPONENT_NAME
|
else PRIMARY_SINGLE_COMPONENT_NAME
|
||||||
|
|
||||||
configureSourcesJarArtifact(mainCompilation, componentName, dashSeparatedName(targetName.toLowerCase()))
|
configureSourcesJarArtifact(mainCompilation, componentName, dashSeparatedName(targetName.toLowerCaseAsciiOnly()))
|
||||||
usageContexts += DefaultKotlinUsageContext(
|
usageContexts += DefaultKotlinUsageContext(
|
||||||
compilation = mainCompilation,
|
compilation = mainCompilation,
|
||||||
mavenScope = KotlinUsageContext.MavenScope.RUNTIME,
|
mavenScope = KotlinUsageContext.MavenScope.RUNTIME,
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle.targets.js.binaryen
|
package org.jetbrains.kotlin.gradle.targets.js.binaryen
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides platform and architecture names that is used to download Binaryen.
|
* Provides platform and architecture names that is used to download Binaryen.
|
||||||
*/
|
*/
|
||||||
@@ -12,7 +14,7 @@ internal object BinaryenPlatform {
|
|||||||
const val DARWIN = "macos"
|
const val DARWIN = "macos"
|
||||||
|
|
||||||
val name: String = run {
|
val name: String = run {
|
||||||
val name = property("os.name").toLowerCase()
|
val name = property("os.name").toLowerCaseAsciiOnly()
|
||||||
when {
|
when {
|
||||||
name.contains("windows") -> WIN
|
name.contains("windows") -> WIN
|
||||||
name.contains("mac") -> DARWIN
|
name.contains("mac") -> DARWIN
|
||||||
|
|||||||
+3
-2
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.WebpackMajorVersion.Compan
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.dependsOn
|
import org.jetbrains.kotlin.gradle.tasks.dependsOn
|
||||||
import org.jetbrains.kotlin.gradle.utils.doNotTrackStateCompat
|
import org.jetbrains.kotlin.gradle.utils.doNotTrackStateCompat
|
||||||
import org.jetbrains.kotlin.gradle.utils.newFileProperty
|
import org.jetbrains.kotlin.gradle.utils.newFileProperty
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ abstract class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
{ task.args.add(0, "serve") },
|
{ task.args.add(0, "serve") },
|
||||||
{ task.bin = "webpack-dev-server/bin/webpack-dev-server.js" }
|
{ task.bin = "webpack-dev-server/bin/webpack-dev-server.js" }
|
||||||
)()
|
)()
|
||||||
task.description = "start ${mode.name.toLowerCase()} webpack dev server"
|
task.description = "start ${mode.name.toLowerCaseAsciiOnly()} webpack dev server"
|
||||||
|
|
||||||
webpackMajorVersion.choose(
|
webpackMajorVersion.choose(
|
||||||
{
|
{
|
||||||
@@ -210,7 +211,7 @@ abstract class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
.resolve(link.compilerOptions.moduleName.get() + ".js")
|
.resolve(link.compilerOptions.moduleName.get() + ".js")
|
||||||
}
|
}
|
||||||
|
|
||||||
task.description = "build webpack ${mode.name.toLowerCase()} bundle"
|
task.description = "build webpack ${mode.name.toLowerCaseAsciiOnly()} bundle"
|
||||||
task._destinationDirectory = binary.distribution.directory
|
task._destinationDirectory = binary.distribution.directory
|
||||||
|
|
||||||
BuildMetricsService.registerIfAbsent(project)?.let {
|
BuildMetricsService.registerIfAbsent(project)?.let {
|
||||||
|
|||||||
+3
-2
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode.PRODUCTION
|
|||||||
import org.jetbrains.kotlin.gradle.targets.js.subtargets.DefaultDistribution
|
import org.jetbrains.kotlin.gradle.targets.js.subtargets.DefaultDistribution
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.subtargets.KotlinJsSubTarget
|
import org.jetbrains.kotlin.gradle.targets.js.subtargets.KotlinJsSubTarget
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
open class KotlinJsBinaryContainer
|
open class KotlinJsBinaryContainer
|
||||||
@@ -216,8 +217,8 @@ constructor(
|
|||||||
) =
|
) =
|
||||||
lowerCamelCaseName(
|
lowerCamelCaseName(
|
||||||
if (compilation.isMain()) null else compilation.name,
|
if (compilation.isMain()) null else compilation.name,
|
||||||
mode.name.toLowerCase(),
|
mode.name.toLowerCaseAsciiOnly(),
|
||||||
jsBinaryType?.name?.toLowerCase()
|
jsBinaryType?.name?.toLowerCaseAsciiOnly()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode.DEVELOPMENT
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||||
import org.jetbrains.kotlin.statistics.metrics.BooleanMetrics
|
import org.jetbrains.kotlin.statistics.metrics.BooleanMetrics
|
||||||
import org.jetbrains.kotlin.statistics.metrics.StringMetrics
|
import org.jetbrains.kotlin.statistics.metrics.StringMetrics
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@CacheableTask
|
@CacheableTask
|
||||||
@@ -107,9 +108,9 @@ abstract class KotlinJsIrLink @Inject constructor(
|
|||||||
it.report(
|
it.report(
|
||||||
StringMetrics.JS_OUTPUT_GRANULARITY,
|
StringMetrics.JS_OUTPUT_GRANULARITY,
|
||||||
if (newArgs.irPerModule)
|
if (newArgs.irPerModule)
|
||||||
KotlinJsIrOutputGranularity.PER_MODULE.name.toLowerCase()
|
KotlinJsIrOutputGranularity.PER_MODULE.name.toLowerCaseAsciiOnly()
|
||||||
else
|
else
|
||||||
KotlinJsIrOutputGranularity.WHOLE_PROGRAM.name.toLowerCase()
|
KotlinJsIrOutputGranularity.WHOLE_PROGRAM.name.toLowerCaseAsciiOnly()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.gradle.targets.js.ir
|
|||||||
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||||
import org.jetbrains.kotlin.gradle.tasks.dependsOn
|
import org.jetbrains.kotlin.gradle.tasks.dependsOn
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
|
||||||
abstract class KotlinJsIrSubTargetBase(target: KotlinJsIrTarget, classifier: String) :
|
abstract class KotlinJsIrSubTargetBase(target: KotlinJsIrTarget, classifier: String) :
|
||||||
KotlinJsIrSubTarget(target, classifier) {
|
KotlinJsIrSubTarget(target, classifier) {
|
||||||
@@ -25,7 +26,7 @@ abstract class KotlinJsIrSubTargetBase(target: KotlinJsIrTarget, classifier: Str
|
|||||||
|
|
||||||
private fun configureRun(binary: JsIrBinary) {
|
private fun configureRun(binary: JsIrBinary) {
|
||||||
val binaryRunName = disambiguateCamelCased(
|
val binaryRunName = disambiguateCamelCased(
|
||||||
binary.mode.name.toLowerCase(),
|
binary.mode.name.toLowerCaseAsciiOnly(),
|
||||||
RUN_TASK_NAME
|
RUN_TASK_NAME
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -1,5 +1,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle.targets.js.nodejs
|
package org.jetbrains.kotlin.gradle.targets.js.nodejs
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides platform and architecture names that is used to download NodeJs.
|
* Provides platform and architecture names that is used to download NodeJs.
|
||||||
* See [NodeJsEnv.ivyDependency] that is filled in [NodeJsRootExtension.environment].
|
* See [NodeJsEnv.ivyDependency] that is filled in [NodeJsRootExtension.environment].
|
||||||
@@ -14,7 +16,7 @@ internal object NodeJsPlatform {
|
|||||||
const val SUNOS = "sunos"
|
const val SUNOS = "sunos"
|
||||||
|
|
||||||
val name: String = run {
|
val name: String = run {
|
||||||
val name = property("os.name").toLowerCase()
|
val name = property("os.name").toLowerCaseAsciiOnly()
|
||||||
when {
|
when {
|
||||||
name.contains("windows") -> WIN
|
name.contains("windows") -> WIN
|
||||||
name.contains("mac") -> DARWIN
|
name.contains("mac") -> DARWIN
|
||||||
@@ -30,7 +32,7 @@ internal object NodeJsPlatform {
|
|||||||
const val ARM64 = "arm64"
|
const val ARM64 = "arm64"
|
||||||
|
|
||||||
val architecture: String = run {
|
val architecture: String = run {
|
||||||
val arch = property("os.arch").toLowerCase()
|
val arch = property("os.arch").toLowerCaseAsciiOnly()
|
||||||
when {
|
when {
|
||||||
arch == "aarch64" -> ARM64
|
arch == "aarch64" -> ARM64
|
||||||
arch.contains("64") -> X64
|
arch.contains("64") -> X64
|
||||||
|
|||||||
+3
-2
@@ -13,6 +13,7 @@ import org.gradle.api.reflect.TypeOf
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.warnNpmGenerateExternals
|
import org.jetbrains.kotlin.gradle.plugin.warnNpmGenerateExternals
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmDependency.Scope.*
|
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmDependency.Scope.*
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
interface BaseNpmDependencyExtension {
|
interface BaseNpmDependencyExtension {
|
||||||
@@ -100,7 +101,7 @@ internal fun Project.addNpmDependencyExtension() {
|
|||||||
private fun scopePrefix(scope: NpmDependency.Scope): String {
|
private fun scopePrefix(scope: NpmDependency.Scope): String {
|
||||||
val scopePrefix = scope.name
|
val scopePrefix = scope.name
|
||||||
.removePrefix(NORMAL.name)
|
.removePrefix(NORMAL.name)
|
||||||
.toLowerCase()
|
.toLowerCaseAsciiOnly()
|
||||||
|
|
||||||
return lowerCamelCaseName(scopePrefix, "npm")
|
return lowerCamelCaseName(scopePrefix, "npm")
|
||||||
}
|
}
|
||||||
@@ -182,7 +183,7 @@ private abstract class NpmDependencyExtensionDelegate(
|
|||||||
protected fun npmDeclarationException(args: Array<out Any?>): Nothing {
|
protected fun npmDeclarationException(args: Array<out Any?>): Nothing {
|
||||||
throw IllegalArgumentException(
|
throw IllegalArgumentException(
|
||||||
"""
|
"""
|
||||||
|Unable to add NPM dependency with scope '${scope.name.toLowerCase()}' by ${args.joinToString { "'$it'" }}
|
|Unable to add NPM dependency with scope '${scope.name.toLowerCaseAsciiOnly()}' by ${args.joinToString { "'$it'" }}
|
||||||
|Possible variants:
|
|Possible variants:
|
||||||
|${possibleVariants().joinToString("\n") { "- ${it.first} -> ${it.second}" }}
|
|${possibleVariants().joinToString("\n") { "- ${it.first} -> ${it.second}" }}
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
|
|||||||
+3
-2
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.disambiguateName
|
|||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
|
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask
|
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
@@ -129,14 +130,14 @@ open class NpmProject(@Transient val compilation: KotlinJsCompilation) : Seriali
|
|||||||
project.name
|
project.name
|
||||||
} else null
|
} else null
|
||||||
|
|
||||||
val targetName = if (target.name.isNotEmpty() && target.name.toLowerCase() != "js") {
|
val targetName = if (target.name.isNotEmpty() && target.name.toLowerCaseAsciiOnly() != "js") {
|
||||||
target.name
|
target.name
|
||||||
.replace(DECAMELIZE_REGEX) {
|
.replace(DECAMELIZE_REGEX) {
|
||||||
it.groupValues
|
it.groupValues
|
||||||
.drop(1)
|
.drop(1)
|
||||||
.joinToString(prefix = "-", separator = "-")
|
.joinToString(prefix = "-", separator = "-")
|
||||||
}
|
}
|
||||||
.toLowerCase()
|
.toLowerCaseAsciiOnly()
|
||||||
} else null
|
} else null
|
||||||
|
|
||||||
return sequenceOf(
|
return sequenceOf(
|
||||||
|
|||||||
+3
-2
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.gradle.tasks.dependsOn
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.registerTask
|
import org.jetbrains.kotlin.gradle.tasks.registerTask
|
||||||
import org.jetbrains.kotlin.gradle.utils.doNotTrackStateCompat
|
import org.jetbrains.kotlin.gradle.utils.doNotTrackStateCompat
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinJsDce as KotlinJsDceTask
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJsDce as KotlinJsDceTask
|
||||||
@@ -153,7 +154,7 @@ abstract class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
{ task.bin = "webpack-dev-server/bin/webpack-dev-server.js" }
|
{ task.bin = "webpack-dev-server/bin/webpack-dev-server.js" }
|
||||||
)()
|
)()
|
||||||
|
|
||||||
task.description = "start ${type.name.toLowerCase()} webpack dev server"
|
task.description = "start ${type.name.toLowerCaseAsciiOnly()} webpack dev server"
|
||||||
|
|
||||||
webpackMajorVersion.choose(
|
webpackMajorVersion.choose(
|
||||||
{
|
{
|
||||||
@@ -235,7 +236,7 @@ abstract class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
distributeResourcesTask
|
distributeResourcesTask
|
||||||
)
|
)
|
||||||
|
|
||||||
task.description = "build webpack ${type.name.toLowerCase()} bundle"
|
task.description = "build webpack ${type.name.toLowerCaseAsciiOnly()} bundle"
|
||||||
task._destinationDirectory = distribution.directory
|
task._destinationDirectory = distribution.directory
|
||||||
|
|
||||||
BuildMetricsService.registerIfAbsent(project)?.let {
|
BuildMetricsService.registerIfAbsent(project)?.let {
|
||||||
|
|||||||
+3
-2
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinTest
|
|||||||
import org.jetbrains.kotlin.gradle.testing.internal.reportsDir
|
import org.jetbrains.kotlin.gradle.testing.internal.reportsDir
|
||||||
import org.jetbrains.kotlin.gradle.utils.appendLine
|
import org.jetbrains.kotlin.gradle.utils.appendLine
|
||||||
import org.jetbrains.kotlin.gradle.utils.property
|
import org.jetbrains.kotlin.gradle.utils.property
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ class KotlinKarma(
|
|||||||
val propValue = project.kotlinPropertiesProvider.jsKarmaBrowsers(compilation.target)
|
val propValue = project.kotlinPropertiesProvider.jsKarmaBrowsers(compilation.target)
|
||||||
val propBrowsers = propValue?.split(",")
|
val propBrowsers = propValue?.split(",")
|
||||||
propBrowsers?.map(String::trim)?.forEach {
|
propBrowsers?.map(String::trim)?.forEach {
|
||||||
when (it.toLowerCase()) {
|
when (it.toLowerCaseAsciiOnly()) {
|
||||||
"chrome" -> useChrome()
|
"chrome" -> useChrome()
|
||||||
"chrome-canary" -> useChromeCanary()
|
"chrome-canary" -> useChromeCanary()
|
||||||
"chrome-canary-headless" -> useChromeCanaryHeadless()
|
"chrome-canary-headless" -> useChromeCanaryHeadless()
|
||||||
@@ -503,7 +504,7 @@ class KotlinKarma(
|
|||||||
|
|
||||||
val actualText = if (launcherMessage != null) {
|
val actualText = if (launcherMessage != null) {
|
||||||
val (logLevel, message) = launcherMessage.destructured
|
val (logLevel, message) = launcherMessage.destructured
|
||||||
actualType = LogType.byValueOrNull(logLevel.toLowerCase())
|
actualType = LogType.byValueOrNull(logLevel.toLowerCaseAsciiOnly())
|
||||||
if (actualType?.isErrorLike() == true) {
|
if (actualType?.isErrorLike() == true) {
|
||||||
processFailedBrowsers(text)
|
processFailedBrowsers(text)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.gradle.tasks.locateOrRegisterTask
|
|||||||
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
abstract class KotlinNativeTarget @Inject constructor(
|
abstract class KotlinNativeTarget @Inject constructor(
|
||||||
@@ -60,7 +61,7 @@ abstract class KotlinNativeTarget @Inject constructor(
|
|||||||
|
|
||||||
if (hostSpecificSourceSets.isNotEmpty()) {
|
if (hostSpecificSourceSets.isNotEmpty()) {
|
||||||
val hostSpecificMetadataJar = project.locateOrRegisterTask<Jar>(hostSpecificMetadataJarTaskName) { metadataJar ->
|
val hostSpecificMetadataJar = project.locateOrRegisterTask<Jar>(hostSpecificMetadataJarTaskName) { metadataJar ->
|
||||||
metadataJar.archiveAppendix.set(project.provider { disambiguationClassifier.orEmpty().toLowerCase() })
|
metadataJar.archiveAppendix.set(project.provider { disambiguationClassifier.orEmpty().toLowerCaseAsciiOnly() })
|
||||||
metadataJar.archiveClassifier.set("metadata")
|
metadataJar.archiveClassifier.set("metadata")
|
||||||
metadataJar.group = BasePlugin.BUILD_GROUP
|
metadataJar.group = BasePlugin.BUILD_GROUP
|
||||||
metadataJar.description = "Assembles Kotlin metadata of target '${name}'."
|
metadataJar.description = "Assembles Kotlin metadata of target '${name}'."
|
||||||
@@ -101,7 +102,7 @@ abstract class KotlinNativeTarget @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configureSourcesJarArtifact(mainCompilation, targetName, dashSeparatedName(targetName.toLowerCase()))
|
configureSourcesJarArtifact(mainCompilation, targetName, dashSeparatedName(targetName.toLowerCaseAsciiOnly()))
|
||||||
val sourcesUsage = DefaultKotlinUsageContext(
|
val sourcesUsage = DefaultKotlinUsageContext(
|
||||||
compilation = mainCompilation,
|
compilation = mainCompilation,
|
||||||
dependencyConfigurationName = sourcesElementsConfigurationName,
|
dependencyConfigurationName = sourcesElementsConfigurationName,
|
||||||
|
|||||||
+7
-2
@@ -47,6 +47,7 @@ import org.jetbrains.kotlin.gradle.utils.*
|
|||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotlinTargetConfigurator<T>(
|
open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotlinTargetConfigurator<T>(
|
||||||
@@ -144,7 +145,11 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotl
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun configureFatFramework() {
|
fun configureFatFramework() {
|
||||||
val fatFrameworkConfigurationName = lowerCamelCaseName(binary.name, binary.target.konanTarget.family.name.toLowerCase(), "fat")
|
val fatFrameworkConfigurationName = lowerCamelCaseName(
|
||||||
|
binary.name,
|
||||||
|
binary.target.konanTarget.family.name.toLowerCaseAsciiOnly(),
|
||||||
|
"fat"
|
||||||
|
)
|
||||||
val fatFrameworkTaskName = "link${fatFrameworkConfigurationName.capitalizeAsciiOnly()}"
|
val fatFrameworkTaskName = "link${fatFrameworkConfigurationName.capitalizeAsciiOnly()}"
|
||||||
|
|
||||||
val fatFrameworkTask = if (fatFrameworkTaskName in tasks.names) {
|
val fatFrameworkTask = if (fatFrameworkTaskName in tasks.names) {
|
||||||
@@ -152,7 +157,7 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotl
|
|||||||
} else {
|
} else {
|
||||||
tasks.register(fatFrameworkTaskName, FatFrameworkTask::class.java) {
|
tasks.register(fatFrameworkTaskName, FatFrameworkTask::class.java) {
|
||||||
it.baseName = binary.baseName
|
it.baseName = binary.baseName
|
||||||
it.destinationDir = it.destinationDir.resolve(binary.buildType.name.toLowerCase())
|
it.destinationDir = it.destinationDir.resolve(binary.buildType.name.toLowerCaseAsciiOnly())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
|
|||||||
import org.jetbrains.kotlin.gradle.utils.Xcode
|
import org.jetbrains.kotlin.gradle.utils.Xcode
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -310,7 +311,7 @@ class Framework(
|
|||||||
* marker - Embed placeholder LLVM IR data as a marker.
|
* marker - Embed placeholder LLVM IR data as a marker.
|
||||||
* Has the same effect as the -Xembed-bitcode-marker command line option.
|
* Has the same effect as the -Xembed-bitcode-marker command line option.
|
||||||
*/
|
*/
|
||||||
fun embedBitcode(mode: String) = embedBitcode(org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode.valueOf(mode.toUpperCase()))
|
fun embedBitcode(mode: String) = embedBitcode(org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode.valueOf(mode.toUpperCaseAsciiOnly()))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies if the framework is linked as a static library (false by default).
|
* Specifies if the framework is linked as a static library (false by default).
|
||||||
|
|||||||
+2
-1
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionTyp
|
|||||||
import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
||||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
|
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),
|
||||||
@@ -32,7 +33,7 @@ internal class NativeDistributionTypeProvider(private val project: Project) {
|
|||||||
lightType: NativeDistributionType,
|
lightType: NativeDistributionType,
|
||||||
defaultType: NativeDistributionType
|
defaultType: NativeDistributionType
|
||||||
): NativeDistributionType {
|
): NativeDistributionType {
|
||||||
val requestedByUser = propertiesProvider.nativeDistributionType?.toLowerCase()
|
val requestedByUser = propertiesProvider.nativeDistributionType?.toLowerCaseAsciiOnly()
|
||||||
val deprecatedRestricted = propertiesProvider.nativeDeprecatedRestricted
|
val deprecatedRestricted = propertiesProvider.nativeDeprecatedRestricted
|
||||||
|
|
||||||
// A case when a deprecated property (kotlin.native.restrictedDistribution) is used to choose the restricted distribution.
|
// A case when a deprecated property (kotlin.native.restrictedDistribution) is used to choose the restricted distribution.
|
||||||
|
|||||||
+3
-2
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.gradle.tasks.PodspecTask.Companion.retrieveSpecRepos
|
|||||||
import org.jetbrains.kotlin.gradle.utils.runCommand
|
import org.jetbrains.kotlin.gradle.utils.runCommand
|
||||||
import org.jetbrains.kotlin.konan.target.Family
|
import org.jetbrains.kotlin.konan.target.Family
|
||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.Reader
|
import java.io.Reader
|
||||||
@@ -491,11 +492,11 @@ private object CocoapodsErrorHandlingUtil {
|
|||||||
) {
|
) {
|
||||||
message += """
|
message += """
|
||||||
|
|
|
|
||||||
| Possible reason: ${family.name.toLowerCase()} deployment target is not configured
|
| Possible reason: ${family.name.toLowerCaseAsciiOnly()} deployment target is not configured
|
||||||
| Configure deployment_target for ALL targets as follows:
|
| Configure deployment_target for ALL targets as follows:
|
||||||
| cocoapods {
|
| cocoapods {
|
||||||
| ...
|
| ...
|
||||||
| ${family.name.toLowerCase()}.deploymentTarget = "..."
|
| ${family.name.toLowerCaseAsciiOnly()}.deploymentTarget = "..."
|
||||||
| ...
|
| ...
|
||||||
| }
|
| }
|
||||||
|
|
|
|
||||||
|
|||||||
+6
-3
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.konan.target.HostManager
|
|||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget.*
|
import org.jetbrains.kotlin.konan.target.KonanTarget.*
|
||||||
import org.jetbrains.kotlin.konan.util.visibleName
|
import org.jetbrains.kotlin.konan.util.visibleName
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
@@ -227,7 +228,7 @@ internal constructor(
|
|||||||
|
|
||||||
require(!archToFramework.containsKey(arch)) {
|
require(!archToFramework.containsKey(arch)) {
|
||||||
val alreadyAdded = archToFramework.getValue(arch)
|
val alreadyAdded = archToFramework.getValue(arch)
|
||||||
"This fat framework already has a binary for architecture `${arch.name.toLowerCase()}` " +
|
"This fat framework already has a binary for architecture `${arch.name.toLowerCaseAsciiOnly()}` " +
|
||||||
"(${alreadyAdded.name} for target `${alreadyAdded.target.name}`)"
|
"(${alreadyAdded.name} for target `${alreadyAdded.target.name}`)"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,8 +237,10 @@ internal constructor(
|
|||||||
|
|
||||||
buildString {
|
buildString {
|
||||||
append("Cannot create a fat framework from:\n")
|
append("Cannot create a fat framework from:\n")
|
||||||
archToFramework.forEach { append("${it.value.name} - ${it.key.name.toLowerCase()} - ${staticName(it.value.isStatic)}\n") }
|
archToFramework.forEach {
|
||||||
append("${framework.name} - ${arch.name.toLowerCase()} - ${staticName(framework.isStatic)}\n")
|
append("${it.value.name} - ${it.key.name.toLowerCaseAsciiOnly()} - ${staticName(it.value.isStatic)}\n")
|
||||||
|
}
|
||||||
|
append("${framework.name} - ${arch.name.toLowerCaseAsciiOnly()} - ${staticName(framework.isStatic)}\n")
|
||||||
append("All input frameworks must be either static or dynamic")
|
append("All input frameworks must be either static or dynamic")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.gradle.tasks.CompilerPluginOptions
|
|||||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
import org.jetbrains.kotlin.project.model.LanguageSettings
|
import org.jetbrains.kotlin.project.model.LanguageSettings
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal class CompilerPluginData(
|
internal class CompilerPluginData(
|
||||||
@@ -138,7 +139,7 @@ private fun buildKotlinNativeMainArgs(
|
|||||||
addKey("-g", debuggable)
|
addKey("-g", debuggable)
|
||||||
addKey("-ea", debuggable)
|
addKey("-ea", debuggable)
|
||||||
addArg("-target", target.name)
|
addArg("-target", target.name)
|
||||||
addArg("-p", outputKind.name.toLowerCase())
|
addArg("-p", outputKind.name.toLowerCaseAsciiOnly())
|
||||||
addArg("-o", outFile.absolutePath)
|
addArg("-o", outFile.absolutePath)
|
||||||
libraries.forEach { addArg("-l", it.absolutePath) }
|
libraries.forEach { addArg("-l", it.absolutePath) }
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle.utils
|
package org.jetbrains.kotlin.gradle.utils
|
||||||
|
|
||||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
internal fun lowerCamelCaseName(vararg nameParts: String?): String {
|
internal fun lowerCamelCaseName(vararg nameParts: String?): String {
|
||||||
@@ -28,14 +29,14 @@ internal fun dashSeparatedLowercaseName(nameParts: Iterable<String?>) =
|
|||||||
dashSeparatedLowercaseName(*nameParts.toList().toTypedArray())
|
dashSeparatedLowercaseName(*nameParts.toList().toTypedArray())
|
||||||
|
|
||||||
internal fun dashSeparatedLowercaseName(vararg nameParts: String?): String {
|
internal fun dashSeparatedLowercaseName(vararg nameParts: String?): String {
|
||||||
val nonEmptyParts = nameParts.mapNotNull { it?.takeIf(String::isNotEmpty)?.toLowerCase(Locale.ENGLISH) }
|
val nonEmptyParts = nameParts.mapNotNull { it?.takeIf(String::isNotEmpty)?.toLowerCaseAsciiOnly() }
|
||||||
return nonEmptyParts.joinToString(separator = "-")
|
return nonEmptyParts.joinToString(separator = "-")
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun String.decamelize(): String {
|
internal fun String.decamelize(): String {
|
||||||
return replace(upperCaseRegex) {
|
return replace(upperCaseRegex) {
|
||||||
val (first) = it.destructured
|
val (first) = it.destructured
|
||||||
"-${first.toLowerCase()}"
|
"-${first.toLowerCaseAsciiOnly()}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataCompilation
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataCompilation
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.kotlinProjectStructureMetadata
|
import org.jetbrains.kotlin.gradle.plugin.mpp.kotlinProjectStructureMetadata
|
||||||
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
class JvmAndAndroidIntermediateSourceSetTest {
|
class JvmAndAndroidIntermediateSourceSetTest {
|
||||||
@@ -117,7 +118,7 @@ class JvmAndAndroidIntermediateSourceSetTest {
|
|||||||
assertTrue(kotlinComponents.isNotEmpty(), "Expected at least one KotlinComponent to be present")
|
assertTrue(kotlinComponents.isNotEmpty(), "Expected at least one KotlinComponent to be present")
|
||||||
|
|
||||||
kotlinComponents.forEach { component ->
|
kotlinComponents.forEach { component ->
|
||||||
val isReleaseComponent = "release" in component.name.toLowerCase()
|
val isReleaseComponent = "release" in component.name.toLowerCaseAsciiOnly()
|
||||||
if (isReleaseComponent) {
|
if (isReleaseComponent) {
|
||||||
assertTrue(component.publishable, "Expected release component to be marked as publishable")
|
assertTrue(component.publishable, "Expected release component to be marked as publishable")
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user