Support OptionalExpectation in native
This commit is contained in:
+1
-1
@@ -146,7 +146,7 @@ internal class KonanInteropRunner(project: Project, additionalJvmArgs: List<Stri
|
||||
if (HostManager.host == KonanTarget.MINGW_X64) {
|
||||
//TODO: Oh-ho-ho fix it in more convinient way.
|
||||
environment.put("PATH", DependencyDirectories.defaultDependenciesRoot.absolutePath +
|
||||
"\\msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64" +
|
||||
"\\msys2-mingw-w64-x86_64-gcc-7.3.0-clang-llvm-lld-6.0.1" +
|
||||
"\\bin;${environment.get("PATH")}")
|
||||
}
|
||||
}
|
||||
|
||||
+12
-5
@@ -11,6 +11,8 @@ import org.gradle.api.NamedDomainObjectContainer
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.AttributeContainer
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.file.FileTree
|
||||
import org.gradle.api.file.SourceDirectorySet
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.SourceSetOutput
|
||||
import org.gradle.util.ConfigureUtil
|
||||
@@ -272,11 +274,14 @@ class KotlinNativeCompilation(
|
||||
private val project: Project
|
||||
get() = target.project
|
||||
|
||||
// A FileCollection containing source files from all source sets used by this compilation
|
||||
// A collection containing all source sets used by this compilation
|
||||
// (taking into account dependencies between source sets). Used by both compilation
|
||||
// and linking tasks.
|
||||
// and linking tasks. Unlike kotlinSourceSets, includes dependency source sets.
|
||||
// TODO: Move into the compilation task when the linking task does klib linking instead of compilation.
|
||||
internal var allSources: FileCollection = target.project.files()
|
||||
internal val allSources: MutableSet<SourceDirectorySet> = mutableSetOf()
|
||||
|
||||
// TODO: Move into the compilation task when the linking task does klib linking instead of compilation.
|
||||
internal val commonSources: MutableSet<SourceDirectorySet> = mutableSetOf()
|
||||
|
||||
var isTestCompilation = false
|
||||
|
||||
@@ -399,8 +404,10 @@ class KotlinNativeCompilation(
|
||||
)
|
||||
|
||||
override fun addSourcesToCompileTask(sourceSet: KotlinSourceSet, addAsCommonSources: Boolean) {
|
||||
// TODO: support optional expectations
|
||||
allSources += sourceSet.kotlin
|
||||
allSources.add(sourceSet.kotlin)
|
||||
if (addAsCommonSources) {
|
||||
commonSources.add(sourceSet.kotlin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -96,13 +96,13 @@ open class KotlinNativeCompile : AbstractCompile() {
|
||||
lateinit var outputKind: CompilerOutputKind
|
||||
|
||||
// Inputs and outputs
|
||||
@InputFiles
|
||||
@SkipWhenEmpty
|
||||
override fun getSource(): FileTree = project.files(compilation.allSources).asFileTree
|
||||
|
||||
override fun getSource(): FileTree = sources.asFileTree
|
||||
|
||||
val sources: FileCollection
|
||||
@InputFiles
|
||||
@SkipWhenEmpty
|
||||
get() = compilation.allSources
|
||||
private val commonSources: FileCollection
|
||||
// Already taken into account in getSources method.
|
||||
get() = project.files(compilation.commonSources).asFileTree
|
||||
|
||||
val libraries: FileCollection
|
||||
@InputFiles get() = compilation.compileDependencyFiles
|
||||
@@ -190,7 +190,7 @@ open class KotlinNativeCompile : AbstractCompile() {
|
||||
// Language features.
|
||||
addArgIfNotNull("-language-version", languageVersion)
|
||||
addArgIfNotNull("-api-version", apiVersion)
|
||||
addKey("-Xprogressive", progressiveMode)
|
||||
addKey("-progressive", progressiveMode)
|
||||
enabledLanguageFeatures.forEach { featureName ->
|
||||
add("-XXLanguage:+$featureName")
|
||||
}
|
||||
@@ -221,11 +221,11 @@ open class KotlinNativeCompile : AbstractCompile() {
|
||||
addArg("-friend-modules", friends.map { it.absolutePath }.joinToString(File.pathSeparator))
|
||||
}
|
||||
|
||||
addListArg("-linkerOpts", linkerOpts)
|
||||
addListArg("-linker-options", linkerOpts)
|
||||
|
||||
// Sources.
|
||||
// TODO: Filter only kt files?
|
||||
addAll(sources.files.map { it.absolutePath })
|
||||
addAll(getSource().map { it.absolutePath })
|
||||
add("-Xcommon-sources=${commonSources.map { it.absolutePath }.joinToString(separator = ",")}")
|
||||
}
|
||||
|
||||
KonanCompilerRunner(project).run(args)
|
||||
|
||||
Reference in New Issue
Block a user