Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise they would be ignored according .gitignore settings. Probably they should be deleted from repo. Interop/.idea/compiler.xml Interop/.idea/gradle.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml Interop/.idea/modules.xml Interop/.idea/modules/Indexer/Indexer.iml Interop/.idea/modules/Runtime/Runtime.iml Interop/.idea/modules/StubGenerator/StubGenerator.iml backend.native/backend.native.iml backend.native/bc.frontend/bc.frontend.iml backend.native/cli.bc/cli.bc.iml backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt backend.native/tests/link/lib/foo.kt backend.native/tests/link/lib/foo2.kt backend.native/tests/teamcity-test.property
This commit is contained in:
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
import org.jetbrains.kotlin.*
|
||||
import org.jetbrains.kotlin.testing.native.*
|
||||
import org.jetbrains.kotlin.bitcode.CompileToBitcode
|
||||
|
||||
plugins {
|
||||
id("compile-to-bitcode")
|
||||
id("runtime-testing")
|
||||
}
|
||||
|
||||
googletest {
|
||||
revision = project.property("gtestRevision") as String
|
||||
refresh = project.hasProperty("refresh-gtest")
|
||||
}
|
||||
|
||||
fun CompileToBitcode.includeRuntime() {
|
||||
headersDirs += files("../common/src/hash/headers", "src/main/cpp")
|
||||
}
|
||||
|
||||
val hostName: String by project
|
||||
val targetList: List<String> by project
|
||||
|
||||
bitcode {
|
||||
create("runtime", file("src/main")) {
|
||||
dependsOn(
|
||||
":common:${target}Hash",
|
||||
"${target}StdAlloc",
|
||||
"${target}OptAlloc",
|
||||
"${target}Mimalloc",
|
||||
"${target}Launcher",
|
||||
"${target}Debug",
|
||||
"${target}Release",
|
||||
"${target}Strict",
|
||||
"${target}Relaxed",
|
||||
"${target}ProfileRuntime",
|
||||
"${target}Objc",
|
||||
"${target}ExceptionsSupport",
|
||||
"${target}LegacyMemoryManager",
|
||||
"${target}ExperimentalMemoryManager"
|
||||
)
|
||||
includeRuntime()
|
||||
linkerArgs.add(project.file("../common/build/bitcode/main/$target/hash.bc").path)
|
||||
}
|
||||
|
||||
create("mimalloc") {
|
||||
language = CompileToBitcode.Language.C
|
||||
includeFiles = listOf("**/*.c")
|
||||
excludeFiles += listOf("**/alloc-override*.c", "**/page-queue.c", "**/static.c", "**/bitmap.inc.c")
|
||||
srcDirs = files("$srcRoot/c")
|
||||
compilerArgs.addAll(listOf("-DKONAN_MI_MALLOC=1", "-Wno-unknown-pragmas", "-ftls-model=initial-exec",
|
||||
"-Wno-unused-function", "-Wno-error=atomic-alignment",
|
||||
"-Wno-unused-parameter" /* for windows 32*/))
|
||||
headersDirs = files("$srcRoot/c/include")
|
||||
|
||||
onlyIf { targetSupportsMimallocAllocator(target) }
|
||||
}
|
||||
|
||||
create("launcher") {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("debug") {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("std_alloc")
|
||||
create("opt_alloc")
|
||||
|
||||
create("exceptionsSupport", file("src/exceptions_support")) {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("release") {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("strict") {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("relaxed") {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("profileRuntime", file("src/profile_runtime"))
|
||||
|
||||
create("objc") {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("test_support", outputGroup = "test") {
|
||||
includeRuntime()
|
||||
dependsOn("downloadGoogleTest")
|
||||
headersDirs += googletest.headersDirs
|
||||
}
|
||||
|
||||
create("legacy_memory_manager", file("src/legacymm")) {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
create("experimental_memory_manager", file("src/mm")) {
|
||||
includeRuntime()
|
||||
}
|
||||
}
|
||||
|
||||
targetList.forEach { targetName ->
|
||||
createTestTask(
|
||||
project,
|
||||
"StdAlloc",
|
||||
"${targetName}StdAllocRuntimeTests",
|
||||
listOf(
|
||||
"${targetName}Runtime",
|
||||
"${targetName}LegacyMemoryManager",
|
||||
"${targetName}Strict",
|
||||
"${targetName}Release",
|
||||
"${targetName}StdAlloc"
|
||||
)
|
||||
) {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
createTestTask(
|
||||
project,
|
||||
"Mimalloc",
|
||||
"${targetName}MimallocRuntimeTests",
|
||||
listOf(
|
||||
"${targetName}Runtime",
|
||||
"${targetName}LegacyMemoryManager",
|
||||
"${targetName}Strict",
|
||||
"${targetName}Release",
|
||||
"${targetName}Mimalloc",
|
||||
"${targetName}OptAlloc"
|
||||
)
|
||||
) {
|
||||
includeRuntime()
|
||||
}
|
||||
|
||||
createTestTask(
|
||||
project,
|
||||
"ExperimentalMM",
|
||||
"${targetName}ExperimentalMMRuntimeTests",
|
||||
listOf(
|
||||
"${targetName}Runtime",
|
||||
"${targetName}ExperimentalMemoryManager",
|
||||
"${targetName}Release",
|
||||
"${targetName}Mimalloc",
|
||||
"${targetName}OptAlloc"
|
||||
)
|
||||
)
|
||||
|
||||
tasks.register("${targetName}RuntimeTests") {
|
||||
dependsOn("${targetName}StdAllocRuntimeTests")
|
||||
dependsOn("${targetName}MimallocRuntimeTests")
|
||||
dependsOn("${targetName}ExperimentalMMRuntimeTests")
|
||||
}
|
||||
}
|
||||
|
||||
val hostRuntime by tasks.registering {
|
||||
dependsOn("${hostName}Runtime")
|
||||
}
|
||||
|
||||
val hostRuntimeTests by tasks.registering {
|
||||
dependsOn("${hostName}RuntimeTests")
|
||||
}
|
||||
|
||||
val hostStdAllocRuntimeTests by tasks.registering {
|
||||
dependsOn("${hostName}StdAllocRuntimeTests")
|
||||
}
|
||||
|
||||
val hostMimallocRuntimeTests by tasks.registering {
|
||||
dependsOn("${hostName}MimallocRuntimeTests")
|
||||
}
|
||||
|
||||
val hostExperimentalMMRuntimeTests by tasks.registering {
|
||||
dependsOn("${hostName}ExperimentalMMRuntimeTests")
|
||||
}
|
||||
|
||||
val assemble by tasks.registering {
|
||||
dependsOn(tasks.withType(CompileToBitcode::class).matching {
|
||||
it.outputGroup == "main"
|
||||
})
|
||||
}
|
||||
|
||||
val clean by tasks.registering {
|
||||
doLast {
|
||||
delete(buildDir)
|
||||
}
|
||||
}
|
||||
|
||||
val generateJsMath by tasks.registering {
|
||||
dependsOn(":distCompiler")
|
||||
doLast {
|
||||
val distDir: File by project
|
||||
val jsinteropScript = if (PlatformInfo.isWindows()) "jsinterop.bat" else "jsinterop"
|
||||
val jsinterop = "$distDir/bin/$jsinteropScript"
|
||||
val targetDir = "$buildDir/generated"
|
||||
|
||||
project.exec {
|
||||
commandLine(
|
||||
jsinterop,
|
||||
"-pkg", "kotlinx.interop.wasm.math",
|
||||
"-o", "$targetDir/math",
|
||||
"-target", "wasm32"
|
||||
)
|
||||
}
|
||||
|
||||
val generated = file("$targetDir/math-build/natives/js_stubs.js")
|
||||
val mathJs = file("src/main/js/math.js")
|
||||
mathJs.writeText(
|
||||
"// NOTE: THIS FILE IS AUTO-GENERATED!\n" +
|
||||
"// Run ':runtime:generateJsMath' to re-generate it.\n\n"
|
||||
)
|
||||
mathJs.appendText(generated.readText())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user