[K/N] Convert :kotlin-native:backend.native buildscript to kts
Use folder structure from the rest of the project and build it by the bootstrap compiler.
This commit is contained in:
committed by
Space Team
parent
0542b62430
commit
24ede14e37
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/compiler/ir/backend.native/src" isTestSource="false" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
|
||||||
<orderEntry type="module" module-name="backend" />
|
|
||||||
<orderEntry type="module" module-name="frontend" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2023 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.gradle.tasks.KotlinCompilationTask
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
||||||
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
apply from: "../../kotlin-native/gradle/kotlinGradlePlugin.gradle"
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'kotlin'
|
|
||||||
apply plugin: "maven-publish"
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
compiler {
|
|
||||||
kotlin {
|
|
||||||
srcDir 'compiler/ir/backend.native/src/'
|
|
||||||
}
|
|
||||||
resources.srcDir 'compiler/ir/backend.native/resources/'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileCompilerKotlin {
|
|
||||||
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
|
|
||||||
compilerOptions.optIn.addAll([
|
|
||||||
'kotlin.RequiresOptIn',
|
|
||||||
"kotlinx.cinterop.BetaInteropApi",
|
|
||||||
"kotlinx.cinterop.ExperimentalForeignApi",
|
|
||||||
"org.jetbrains.kotlin.backend.konan.InternalKotlinNativeApi",
|
|
||||||
])
|
|
||||||
compilerOptions.freeCompilerArgs.add('-Xskip-prerelease-check')
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(KotlinCompilationTask.class).configureEach {
|
|
||||||
compilerOptions.optIn.add("org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI")
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
kotlin_compiler_jar
|
|
||||||
kotlin_stdlib_jar
|
|
||||||
kotlin_reflect_jar
|
|
||||||
kotlin_script_runtime_jar
|
|
||||||
trove4j_jar
|
|
||||||
|
|
||||||
compilerApiElements {
|
|
||||||
extendsFrom apiElements
|
|
||||||
extendsFrom compilerApi
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
kotlin_compiler_jar kotlinCompilerModule
|
|
||||||
kotlin_stdlib_jar kotlinStdLibModule
|
|
||||||
use(RepoDependencies) {
|
|
||||||
trove4j_jar commonDependency("org.jetbrains.intellij.deps:trove4j")
|
|
||||||
kotlin_reflect_jar commonDependency("org.jetbrains.kotlin:kotlin-reflect")
|
|
||||||
compilerApi(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil")) { setTransitive(false) }
|
|
||||||
compilerApi(commonDependency("org.jetbrains.intellij.deps:log4j")) { setTransitive(false) }
|
|
||||||
compilerApi(commonDependency("org.jetbrains.intellij.deps:jdom"))
|
|
||||||
compilerApi(commonDependency("com.fasterxml:aalto-xml")) { setTransitive(false) }
|
|
||||||
compilerApi(commonDependency("org.codehaus.woodstox:stax2-api")) { setTransitive(false) }
|
|
||||||
}
|
|
||||||
kotlin_script_runtime_jar project(":kotlin-script-runtime")
|
|
||||||
|
|
||||||
compilerApi project(":native:objcexport-header-generator")
|
|
||||||
compilerApi project(":native:objcexport-header-generator-k1")
|
|
||||||
compilerApi project(":native:base")
|
|
||||||
|
|
||||||
compilerApi project(path: ":kotlin-native:llvmInterop", configuration: "llvmInteropStubs")
|
|
||||||
compilerApi project(":native:kotlin-native-utils")
|
|
||||||
compilerApi project(":core:descriptors")
|
|
||||||
compilerApi project(":core:compiler.common.native")
|
|
||||||
compilerApi project(":compiler:ir.tree")
|
|
||||||
compilerApi project(":compiler:ir.backend.common")
|
|
||||||
compilerApi project(":compiler:ir.inline")
|
|
||||||
compilerApi project(":compiler:ir.objcinterop")
|
|
||||||
compilerApi project(":compiler:util")
|
|
||||||
compilerApi project(":native:frontend.native")
|
|
||||||
compilerApi project(":compiler:cli-common")
|
|
||||||
compilerApi project(":compiler:cli-base")
|
|
||||||
compilerApi project(":compiler:cli")
|
|
||||||
compilerApi project(":kotlin-util-klib")
|
|
||||||
compilerApi project(":kotlin-util-klib-metadata")
|
|
||||||
compilerApi project(":compiler:ir.serialization.common")
|
|
||||||
compilerApi project(":compiler:ir.serialization.native")
|
|
||||||
compilerApi project(":compiler:fir:fir-serialization")
|
|
||||||
compilerApi project(":compiler:fir:native")
|
|
||||||
compilerApi project(":compiler:ir.psi2ir")
|
|
||||||
use(IntellijDependenciesKt) {
|
|
||||||
compilerApi(intellijCore())
|
|
||||||
compileOnly(jpsModel())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
classes.dependsOn 'compilerClasses'
|
|
||||||
|
|
||||||
tasks.named("jar") {
|
|
||||||
from sourceSets.compiler.output
|
|
||||||
|
|
||||||
dependsOn 'external_jars'
|
|
||||||
}
|
|
||||||
|
|
||||||
def externalJars = ['compiler', 'stdlib', 'reflect', 'script_runtime']
|
|
||||||
|
|
||||||
tasks.register("trove4jCopy", Copy) {
|
|
||||||
from configurations.named("trove4j_jar") {
|
|
||||||
include "trove4j*.jar"
|
|
||||||
rename "trove4j(.*).jar", "trove4j.jar"
|
|
||||||
|
|
||||||
into 'build/external_jars'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
externalJars.each { arg ->
|
|
||||||
def jar = arg.replace('_', '-') // :(
|
|
||||||
tasks.register("${arg}Copy", Copy) {
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
||||||
from configurations.named("kotlin_${arg}_jar") {
|
|
||||||
include "kotlin-${jar}*.jar"
|
|
||||||
rename "kotlin-${jar}(.*).jar", "kotlin-${jar}.jar"
|
|
||||||
|
|
||||||
into 'build/external_jars'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("external_jars", Copy) {
|
|
||||||
dependsOn externalJars.collect { "${it}Copy" }
|
|
||||||
dependsOn trove4jCopy
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("debugCompiler", JavaExec) {
|
|
||||||
dependsOn ':dist'
|
|
||||||
mainClass = 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
|
|
||||||
classpath = project.fileTree("${distDir.canonicalPath}/konan/lib/") {
|
|
||||||
include '*.jar'
|
|
||||||
}
|
|
||||||
jvmArgs "-Dorg.jetbrains.kotlin.native.home=${distDir.canonicalPath}"
|
|
||||||
enableAssertions = true
|
|
||||||
args = findProperty("konan.debug.args").toString().tokenize() ?: []
|
|
||||||
}
|
|
||||||
|
|
||||||
RepoArtifacts.sourcesJar(project) {
|
|
||||||
it.from(sourceSets["compiler"].allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
RepoArtifacts.javadocJar(project)
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("jvm")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil")) { isTransitive = false }
|
||||||
|
api(commonDependency("org.jetbrains.intellij.deps:log4j")) { isTransitive = false }
|
||||||
|
api(commonDependency("org.jetbrains.intellij.deps:jdom"))
|
||||||
|
api(commonDependency("com.fasterxml:aalto-xml")) { isTransitive = false }
|
||||||
|
api(commonDependency("org.codehaus.woodstox:stax2-api")) { isTransitive = false }
|
||||||
|
|
||||||
|
api(project(":native:objcexport-header-generator"))
|
||||||
|
api(project(":native:objcexport-header-generator-k1"))
|
||||||
|
api(project(":native:base"))
|
||||||
|
|
||||||
|
api(project(":kotlin-native:llvmInterop", "llvmInteropStubs"))
|
||||||
|
api(project(":native:kotlin-native-utils"))
|
||||||
|
api(project(":core:descriptors"))
|
||||||
|
api(project(":core:compiler.common.native"))
|
||||||
|
api(project(":compiler:ir.tree"))
|
||||||
|
api(project(":compiler:ir.backend.common"))
|
||||||
|
api(project(":compiler:ir.inline"))
|
||||||
|
api(project(":compiler:ir.objcinterop"))
|
||||||
|
api(project(":compiler:util"))
|
||||||
|
api(project(":native:frontend.native"))
|
||||||
|
api(project(":compiler:cli-common"))
|
||||||
|
api(project(":compiler:cli-base"))
|
||||||
|
api(project(":compiler:cli"))
|
||||||
|
api(project(":kotlin-util-klib"))
|
||||||
|
api(project(":kotlin-util-klib-metadata"))
|
||||||
|
api(project(":compiler:ir.serialization.common"))
|
||||||
|
api(project(":compiler:ir.serialization.native"))
|
||||||
|
api(project(":compiler:fir:fir-serialization"))
|
||||||
|
api(project(":compiler:fir:native"))
|
||||||
|
api(project(":compiler:ir.psi2ir"))
|
||||||
|
|
||||||
|
api(intellijCore())
|
||||||
|
compileOnly(jpsModel())
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinJvmCompile>().configureEach {
|
||||||
|
compilerOptions.optIn.addAll(
|
||||||
|
listOf(
|
||||||
|
"kotlin.RequiresOptIn",
|
||||||
|
"kotlinx.cinterop.BetaInteropApi",
|
||||||
|
"kotlinx.cinterop.ExperimentalForeignApi",
|
||||||
|
"org.jetbrains.kotlin.backend.konan.InternalKotlinNativeApi",
|
||||||
|
"org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
"main" { projectDefault() }
|
||||||
|
"test" { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar()
|
||||||
|
javadocJar()
|
||||||
@@ -168,6 +168,11 @@ configurations {
|
|||||||
canBeConsumed = false
|
canBeConsumed = false
|
||||||
canBeResolved = true
|
canBeResolved = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trove4j_jar {
|
||||||
|
canBeConsumed = false
|
||||||
|
canBeResolved = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: CompilationDatabasePlugin
|
apply plugin: CompilationDatabasePlugin
|
||||||
@@ -195,6 +200,9 @@ dependencies {
|
|||||||
embeddableJar project(path: ':kotlin-native:prepare:kotlin-native-compiler-embeddable', configuration: 'runtimeElements')
|
embeddableJar project(path: ':kotlin-native:prepare:kotlin-native-compiler-embeddable', configuration: 'runtimeElements')
|
||||||
nativeLibs project(path: ':kotlin-native:common', configuration: 'nativeLibs')
|
nativeLibs project(path: ':kotlin-native:common', configuration: 'nativeLibs')
|
||||||
nativeLibs project(path: ':kotlin-native:llvmInterop', configuration: 'nativeLibs')
|
nativeLibs project(path: ':kotlin-native:llvmInterop', configuration: 'nativeLibs')
|
||||||
|
use(RepoDependencies) {
|
||||||
|
trove4j_jar commonDependency("org.jetbrains.intellij.deps:trove4j")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: GitClangFormatPlugin
|
apply plugin: GitClangFormatPlugin
|
||||||
@@ -284,8 +292,11 @@ tasks.register("distCompiler", Copy) {
|
|||||||
into('konan/nativelib')
|
into('konan/nativelib')
|
||||||
}
|
}
|
||||||
|
|
||||||
from(project(':kotlin-native:backend.native').file('build/external_jars/trove4j.jar')) {
|
from(configurations.trove4j_jar) {
|
||||||
into('konan/lib')
|
include "trove4j*.jar"
|
||||||
|
rename "trove4j(.*).jar", "trove4j.jar"
|
||||||
|
|
||||||
|
into("konan/lib")
|
||||||
}
|
}
|
||||||
|
|
||||||
from(configurations.embeddableJar) {
|
from(configurations.embeddableJar) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kotlin-native:backend.native", "compilerApiElements"))
|
api(project(":kotlin-native:backend.native"))
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ idePluginDependency {
|
|||||||
embedded(project(":compiler:fir:native")) { isTransitive = false }
|
embedded(project(":compiler:fir:native")) { isTransitive = false }
|
||||||
|
|
||||||
proguardLibraryJars(project(":native:kotlin-native-utils")) { isTransitive = false }
|
proguardLibraryJars(project(":native:kotlin-native-utils")) { isTransitive = false }
|
||||||
proguardLibraryJars(project(":kotlin-native:backend.native", "kotlin_stdlib_jar"))
|
proguardLibraryJars(project(":kotlin-stdlib"))
|
||||||
proguardLibraryJars(project(":kotlin-native:backend.native", "kotlin_reflect_jar"))
|
proguardLibraryJars(commonDependency("org.jetbrains.kotlin:kotlin-reflect"))
|
||||||
proguardLibraryJars(project(":native:cli-native"))
|
proguardLibraryJars(project(":native:cli-native"))
|
||||||
backendNativeSourcesConfiguration(project(":kotlin-native:backend.native"))
|
backendNativeSourcesConfiguration(project(":kotlin-native:backend.native"))
|
||||||
backendNativeSourcesConfiguration(project(":native:cli-native"))
|
backendNativeSourcesConfiguration(project(":native:cli-native"))
|
||||||
|
|||||||
@@ -882,6 +882,7 @@ if (buildProperties.isKotlinNativeEnabled) {
|
|||||||
include ':kotlin-native:endorsedLibraries:kotlinx.cli'
|
include ':kotlin-native:endorsedLibraries:kotlinx.cli'
|
||||||
include ':kotlin-native:Interop:StubGenerator'
|
include ':kotlin-native:Interop:StubGenerator'
|
||||||
include ':kotlin-native:backend.native'
|
include ':kotlin-native:backend.native'
|
||||||
|
project(':kotlin-native:backend.native').projectDir = "$rootDir/kotlin-native/backend.native/compiler/ir/backend.native" as File
|
||||||
include ':kotlin-native:Interop:Runtime'
|
include ':kotlin-native:Interop:Runtime'
|
||||||
include ':kotlin-native:Interop:Indexer'
|
include ':kotlin-native:Interop:Indexer'
|
||||||
include ':kotlin-native:Interop:JsRuntime'
|
include ':kotlin-native:Interop:JsRuntime'
|
||||||
@@ -897,6 +898,7 @@ if (buildProperties.isKotlinNativeEnabled) {
|
|||||||
include ':kotlin-native:libclangext'
|
include ':kotlin-native:libclangext'
|
||||||
include ':kotlin-native:llvmInterop'
|
include ':kotlin-native:llvmInterop'
|
||||||
include ':kotlin-native:backend.native:tests'
|
include ':kotlin-native:backend.native:tests'
|
||||||
|
project(':kotlin-native:backend.native:tests').projectDir = "$rootDir/kotlin-native/backend.native/tests" as File
|
||||||
include ':kotlin-native:prepare:kotlin-native-compiler-embeddable'
|
include ':kotlin-native:prepare:kotlin-native-compiler-embeddable'
|
||||||
include ':native:kotlin-test-native-xctest'
|
include ':native:kotlin-test-native-xctest'
|
||||||
include ':native:cli-native'
|
include ':native:cli-native'
|
||||||
|
|||||||
Reference in New Issue
Block a user