diff --git a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/CMakeSpecification.groovy b/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/CMakeSpecification.groovy deleted file mode 100644 index 45d8accc6cb..00000000000 --- a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/CMakeSpecification.groovy +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.gradle.plugin.test - -import org.jetbrains.kotlin.konan.target.Family -import org.jetbrains.kotlin.konan.target.HostManager - -class CMakeSpecification extends BaseKonanSpecification { - def 'Plugin should generate CMake from project without additional settings'() { - when: - def sdlIncludePath - def sdlLinkOptions - switch (HostManager.host.family) { - case Family.MINGW: - sdlIncludePath = "C:/SDL2/include" - sdlLinkOptions = "C:/SDL2/lib" - break - case Family.OSX: - sdlIncludePath = "/usr/include/SDL2" - sdlLinkOptions = "-F /Library/Frameworks -framework SDL2" - break - case Family.LINUX: - sdlIncludePath = "/usr/include/SDL2" - sdlLinkOptions = "-L/usr/lib/x86_64-linux-gnu" - break - default: - throw IllegalStateException("Unknown host: ${HostManager.hostName}") - break - } - - def project = KonanProject.createEmpty(projectDirectory) { KonanProject it -> - it.buildFile.write(""" - plugins { id 'konan' } - konanArtifacts { - interop('stdio') - interop('sdl') { - defFile 'src/main/c_interop/sdl.def' - target('mingw') { includeDirs 'C:/SDL2/include' } - target('macbook') { includeDirs '/usr/include/SDL2' } - target('linux') { includeDirs '/usr/include/SDL2' } - } - library('main_lib') - program('Main') { - libraries { - artifact 'stdio' - artifact 'main_lib' - target('mingw') { linkerOpts 'C:/SDL2/lib' } - target('macbook') { linkerOpts '-F /Library/Frameworks -framework SDL2' } - target('linux') { linkerOpts '-L/usr/lib/x86_64-linux-gnu' } - } - } - } - """.stripIndent()) - it.generateDefFile("stdio.def", "") - it.generateSrcFile("main.kt") - } - project.createRunner().withArguments('generateCMake').build() - - def cMakeModule = new File(projectDirectory, "KotlinCMakeModule") - def cMakeLists = new File(projectDirectory, "CMakeLists.txt") - def expectedCMakeLists = """ - cmake_minimum_required(VERSION 3.8) - - set(CMAKE_MODULE_PATH \${CMAKE_CURRENT_LIST_DIR}/KotlinCMakeModule) - - project(${projectDirectory.name} Kotlin) - - cinterop( - NAME sdl - DEF_FILE src/main/c_interop/sdl.def - COMPILER_OPTS -I$sdlIncludePath) - - cinterop( - NAME stdio - DEF_FILE src/main/c_interop/stdio.def) - - konanc_library( - NAME main_lib - SOURCES src/main/kotlin/main.kt) - - konanc_executable( - NAME Main - SOURCES src/main/kotlin/main.kt - LIBRARIES stdio main_lib - LINKER_OPTS $sdlLinkOptions) - """.stripIndent().trim() - - then: - cMakeModule.exists() - cMakeLists.exists() - - def actualCMakeLists = cMakeLists.text.trim().replace('\r\n', '\n') - actualCMakeLists == expectedCMakeLists - } - -} diff --git a/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt b/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt index 3ad8cec6ae5..135888213b5 100644 --- a/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt +++ b/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt @@ -413,7 +413,7 @@ class ExperimentalPluginTests { hosts.map { HostManager().targetByName(it) }.forEach { val task = tasks.findByName("compileDebug${it.name.capitalize()}KotlinNative") - if (it == HostManager.host) { + if (HostManager().enabled.contains(it)) { assertNotNull(task) } else { assertNull(task)