[Gradle] Fix moduleName is not possible to set in MPP project
^KT-57959 Fixed
This commit is contained in:
committed by
Space Team
parent
a5157aa239
commit
2b27fe4e65
+38
@@ -309,4 +309,42 @@ class CompilerOptionsProjectIT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("KT-57959: should be possible to configure module name in MPP/android")
|
||||
@GradleAndroidTest
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_0)
|
||||
@AndroidTestVersions(minVersion = TestVersions.AGP.AGP_70)
|
||||
@AndroidGradlePluginTests
|
||||
fun mppAndroidModuleName(
|
||||
gradleVersion: GradleVersion,
|
||||
agpVersion: String,
|
||||
jdk: JdkVersions.ProvidedJdk
|
||||
) {
|
||||
project(
|
||||
"multiplatformAndroidSourceSetLayout2",
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion, logLevel = LogLevel.DEBUG),
|
||||
buildJdk = jdk.location
|
||||
) {
|
||||
buildGradleKts.appendText(
|
||||
//language=kotlin
|
||||
"""
|
||||
|
|
||||
|kotlin {
|
||||
| android {
|
||||
| compilations.all {
|
||||
| compilerOptions.options.moduleName.set("last-chance")
|
||||
| }
|
||||
| }
|
||||
|}
|
||||
""".trimMargin()
|
||||
)
|
||||
|
||||
build(":compileGermanFreeDebugKotlinAndroid") {
|
||||
assertTasksExecuted(":compileGermanFreeDebugKotlinAndroid")
|
||||
|
||||
assertCompilerArgument(":compileGermanFreeDebugKotlinAndroid", "-module-name last-chance")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -89,8 +89,7 @@ internal open class BaseKotlinCompileConfig<TASK : KotlinCompile> : AbstractKotl
|
||||
|
||||
// In case of 'org.jetbrains.kotlin.jvm' and 'org.jetbrains.kotlin.android' plugins module name will be pre-configured
|
||||
if (ext !is KotlinJvmProjectExtension && ext !is KotlinAndroidProjectExtension) {
|
||||
@Suppress("DEPRECATION")
|
||||
task.moduleName.set(providers.provider { compilationInfo.moduleName })
|
||||
task.compilerOptions.moduleName.convention(providers.provider { compilationInfo.moduleName })
|
||||
} else {
|
||||
task.nagTaskModuleNameUsage.set(true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user