220 lines
6.5 KiB
Groovy
220 lines
6.5 KiB
Groovy
import org.jetbrains.kotlin.CopyCommonSources
|
|
import org.jetbrains.kotlin.konan.target.HostManager
|
|
import org.jetbrains.kotlin.*
|
|
import org.jetbrains.gradle.plugins.tools.*
|
|
/*
|
|
* Copyright 2010-2018 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.
|
|
*/
|
|
buildscript {
|
|
apply from: "../../kotlin-native/gradle/kotlinGradlePlugin.gradle"
|
|
apply plugin: 'project-report'
|
|
}
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'kotlin'
|
|
apply plugin: org.jetbrains.kotlin.NativeInteropPlugin
|
|
apply plugin: "maven-publish"
|
|
|
|
sourceSets {
|
|
compiler {
|
|
kotlin {
|
|
srcDir 'compiler/ir/backend.native/src/'
|
|
srcDir '../shared/src/main/kotlin'
|
|
srcDir '../shared/src/library/kotlin'
|
|
srcDir(VersionGeneratorKt.kotlinNativeVersionSrc(project))
|
|
}
|
|
resources.srcDir 'compiler/ir/backend.native/resources/'
|
|
/* PATH to META-INF */
|
|
resources.srcDir VersionGeneratorKt.kotlinNativeVersionResourceFile(project).parentFile.parent
|
|
}
|
|
cli_bc {
|
|
kotlin.srcDir 'cli.bc/src'
|
|
}
|
|
}
|
|
|
|
compileCompilerKotlin {
|
|
kotlinOptions.jvmTarget = "1.8"
|
|
kotlinOptions.allWarningsAsErrors=true
|
|
kotlinOptions.freeCompilerArgs += ['-opt-in=kotlin.RequiresOptIn', '-opt-in=org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI', '-Xskip-prerelease-check']
|
|
}
|
|
|
|
compileCli_bcKotlin {
|
|
kotlinOptions.freeCompilerArgs += ['-Xskip-prerelease-check']
|
|
}
|
|
|
|
kotlinNativeInterop {
|
|
llvm {
|
|
|
|
dependsOn ":kotlin-native:llvmDebugInfoC:${NativePluginKt.lib("debugInfo")}"
|
|
dependsOn ":kotlin-native:llvmCoverageMappingC:${NativePluginKt.lib("coverageMapping")}"
|
|
defFile 'llvm.def'
|
|
compilerOpts "-I$llvmDir/include", "-I${rootProject.project(':kotlin-native:llvmDebugInfoC').projectDir}/src/main/include", "-I${rootProject.project(':kotlin-native:llvmCoverageMappingC').projectDir}/src/main/include"
|
|
linkerOpts "-L$llvmDir/lib", "-L${rootProject.project(':kotlin-native:llvmDebugInfoC').buildDir}", "-L${rootProject.project(':kotlin-native:llvmCoverageMappingC').buildDir}"
|
|
}
|
|
|
|
files {
|
|
linker 'clang++'
|
|
linkOutputs ":kotlin-native:common:${hostName}Files"
|
|
|
|
headers fileTree('../common/src/files/headers') {
|
|
include '**/*.h'
|
|
include '**/*.hpp'
|
|
}
|
|
|
|
pkg 'org.jetbrains.kotlin.backend.konan.files'
|
|
}
|
|
|
|
|
|
env {
|
|
linker 'clang++'
|
|
linkOutputs ":kotlin-native:common:${hostName}Env"
|
|
|
|
headers fileTree('../common/src/env/headers') {
|
|
include '**/*.h'
|
|
include '**/*.hpp'
|
|
}
|
|
|
|
pkg 'org.jetbrains.kotlin.backend.konan.env'
|
|
}
|
|
}
|
|
|
|
|
|
configurations {
|
|
kotlin_compiler_jar
|
|
kotlin_stdlib_jar
|
|
kotlin_reflect_jar
|
|
kotlin_script_runtime_jar
|
|
trove4j_jar
|
|
kotlinCommonSources
|
|
|
|
cli_bcApiElements {
|
|
extendsFrom cli_bcApi
|
|
}
|
|
|
|
cli_bcApi.extendsFrom compilerApi
|
|
}
|
|
|
|
dependencies {
|
|
trove4j_jar "org.jetbrains.intellij.deps:trove4j:1.0.20181211@jar"
|
|
kotlin_compiler_jar project(kotlinCompilerModule)
|
|
kotlin_stdlib_jar kotlinStdLibModule
|
|
kotlin_reflect_jar kotlinReflectModule
|
|
kotlin_script_runtime_jar project(":kotlin-script-runtime")
|
|
|
|
[kotlinCommonStdlibModule, kotlinTestCommonModule, kotlinTestAnnotationsCommonModule].each {
|
|
kotlinCommonSources(it) { transitive = false }
|
|
}
|
|
|
|
compilerApi project(":kotlin-native:utilities:basic-utils")
|
|
|
|
compilerApi project(kotlinCompilerModule)
|
|
compilerApi project(":native:kotlin-native-utils")
|
|
compilerApi project(":core:descriptors")
|
|
compilerApi project(":compiler:ir.tree")
|
|
compilerApi project(":compiler:ir.tree.impl")
|
|
compilerApi project(":compiler:ir.backend.common")
|
|
compilerApi project(":compiler:util")
|
|
compilerApi project(":native:frontend.native")
|
|
compilerApi project(":compiler:cli-common")
|
|
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.psi2ir")
|
|
use(LocalDependenciesKt) {
|
|
compilerApi(intellijCoreDep()){
|
|
artifact {
|
|
name = "intellij-core"
|
|
type = "jar"
|
|
}
|
|
}
|
|
compilerApi(intellijDep()){
|
|
artifact {
|
|
name = "util"
|
|
type = "jar"
|
|
//extention = "jar"
|
|
}
|
|
}
|
|
compileOnly(jpsStandalone())
|
|
}
|
|
|
|
compilerApi kotlinNativeInterop['llvm'].configuration
|
|
compilerApi kotlinNativeInterop['files'].configuration
|
|
compilerApi kotlinNativeInterop['env'].configuration
|
|
|
|
|
|
cli_bcApi sourceSets.compiler.output
|
|
|
|
cli_bcApiElements sourceSets.cli_bc.output
|
|
}
|
|
|
|
|
|
classes.dependsOn 'compilerClasses', 'cli_bcClasses'
|
|
|
|
jar {
|
|
from sourceSets.cli_bc.output,
|
|
sourceSets.compiler.output,
|
|
sourceSets.filesInteropStubs.output,
|
|
sourceSets.envInteropStubs.output,
|
|
sourceSets.llvmInteropStubs.output
|
|
|
|
dependsOn ':kotlin-native:runtime:hostRuntime', 'external_jars'
|
|
}
|
|
|
|
def externalJars = ['compiler', 'stdlib', 'reflect', 'script_runtime']
|
|
|
|
task trove4jCopy(type: Copy) {
|
|
from configurations.getByName("trove4j_jar") {
|
|
include "trove4j*.jar"
|
|
rename "trove4j(.*).jar", "trove4j.jar"
|
|
|
|
into 'build/external_jars'
|
|
}
|
|
}
|
|
|
|
externalJars.each { arg ->
|
|
def jar = arg.replace('_', '-') // :(
|
|
task("${arg}Copy", type: Copy) {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
from configurations.getByName("kotlin_${arg}_jar") {
|
|
include "kotlin-${jar}*.jar"
|
|
rename "kotlin-${jar}(.*).jar", "kotlin-${jar}.jar"
|
|
|
|
into 'build/external_jars'
|
|
}
|
|
}
|
|
}
|
|
|
|
task external_jars(type: Copy) {
|
|
dependsOn externalJars.collect { "${it}Copy" }
|
|
dependsOn trove4jCopy
|
|
}
|
|
|
|
task debugCompiler(type: JavaExec) {
|
|
dependsOn ':dist'
|
|
main = '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() ?: []
|
|
}
|
|
|
|
publishing {
|
|
repositories {
|
|
maven { url = "$buildDir/repo" }
|
|
}
|
|
|
|
publications {
|
|
maven(MavenPublication) {
|
|
groupId = 'org.jetbrains.kotlin'
|
|
artifactId = 'backend.native'
|
|
version = konanVersionFull
|
|
|
|
from components.java
|
|
}
|
|
}
|
|
}
|