[K/N] Move files, env interop generation to kotlin-native/common/

This commit is contained in:
Alexander Shabalin
2024-03-02 00:15:09 +01:00
committed by Space Team
parent 9f0a6537bb
commit ab62632a85
4 changed files with 52 additions and 66 deletions
-61
View File
@@ -5,9 +5,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.PlatformInfo
import org.jetbrains.kotlin.cpp.CppConsumerPlugin
import org.jetbrains.kotlin.cpp.CppUsage
import org.jetbrains.kotlin.cpp.DependencyHandlerExKt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.tools.NativePluginKt
@@ -20,7 +17,6 @@ apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: "native-interop-plugin"
apply plugin: "maven-publish"
apply plugin: CppConsumerPlugin
sourceSets {
compiler {
@@ -46,8 +42,6 @@ compileCompilerKotlin {
}
def tasksWithoutOptInUsage = [
"compileEnvInteropStubsKotlin",
"compileFilesInteropStubsKotlin",
"compileLlvmInteropStubsKotlin"
]
tasks.withType(KotlinCompilationTask.class).configureEach {
@@ -60,30 +54,6 @@ compileCli_bcKotlin {
compilerOptions.freeCompilerArgs.add('-Xskip-prerelease-check')
}
configurations {
commonFilesBitcode {
canBeConsumed = false
canBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, CppUsage.LLVM_BITCODE))
}
}
commonEnvBitcode {
canBeConsumed = false
canBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, CppUsage.LLVM_BITCODE))
}
}
}
dependencies {
use(DependencyHandlerExKt) {
commonFilesBitcode module(project(":kotlin-native:common"), "files")
commonEnvBitcode module(project(":kotlin-native:common"), "env")
}
}
kotlinNativeInterop {
llvm {
@@ -104,40 +74,11 @@ kotlinNativeInterop {
}
linkerOpts "-L$llvmDir/lib", "-L${rootProject.project(':kotlin-native:llvmDebugInfoC').layout.buildDirectory.get().asFile}", "-L${rootProject.project(':kotlin-native:libllvmext').layout.buildDirectory.get().asFile}"
}
files {
linker 'clang++'
link configurations.commonFilesBitcode
// TODO: These should come from some sort of commonFilesApi configuration
headers fileTree('../common/src/files/headers') {
include '**/*.h'
include '**/*.hpp'
}
pkg 'org.jetbrains.kotlin.backend.konan.files'
}
env {
linker 'clang++'
link configurations.commonEnvBitcode
// TODO: These should come from some sort of commonEnvApi configuration
headers fileTree('../common/src/env/headers') {
include '**/*.h'
include '**/*.hpp'
}
pkg 'org.jetbrains.kotlin.backend.konan.env'
}
}
configurations {
compilerApi {
extendsFrom kotlinNativeInterop['llvm'].configuration
extendsFrom kotlinNativeInterop['files'].configuration
extendsFrom kotlinNativeInterop['env'].configuration
}
kotlin_compiler_jar
kotlin_stdlib_jar
@@ -204,8 +145,6 @@ classes.dependsOn 'compilerClasses', 'cli_bcClasses'
tasks.named("jar") {
from sourceSets.cli_bc.output,
sourceSets.compiler.output,
sourceSets.filesInteropStubs.output,
sourceSets.envInteropStubs.output,
sourceSets.llvmInteropStubs.output
dependsOn 'external_jars'