[Gradle, K/N] Configure memory properties for tests in single place
This commit is contained in:
+13
-44
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.gradle
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.internals.MULTIPLATFORM_PROJECT_METADATA_JSON_FILE_NAME
|
import org.jetbrains.kotlin.gradle.internals.MULTIPLATFORM_PROJECT_METADATA_JSON_FILE_NAME
|
||||||
import org.jetbrains.kotlin.gradle.internals.parseKotlinSourceSetMetadataFromJson
|
import org.jetbrains.kotlin.gradle.internals.parseKotlinSourceSetMetadataFromJson
|
||||||
|
import org.jetbrains.kotlin.gradle.native.transformNativeTestProjectWithPluginDsl
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinProjectStructureMetadata
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinProjectStructureMetadata
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.ModuleDependencyIdentifier
|
import org.jetbrains.kotlin.gradle.plugin.mpp.ModuleDependencyIdentifier
|
||||||
@@ -32,25 +33,19 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
fun testPublishedModules() {
|
fun testPublishedModules() {
|
||||||
publishThirdPartyLib(withGranularMetadata = false)
|
publishThirdPartyLib(withGranularMetadata = false)
|
||||||
|
|
||||||
Project("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
transformNativeTestProjectWithPluginDsl("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
build("publish") {
|
build("publish") {
|
||||||
checkMyLibFoo(this, subprojectPrefix = null)
|
checkMyLibFoo(this, subprojectPrefix = null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Project("my-lib-bar", gradleVersion, "hierarchical-mpp-published-modules").run {
|
transformNativeTestProjectWithPluginDsl("my-lib-bar", gradleVersion, "hierarchical-mpp-published-modules").run {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
build("publish") {
|
build("publish") {
|
||||||
checkMyLibBar(this, subprojectPrefix = null)
|
checkMyLibBar(this, subprojectPrefix = null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Project("my-app", gradleVersion, "hierarchical-mpp-published-modules").run {
|
transformNativeTestProjectWithPluginDsl("my-app", gradleVersion, "hierarchical-mpp-published-modules").run {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
checkMyApp(this, subprojectPrefix = null)
|
checkMyApp(this, subprojectPrefix = null)
|
||||||
}
|
}
|
||||||
@@ -61,10 +56,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
fun testNoSourceSetsVisibleIfNoVariantMatched() {
|
fun testNoSourceSetsVisibleIfNoVariantMatched() {
|
||||||
publishThirdPartyLib(withGranularMetadata = true)
|
publishThirdPartyLib(withGranularMetadata = true)
|
||||||
|
|
||||||
Project("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
transformNativeTestProjectWithPluginDsl("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
// --- Move the dependency from jvmAndJsMain to commonMain, where there's a linuxX64 target missing in the lib
|
// --- Move the dependency from jvmAndJsMain to commonMain, where there's a linuxX64 target missing in the lib
|
||||||
gradleBuildScript().modify {
|
gradleBuildScript().modify {
|
||||||
it.checkedReplace("api(\"com.example.thirdparty:third-party-lib:1.0\")", "//") + "\n" + """
|
it.checkedReplace("api(\"com.example.thirdparty:third-party-lib:1.0\")", "//") + "\n" + """
|
||||||
@@ -94,10 +86,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
gradleBuildScript().appendText("\nkotlin.linuxX64()")
|
gradleBuildScript().appendText("\nkotlin.linuxX64()")
|
||||||
}
|
}
|
||||||
|
|
||||||
Project("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
transformNativeTestProjectWithPluginDsl("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
testDependencyTransformations { reports ->
|
testDependencyTransformations { reports ->
|
||||||
val testApiTransformationReports =
|
val testApiTransformationReports =
|
||||||
reports.filter { report ->
|
reports.filter { report ->
|
||||||
@@ -171,10 +160,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
fun testProjectDependencies() {
|
fun testProjectDependencies() {
|
||||||
publishThirdPartyLib(withGranularMetadata = false)
|
publishThirdPartyLib(withGranularMetadata = false)
|
||||||
|
|
||||||
with(Project("hierarchical-mpp-project-dependency", gradleVersion)) {
|
with(transformNativeTestProjectWithPluginDsl("hierarchical-mpp-project-dependency", gradleVersion)) {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
build("publish", "assemble") {
|
build("publish", "assemble") {
|
||||||
checkMyLibFoo(this, subprojectPrefix = "my-lib-foo")
|
checkMyLibFoo(this, subprojectPrefix = "my-lib-foo")
|
||||||
checkMyLibBar(this, subprojectPrefix = "my-lib-bar")
|
checkMyLibBar(this, subprojectPrefix = "my-lib-bar")
|
||||||
@@ -193,10 +179,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
jsCompilerType = KotlinJsCompilerType.BOTH
|
jsCompilerType = KotlinJsCompilerType.BOTH
|
||||||
)
|
)
|
||||||
|
|
||||||
with(Project("my-lib-foo", gradleVersion, directoryPrefix)) {
|
with(transformNativeTestProjectWithPluginDsl("my-lib-foo", gradleVersion, directoryPrefix)) {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
build(
|
build(
|
||||||
"publish",
|
"publish",
|
||||||
"assemble",
|
"assemble",
|
||||||
@@ -209,10 +192,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testHmppWithProjectJsIrDependency() {
|
fun testHmppWithProjectJsIrDependency() {
|
||||||
with(Project("hierarchical-mpp-with-js-project-dependency", gradleVersion)) {
|
with(transformNativeTestProjectWithPluginDsl("hierarchical-mpp-with-js-project-dependency", gradleVersion)) {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
build(
|
build(
|
||||||
"assemble",
|
"assemble",
|
||||||
options = defaultBuildOptions().copy(jsCompilerType = KotlinJsCompilerType.IR)
|
options = defaultBuildOptions().copy(jsCompilerType = KotlinJsCompilerType.IR)
|
||||||
@@ -229,10 +209,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
jsCompilerType: KotlinJsCompilerType = KotlinJsCompilerType.LEGACY,
|
jsCompilerType: KotlinJsCompilerType = KotlinJsCompilerType.LEGACY,
|
||||||
beforePublishing: Project.() -> Unit = { }
|
beforePublishing: Project.() -> Unit = { }
|
||||||
): Project =
|
): Project =
|
||||||
Project(projectName, gradleVersion, directoryPrefix).apply {
|
transformNativeTestProjectWithPluginDsl(projectName, gradleVersion, directoryPrefix).apply {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
beforePublishing()
|
beforePublishing()
|
||||||
|
|
||||||
if (withGranularMetadata) {
|
if (withGranularMetadata) {
|
||||||
@@ -495,10 +472,8 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCompileOnlyDependencyProcessingForMetadataCompilations() = with(Project("hierarchical-mpp-project-dependency")) {
|
fun testCompileOnlyDependencyProcessingForMetadataCompilations() = with(transformNativeTestProjectWithPluginDsl("hierarchical-mpp-project-dependency")) {
|
||||||
publishThirdPartyLib(withGranularMetadata = true)
|
publishThirdPartyLib(withGranularMetadata = true)
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
gradleBuildScript("my-lib-foo").appendText("\ndependencies { \"jvmAndJsMainCompileOnly\"(kotlin(\"test-annotations-common\")) }")
|
gradleBuildScript("my-lib-foo").appendText("\ndependencies { \"jvmAndJsMainCompileOnly\"(kotlin(\"test-annotations-common\")) }")
|
||||||
projectDir.resolve("my-lib-foo/src/jvmAndJsMain/kotlin/UseCompileOnlyDependency.kt").writeText(
|
projectDir.resolve("my-lib-foo/src/jvmAndJsMain/kotlin/UseCompileOnlyDependency.kt").writeText(
|
||||||
@@ -533,10 +508,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
fun testProcessingDependencyDeclaredInNonRootSourceSet() {
|
fun testProcessingDependencyDeclaredInNonRootSourceSet() {
|
||||||
publishThirdPartyLib(withGranularMetadata = true)
|
publishThirdPartyLib(withGranularMetadata = true)
|
||||||
|
|
||||||
Project("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
transformNativeTestProjectWithPluginDsl("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
val intermediateMetadataCompileTask = ":compileJvmAndJsMainKotlinMetadata"
|
val intermediateMetadataCompileTask = ":compileJvmAndJsMainKotlinMetadata"
|
||||||
|
|
||||||
build(intermediateMetadataCompileTask) {
|
build(intermediateMetadataCompileTask) {
|
||||||
@@ -556,10 +528,7 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
fun testDependenciesInNonPublishedSourceSets() {
|
fun testDependenciesInNonPublishedSourceSets() {
|
||||||
publishThirdPartyLib(withGranularMetadata = true)
|
publishThirdPartyLib(withGranularMetadata = true)
|
||||||
|
|
||||||
Project("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
transformNativeTestProjectWithPluginDsl("my-lib-foo", gradleVersion, "hierarchical-mpp-published-modules").run {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
testDependencyTransformations { reports ->
|
testDependencyTransformations { reports ->
|
||||||
reports.single {
|
reports.single {
|
||||||
it.sourceSetName == "jvmAndJsMain" && it.scope == "api" && it.groupAndModule.startsWith("com.example")
|
it.sourceSetName == "jvmAndJsMain" && it.scope == "api" && it.groupAndModule.startsWith("com.example")
|
||||||
|
|||||||
+3
-2
@@ -5,6 +5,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.native.MPPNativeTargets
|
import org.jetbrains.kotlin.gradle.native.MPPNativeTargets
|
||||||
|
import org.jetbrains.kotlin.gradle.native.transformNativeTestProjectWithPluginDsl
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.*
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations
|
import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations
|
||||||
@@ -54,8 +55,8 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
libProjectName: String,
|
libProjectName: String,
|
||||||
appProjectName: String
|
appProjectName: String
|
||||||
) {
|
) {
|
||||||
val libProject = transformProjectWithPluginsDsl(libProjectName, directoryPrefix = "new-mpp-lib-and-app")
|
val libProject = transformNativeTestProjectWithPluginDsl(libProjectName, directoryPrefix = "new-mpp-lib-and-app")
|
||||||
val appProject = transformProjectWithPluginsDsl(appProjectName, directoryPrefix = "new-mpp-lib-and-app")
|
val appProject = transformNativeTestProjectWithPluginDsl(appProjectName, directoryPrefix = "new-mpp-lib-and-app")
|
||||||
val oldStyleAppProject = Project("sample-old-style-app", directoryPrefix = "new-mpp-lib-and-app")
|
val oldStyleAppProject = Project("sample-old-style-app", directoryPrefix = "new-mpp-lib-and-app")
|
||||||
|
|
||||||
val compileTasksNames =
|
val compileTasksNames =
|
||||||
|
|||||||
+2
@@ -22,6 +22,8 @@ class CommonNativeIT : BaseGradleIT() {
|
|||||||
libTargets: List<String>,
|
libTargets: List<String>,
|
||||||
appTargets: List<String>
|
appTargets: List<String>
|
||||||
) = with(transformProjectWithPluginsDsl(projectName, directoryPrefix = "new-mpp-common-native")) {
|
) = with(transformProjectWithPluginsDsl(projectName, directoryPrefix = "new-mpp-common-native")) {
|
||||||
|
configureMemoryInGradleProperties()
|
||||||
|
|
||||||
val libCompileTasks = libTargets.map { ":lib:compileKotlin${it.capitalize()}" }
|
val libCompileTasks = libTargets.map { ":lib:compileKotlin${it.capitalize()}" }
|
||||||
val appCompileTasks = appTargets.map { ":app:compileKotlin${it.capitalize()}" }
|
val appCompileTasks = appTargets.map { ":app:compileKotlin${it.capitalize()}" }
|
||||||
val appLinkFrameworkTasks = appTargets.map { ":app:linkDebugFramework${it.capitalize()}" }
|
val appLinkFrameworkTasks = appTargets.map { ":app:linkDebugFramework${it.capitalize()}" }
|
||||||
|
|||||||
+53
-45
@@ -47,6 +47,44 @@ internal object MPPNativeTargets {
|
|||||||
val supported = listOf("linux64", "macos64", "mingw64").filter { !unsupported.contains(it) }
|
val supported = listOf("linux64", "macos64", "mingw64").filter { !unsupported.contains(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun BaseGradleIT.transformNativeTestProject(projectName: String, directoryPrefix: String? = null): BaseGradleIT.Project {
|
||||||
|
val project = Project(projectName, directoryPrefix = directoryPrefix)
|
||||||
|
project.setupWorkingDir()
|
||||||
|
project.configureSingleNativeTarget()
|
||||||
|
project.configureMemoryInGradleProperties()
|
||||||
|
return project
|
||||||
|
}
|
||||||
|
|
||||||
|
fun BaseGradleIT.transformNativeTestProjectWithPluginDsl(projectName: String, wrapperVersion: GradleVersionRequired = defaultGradleVersion, directoryPrefix: String? = null): BaseGradleIT.Project {
|
||||||
|
val project = transformProjectWithPluginsDsl(projectName, wrapperVersion, directoryPrefix = directoryPrefix)
|
||||||
|
project.configureSingleNativeTarget()
|
||||||
|
project.configureMemoryInGradleProperties()
|
||||||
|
return project
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun BaseGradleIT.Project.configureMemoryInGradleProperties() {
|
||||||
|
val files = projectDir.walk()
|
||||||
|
.filter { it.isFile && (it.name == "gradle.properties") }.toMutableList()
|
||||||
|
if (files.isEmpty()) {
|
||||||
|
files.add(projectDir.resolve("gradle.properties").also { it.createNewFile() })
|
||||||
|
}
|
||||||
|
files.forEach { file ->
|
||||||
|
file.appendText("\norg.gradle.jvmargs=-Xmx1g\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private const val SINGLE_NATIVE_TARGET_PLACEHOLDER = "<SingleNativeTarget>"
|
||||||
|
|
||||||
|
private fun BaseGradleIT.Project.configureSingleNativeTarget(preset: String = HostManager.host.presetName) {
|
||||||
|
projectDir.walk()
|
||||||
|
.filter { it.isFile && (it.name == "build.gradle.kts" || it.name == "build.gradle") }
|
||||||
|
.forEach { file ->
|
||||||
|
file.modify {
|
||||||
|
it.replace(SINGLE_NATIVE_TARGET_PLACEHOLDER, preset)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class GeneralNativeIT : BaseGradleIT() {
|
class GeneralNativeIT : BaseGradleIT() {
|
||||||
|
|
||||||
val nativeHostTargetName = MPPNativeTargets.current
|
val nativeHostTargetName = MPPNativeTargets.current
|
||||||
@@ -57,20 +95,8 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
override val defaultGradleVersion: GradleVersionRequired
|
override val defaultGradleVersion: GradleVersionRequired
|
||||||
get() = GradleVersionRequired.FOR_MPP_SUPPORT
|
get() = GradleVersionRequired.FOR_MPP_SUPPORT
|
||||||
|
|
||||||
private val SINGLE_NATIVE_TARGET_PLACHOLDER = "<SingleNativeTarget>"
|
|
||||||
|
|
||||||
private fun Project.configureSingleNativeTarget(preset: String = HostManager.host.presetName) {
|
|
||||||
projectDir.walk()
|
|
||||||
.filter { it.isFile && (it.name == "build.gradle.kts" || it.name == "build.gradle") }
|
|
||||||
.forEach { file ->
|
|
||||||
file.modify {
|
|
||||||
it.replace(SINGLE_NATIVE_TARGET_PLACHOLDER, preset)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testParallelExecutionSmoke(): Unit = with(transformProjectWithPluginsDsl("native-parallel")) {
|
fun testParallelExecutionSmoke(): Unit = with(transformNativeTestProjectWithPluginDsl("native-parallel")) {
|
||||||
// Check that the K/N compiler can be started in-process in parallel.
|
// Check that the K/N compiler can be started in-process in parallel.
|
||||||
build(":one:compileKotlinLinux", ":two:compileKotlinLinux") {
|
build(":one:compileKotlinLinux", ":two:compileKotlinLinux") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -78,8 +104,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIncorrectDependenciesWarning() = with(Project("sample-lib", directoryPrefix = "new-mpp-lib-and-app")) {
|
fun testIncorrectDependenciesWarning() = with(transformNativeTestProject("sample-lib", directoryPrefix = "new-mpp-lib-and-app")) {
|
||||||
setupWorkingDir()
|
|
||||||
gradleBuildScript().modify {
|
gradleBuildScript().modify {
|
||||||
it.replace(
|
it.replace(
|
||||||
"api 'org.jetbrains.kotlin:kotlin-stdlib-common'",
|
"api 'org.jetbrains.kotlin:kotlin-stdlib-common'",
|
||||||
@@ -100,11 +125,8 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
@Test
|
@Test
|
||||||
fun testEndorsedLibsController() {
|
fun testEndorsedLibsController() {
|
||||||
with(
|
with(
|
||||||
transformProjectWithPluginsDsl("native-endorsed")
|
transformNativeTestProjectWithPluginDsl("native-endorsed")
|
||||||
) {
|
) {
|
||||||
configureSingleNativeTarget()
|
|
||||||
setupWorkingDir()
|
|
||||||
|
|
||||||
build("build") {
|
build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
@@ -118,9 +140,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCanProduceNativeLibraries() = with(transformProjectWithPluginsDsl("libraries", directoryPrefix = "native-binaries")) {
|
fun testCanProduceNativeLibraries() = with(transformNativeTestProjectWithPluginDsl("libraries", directoryPrefix = "native-binaries")) {
|
||||||
configureSingleNativeTarget()
|
|
||||||
|
|
||||||
val baseName = "native_library"
|
val baseName = "native_library"
|
||||||
|
|
||||||
val sharedPrefix = CompilerOutputKind.DYNAMIC.prefix(HostManager.host)
|
val sharedPrefix = CompilerOutputKind.DYNAMIC.prefix(HostManager.host)
|
||||||
@@ -194,7 +214,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCanProduceNativeFrameworks() = with(transformProjectWithPluginsDsl("frameworks", directoryPrefix = "native-binaries")) {
|
fun testCanProduceNativeFrameworks() = with(transformNativeTestProjectWithPluginDsl("frameworks", directoryPrefix = "native-binaries")) {
|
||||||
Assume.assumeTrue(HostManager.hostIsMac)
|
Assume.assumeTrue(HostManager.hostIsMac)
|
||||||
|
|
||||||
val baseName = "main"
|
val baseName = "main"
|
||||||
@@ -271,9 +291,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testExportApiOnlyToLibraries() = with(transformProjectWithPluginsDsl("libraries", directoryPrefix = "native-binaries")) {
|
fun testExportApiOnlyToLibraries() = with(transformNativeTestProjectWithPluginDsl("libraries", directoryPrefix = "native-binaries")) {
|
||||||
configureSingleNativeTarget()
|
|
||||||
|
|
||||||
// Check that plugin doesn't allow exporting dependencies not added in the API configuration.
|
// Check that plugin doesn't allow exporting dependencies not added in the API configuration.
|
||||||
gradleBuildScript().modify {
|
gradleBuildScript().modify {
|
||||||
it.replace("api(project(\":exported\"))", "")
|
it.replace("api(project(\":exported\"))", "")
|
||||||
@@ -303,9 +321,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNativeExecutables() = with(transformProjectWithPluginsDsl("executables", directoryPrefix = "native-binaries")) {
|
fun testNativeExecutables() = with(transformNativeTestProjectWithPluginDsl("executables", directoryPrefix = "native-binaries")) {
|
||||||
configureSingleNativeTarget()
|
|
||||||
|
|
||||||
val binaries = mutableListOf(
|
val binaries = mutableListOf(
|
||||||
"debugExecutable" to "native-binary",
|
"debugExecutable" to "native-binary",
|
||||||
"releaseExecutable" to "native-binary",
|
"releaseExecutable" to "native-binary",
|
||||||
@@ -362,7 +378,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun testNativeBinaryDsl(project: String) = with(
|
private fun testNativeBinaryDsl(project: String) = with(
|
||||||
transformProjectWithPluginsDsl(project, directoryPrefix = "native-binaries")
|
transformNativeTestProjectWithPluginDsl(project, directoryPrefix = "native-binaries")
|
||||||
) {
|
) {
|
||||||
val hostSuffix = nativeHostTargetName.capitalize()
|
val hostSuffix = nativeHostTargetName.capitalize()
|
||||||
|
|
||||||
@@ -383,10 +399,8 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testKotlinOptions() = with(
|
fun testKotlinOptions() = with(
|
||||||
transformProjectWithPluginsDsl("native-kotlin-options")
|
transformNativeTestProjectWithPluginDsl("native-kotlin-options")
|
||||||
) {
|
) {
|
||||||
configureSingleNativeTarget()
|
|
||||||
|
|
||||||
build(":compileKotlinHost") {
|
build(":compileKotlinHost") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
checkNativeCommandLineFor(":compileKotlinHost") {
|
checkNativeCommandLineFor(":compileKotlinHost") {
|
||||||
@@ -413,7 +427,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
// TODO: Reenable the test when the args are separated.
|
// TODO: Reenable the test when the args are separated.
|
||||||
@Ignore
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
fun testNativeFreeArgsWarning() = with(transformProjectWithPluginsDsl("kotlin-dsl", directoryPrefix = "native-binaries")) {
|
fun testNativeFreeArgsWarning() = with(transformNativeTestProjectWithPluginDsl("kotlin-dsl", directoryPrefix = "native-binaries")) {
|
||||||
gradleBuildScript().appendText(
|
gradleBuildScript().appendText(
|
||||||
"""kotlin.targets["macos64"].compilations["main"].kotlinOptions.freeCompilerArgs += "-opt""""
|
"""kotlin.targets["macos64"].compilations["main"].kotlinOptions.freeCompilerArgs += "-opt""""
|
||||||
)
|
)
|
||||||
@@ -459,9 +473,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNativeTests() = with(Project("native-tests")) {
|
fun testNativeTests() = with(transformNativeTestProject("native-tests")) {
|
||||||
setupWorkingDir()
|
|
||||||
configureSingleNativeTarget()
|
|
||||||
val testTasks = listOf("hostTest", "iosTest")
|
val testTasks = listOf("hostTest", "iosTest")
|
||||||
val hostTestTask = "hostTest"
|
val hostTestTask = "hostTest"
|
||||||
|
|
||||||
@@ -588,7 +600,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNativeTestGetters() = with(Project("native-tests")) {
|
fun testNativeTestGetters() = with(transformNativeTestProject("native-tests")) {
|
||||||
// Check that test binaries can be accessed in a buildscript.
|
// Check that test binaries can be accessed in a buildscript.
|
||||||
build("checkNewGetters") {
|
build("checkNewGetters") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -636,8 +648,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
@Test
|
@Test
|
||||||
fun kt33750() {
|
fun kt33750() {
|
||||||
// Check that build fails if a test executable crashes.
|
// Check that build fails if a test executable crashes.
|
||||||
with(Project("native-tests")) {
|
with(transformNativeTestProject("native-tests")) {
|
||||||
setupWorkingDir()
|
|
||||||
projectDir.resolve("src/commonTest/kotlin/test.kt").appendText("\nval fail: Int = error(\"\")\n")
|
projectDir.resolve("src/commonTest/kotlin/test.kt").appendText("\nval fail: Int = error(\"\")\n")
|
||||||
build("check") {
|
build("check") {
|
||||||
assertFailed()
|
assertFailed()
|
||||||
@@ -648,9 +659,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCinterop() {
|
fun testCinterop() {
|
||||||
with(transformProjectWithPluginsDsl("native-cinterop")) {
|
with(transformNativeTestProjectWithPluginDsl("native-cinterop")) {
|
||||||
configureSingleNativeTarget()
|
|
||||||
|
|
||||||
build(":build") {
|
build(":build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertFileExists("build/libs/host/main/native-cinterop-cinterop-number.klib")
|
assertFileExists("build/libs/host/main/native-cinterop-cinterop-number.klib")
|
||||||
@@ -761,8 +770,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNativeArgsWithSpaces() = with(Project("sample-lib", directoryPrefix = "new-mpp-lib-and-app")) {
|
fun testNativeArgsWithSpaces() = with(transformNativeTestProject("sample-lib", directoryPrefix = "new-mpp-lib-and-app")) {
|
||||||
setupWorkingDir()
|
|
||||||
val compilcatedDirectoryName = if (HostManager.hostIsMingw) {
|
val compilcatedDirectoryName = if (HostManager.hostIsMingw) {
|
||||||
// Windows doesn't allow creating a file with " in its name.
|
// Windows doesn't allow creating a file with " in its name.
|
||||||
"path with spaces"
|
"path with spaces"
|
||||||
|
|||||||
+2
@@ -44,6 +44,7 @@ class NativePlatformLibsIT : BaseGradleIT() {
|
|||||||
"kotlin.$it()"
|
"kotlin.$it()"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
configureMemoryInGradleProperties()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteInstalledCompilers() {
|
private fun deleteInstalledCompilers() {
|
||||||
@@ -92,6 +93,7 @@ class NativePlatformLibsIT : BaseGradleIT() {
|
|||||||
|
|
||||||
val rootProject = Project("native-platform-libraries").apply {
|
val rootProject = Project("native-platform-libraries").apply {
|
||||||
embedProject(Project("native-platform-libraries"), renameTo = "subproject")
|
embedProject(Project("native-platform-libraries"), renameTo = "subproject")
|
||||||
|
configureMemoryInGradleProperties()
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
|
|
||||||
gradleBuildScript().appendText("\nkotlin.linuxX64()\n")
|
gradleBuildScript().appendText("\nkotlin.linuxX64()\n")
|
||||||
|
|||||||
-1
@@ -1 +0,0 @@
|
|||||||
kotlin.native.disableCompilerDaemon=true
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
kotlin.native.disableCompilerDaemon=true
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
kotlin.native.disableCompilerDaemon=true
|
|
||||||
-1
@@ -1,3 +1,2 @@
|
|||||||
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
kotlin.native.disableCompilerDaemon=true
|
|
||||||
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
||||||
-1
@@ -1,3 +1,2 @@
|
|||||||
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
kotlin.native.disableCompilerDaemon=true
|
|
||||||
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
||||||
-1
@@ -1,3 +1,2 @@
|
|||||||
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
kotlin.native.disableCompilerDaemon=true
|
|
||||||
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
||||||
-1
@@ -1,3 +1,2 @@
|
|||||||
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
kotlin.native.disableCompilerDaemon=true
|
|
||||||
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
||||||
Reference in New Issue
Block a user