From 0e879896e0697bf1d6fd9ef827e2f9835f2effb1 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Mon, 26 Feb 2018 13:14:28 +0300 Subject: [PATCH] Add include/kotlin-compiler project Needed to include kotlin compiler project into a composite build (kotlin native + cotlin compiler) --- include/kotlin-compiler/build.gradle.kts | 44 ++++++++++++++++++++++++ settings.gradle | 1 + 2 files changed, 45 insertions(+) create mode 100644 include/kotlin-compiler/build.gradle.kts diff --git a/include/kotlin-compiler/build.gradle.kts b/include/kotlin-compiler/build.gradle.kts new file mode 100644 index 00000000000..6d26f867b97 --- /dev/null +++ b/include/kotlin-compiler/build.gradle.kts @@ -0,0 +1,44 @@ + +plugins { + kotlin("jvm") +} + +val compile by configurations +val fatJarContents by configurations.creating +val fatJarContentsStripMetadata by configurations.creating +val fatJarContentsStripServices by configurations.creating + +val compilerModules: Array by rootProject.extra +val compilerManifestClassPath = "kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar" + +dependencies { + compilerModules.forEach { module -> + compile(project(module)) { isTransitive = false } + } + + fatJarContents(project(":core:builtins", configuration = "builtins")) + fatJarContents(commonDep("javax.inject")) + fatJarContents(commonDep("org.jline", "jline")) + fatJarContents(commonDep("org.fusesource.jansi", "jansi")) + fatJarContents(protobufFull()) + fatJarContents(commonDep("com.google.code.findbugs", "jsr305")) + fatJarContents(commonDep("io.javaslang", "javaslang")) + fatJarContents(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } + + fatJarContents(intellijCoreDep()) { includeJars("intellij-core") } + fatJarContents(intellijDep()) { includeIntellijCoreJarDependencies(project, { !(it.startsWith("jdom") || it.startsWith("log4j")) }) } + fatJarContents(intellijDep()) { includeJars("jna-platform") } + fatJarContentsStripServices(intellijDep("jps-standalone")) { includeJars("jps-model") } + fatJarContentsStripMetadata(intellijDep()) { includeJars("oromatcher", "jdom", "log4j") } +} + +val jar: Jar by tasks +jar.apply { + from(compile.filter { it.extension == "jar" }.map { zipTree(it) }) + from(fatJarContents.map { zipTree(it) }) + from(fatJarContentsStripServices.map { zipTree(it) }) { exclude("META-INF/services/**") } + from(fatJarContentsStripMetadata.map { zipTree(it) }) { exclude("META-INF/jb/** META-INF/LICENSE") } + + manifest.attributes["Class-Path"] = compilerManifestClassPath + manifest.attributes["Main-Class"] = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler" +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 30cda7ab9de..9760c79ca5e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -150,6 +150,7 @@ include ":kotlin-build-common", ":kotlin-annotations-jvm", ":kotlin-annotations-android", ":pill:generate-all-tests", + ":include:kotlin-compiler", // plugin markers: ':kotlin-gradle-plugin:plugin-marker',