提交 61dfb75e 编写于 作者: I Ilya Chernikov

Implement Gradle Kotlin DSL build

上级 f5d6e419
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(commonDep("org.apache.ant", "ant"))
compile(project(":compiler:preloader"))
compile(kotlinDep("stdlib"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin Ant Tools")
archiveName = "kotlin-ant.jar"
from("$projectDir/src") { include("**/*.xml") }
manifest.attributes.put("Class-Path", "kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar kotlin-preloader.jar")
}
dist {
from(jar)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":core:util.runtime"))
compile(project(":compiler:util"))
compile(project(":compiler:cli-common"))
compile(project(":compiler:frontend.java"))
compile(ideaSdkDeps("util"))
buildVersion()
testCompile(commonDep("junit:junit"))
testCompile(project(":compiler.tests-common"))
testCompile(protobufFull())
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin Build Common")
baseName = "kotlin-build-common"
}
testsJar {}
tasks.withType<Test> {
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
import java.util.*
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.java
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
buildscript {
extra["kotlin_version"] = file("kotlin-bootstrap-version.txt").readText().trim()
extra["kotlinVersion"] = extra["kotlin_version"]
extra["kotlin_language_version"] = "1.1"
extra["kotlin_gradle_plugin_version"] = extra["kotlin_version"]
extra["repos"] = listOf("https://dl.bintray.com/kotlin/kotlin-dev",
"https://repo.gradle.org/gradle/repo",
"https://plugins.gradle.org/m2")
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
}
}
dependencies {
classpath(kotlinDep("gradle-plugin"))
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
}
}
plugins {
java // so we can benefit from the `java()` accessor below
}
val buildNumber = "1.1-SNAPSHOT"
extra["build.number"] = buildNumber
extra["kotlin_root"] = rootDir
val bootstrapCompileCfg = configurations.create("bootstrapCompile")
val scriptCompileCfg = configurations.create("scriptCompile").extendsFrom(bootstrapCompileCfg)
val scriptRuntimeCfg = configurations.create("scriptRuntime").extendsFrom(scriptCompileCfg)
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
}
}
dependencies {
bootstrapCompileCfg(kotlinDep("compiler-embeddable"))
}
val commonBuildDir = File(rootDir, "build")
val distDir = "$rootDir/dist"
val distLibDir = "$distDir/kotlinc/lib"
val ideaPluginDir = "$distDir/artifacts/Kotlin"
extra["distDir"] = distDir
extra["distLibDir"] = project.file(distLibDir)
extra["libsDir"] = project.file(distLibDir)
extra["ideaPluginDir"] = project.file(ideaPluginDir)
Properties().apply {
load(File(rootDir, "resources", "kotlinManifest.properties").reader())
forEach {
val key = it.key
if (key != null && key is String)
extra[key] = it.value
}
}
extra["JDK_16"] = jdkPath("1.6")
extra["JDK_17"] = jdkPath("1.7")
extra["JDK_18"] = jdkPath("1.8")
extra["compilerBaseName"] = "kotlin-compiler"
extra["embeddableCompilerBaseName"] = "kotlin-compiler-embeddable"
//extra["compilerJarWithBootstrapRuntime"] = project.file("$distDir/kotlin-compiler-with-bootstrap-runtime.jar")
//extra["bootstrapCompilerFile"] = bootstrapCfg.files.first().canonicalPath
extra["buildLocalRepoPath"] = File(commonBuildDir, "repo")
extra["versions.protobuf-java"] = "2.6.1"
extra["versions.javax.inject"] = "1"
extra["versions.jsr305"] = "1.3.9"
extra["versions.cli-parser"] = "1.1.2"
extra["versions.jansi"] = "1.11"
extra["versions.jline"] = "2.12.1"
extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["ideaCoreSdkJars"] = arrayOf("annotations", "asm-all", "guava", "intellij-core", "jdom", "jna", "log4j", "picocontainer",
"snappy-in-java", "trove4j", "xpp3-1.1.4-min", "xstream")
extra["compilerModules"] = arrayOf(":compiler:util",
":compiler:container",
":compiler:resolution",
":compiler:serialization",
":compiler:frontend",
":compiler:frontend.java",
":compiler:frontend.script",
":compiler:cli-common",
":compiler:daemon-common",
":compiler:ir.tree",
":compiler:ir.psi2ir",
":compiler:backend-common",
":compiler:backend",
":compiler:plugin-api",
":compiler:light-classes",
":compiler:cli",
":compiler:incremental-compilation-impl",
":js:js.ast",
":js:js.serializer",
":js:js.parser",
":js:js.frontend",
":js:js.translator",
":js:js.dce",
":compiler",
":build-common",
":core:util.runtime",
":core")
allprojects {
group = "org.jetbrains.kotlin"
version = buildNumber
}
applyFrom("libraries/commonConfiguration.gradle")
applyFrom("libraries/gradlePluginsConfiguration.gradle")
applyFrom("libraries/configureGradleTools.gradle")
val importedAntTasksPrefix = "imported-ant-update-"
// TODO: check the reasons of import conflict with xerces
//ant.importBuild("$rootDir/update_dependencies.xml") { antTaskName -> importedAntTasksPrefix + antTaskName }
tasks.matching { task ->
task.name.startsWith(importedAntTasksPrefix)
}.forEach {
it.group = "Imported ant"
}
//task("update-dependencies") {
// dependsOn(tasks.getByName(importedAntTasksPrefix + "update"))
//}
//val prepareBootstrapTask = task("prepareBootstrap") {
// dependsOn(bootstrapCfg, scriptCompileCfg, scriptRuntimeCfg)
//}
fun Project.allprojectsRecursive(body: Project.() -> Unit) {
this.body()
this.subprojects { allprojectsRecursive(body) }
}
allprojects {
setBuildDir(File(commonBuildDir, project.name))
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
}
mavenCentral()
jcenter()
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package", "-module-name", project.name)
}
tasks.withType<Kotlin2JsCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package", "-module-name", project.name)
}
task<Jar>("javadocJar") {
classifier = "javadoc"
}
}
task<Copy>("dist") {
into(distDir)
from(files("compiler/cli/bin")) { into("kotlinc/bin") }
}
val compilerCopyTask = task<Copy>("idea-plugin-copy-compiler") {
dependsOnTaskIfExistsRec("dist")
into(ideaPluginDir)
from(distDir) { include("kotlinc/**") }
}
task<Copy>("dist-plugin") {
dependsOn(compilerCopyTask)
dependsOnTaskIfExistsRec("idea-plugin")
into("$ideaPluginDir/lib")
}
val clean by tasks
clean.apply {
doLast {
delete("${buildDir}/repo")
}
}
fun jdkPath(version: String): String {
val varName = "JDK_${version.replace(".", "")}"
return System.getenv(varName) ?: throw GradleException ("Please set environment variable $varName to point to JDK $version installation")
}
buildscript {
extra["kotlin_version"] = file("../kotlin-version-for-gradle.txt").readText().trim()
extra["kotlin_gradle_plugin_version"] = extra["kotlin_version"]
extra["repos"] = listOf(
"https://dl.bintray.com/kotlin/kotlin-dev",
"https://repo.gradle.org/gradle/repo",
"https://plugins.gradle.org/m2",
"http://repository.jetbrains.com/utils/")
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["kotlin_version"]}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${rootProject.extra["kotlin_version"]}")
}
}
apply {
plugin("kotlin")
plugin("kotlin-sam-with-receiver")
}
plugins {
`kotlin-dsl`
}
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
}
}
dependencies {
// TODO: adding the dep to the plugin breaks the build unexpectedly, resolve and uncomment
// compile("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["kotlin_version"]}")
}
samWithReceiver {
annotation("org.gradle.api.HasImplicitReceiver")
}
fun Project.`samWithReceiver`(configure: org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverExtension.() -> Unit): Unit =
extensions.configure("samWithReceiver", configure)
rootProject.buildFileName = 'build.gradle.kts'
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.*
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.*
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.AbstractTask
import org.gradle.jvm.tasks.Jar
import java.io.File
inline fun <reified T : Task> Project.task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)
fun AbstractTask.dependsOnTaskIfExists(task: String) {
project.tasks.firstOrNull { it.name == task }?.let { dependsOn(it) }
}
fun AbstractTask.dependsOnTaskIfExistsRec(task: String, project: Project? = null) {
dependsOnTaskIfExists(task)
(project ?: this.project).subprojects.forEach {
dependsOnTaskIfExistsRec(task, it)
}
}
fun Jar.setupRuntimeJar(implementationTitle: String): Unit {
dependsOn(":prepare:build.version:prepare")
manifest.attributes.apply {
put("Built-By", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Vendor", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Title", implementationTitle)
put("Implementation-Version", project.rootProject.extra["build.number"])
}
// from(project.configurations.getByName("build-version").files, action = { into("META-INF/") })
}
fun Jar.setupSourceJar(implementationTitle: String): Unit {
dependsOn("classes")
setupRuntimeJar(implementationTitle + " Sources")
project.pluginManager.withPlugin("java-base") {
from(project.the<JavaPluginConvention>().sourceSets["main"].allSource)
}
classifier = "sources"
project.artifacts.add("archives", this)
}
inline fun<T: Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
var res: T? = null
pluginManager.withPlugin("java") {
res = body()
}
return res
}
fun Project.getCompiledClasses(): SourceSetOutput? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").output
}
fun Project.getSources(): SourceDirectorySet? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").allSource
}
fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").resources
}
fun File(root: File, vararg children: String): File = children.fold(root, { f, c -> File(f, c) })
fun File(root: String, vararg children: String): File = children.fold(File(root), { f, c -> File(f, c) })
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.*
import org.gradle.api.artifacts.ConfigurablePublishArtifact
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.*
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
fun Project.testsJar(body: Jar.() -> Unit): Jar {
val testsJarCfg = configurations.getOrCreate("tests-jar").extendsFrom(configurations["testCompile"])
return task<Jar>("testJar") {
dependsOn("testClasses")
pluginManager.withPlugin("java") {
from(project.the<JavaPluginConvention>().sourceSets.getByName("test").output)
}
classifier = "tests"
body()
project.addArtifact(testsJarCfg, this, this)
}
}
fun<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
addArtifact("archives", task, artifactRef, body)
addArtifact("runtimeJar", task, artifactRef, body)
}
fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T =
task.apply {
setupPublicJar()
body()
project.runtimeJarArtifactBy(this, this)
}
fun Project.runtimeJar(taskName: String = "jar", body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask(taskName, body))
fun Project.sourcesJar(body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("sourcesJar") {
setupPublicJar("Sources")
try {
project.pluginManager.withPlugin("java-base") {
from(project.the<JavaPluginConvention>().sourceSets["main"].allSource)
}
} catch (e: UnknownDomainObjectException) {
// skip default sources location
}
tasks.findByName("classes")?.let { dependsOn(it) }
body()
project.addArtifact("archives", this, this)
}
fun Project.javadocJar(body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("javadocJar") {
setupPublicJar("JavaDoc")
tasks.findByName("javadoc")?.let{ it as Javadoc }?.takeIf { it.enabled }?.let {
dependsOn(it)
from(it.destinationDir)
}
body()
project.addArtifact("archives", this, this)
}
fun Project.standardPublicJars(): Unit {
runtimeJar()
sourcesJar()
javadocJar()
}
fun Project.publish(body: Upload.() -> Unit = {}): Upload {
apply<plugins.PublishedKotlinModule>()
return (tasks.getByName("uploadArchives") as Upload).apply {
body()
}
}
fun Project.ideaPlugin(subdir: String = "lib", body: Copy.() -> Unit) {
task<Copy>("idea-plugin") {
body()
into(File(rootProject.extra["ideaPluginDir"].toString(), subdir).path)
rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
}
}
fun Project.ideaPlugin() = ideaPlugin {
tasks.findByName("jar")?.let {
from(it)
}
}
fun Project.dist(body: Copy.() -> Unit = {}) {
task<Copy>("dist") {
tasks.findByName("assemble")?.let {
dependsOn(it)
}
body()
rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
into(rootProject.extra["distLibDir"].toString())
}
}
fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName(name) ?: create(name)
fun Jar.setupPublicJar(classifier: String = "", classifierDescr: String? = null) {
this.classifier = classifier.toLowerCase()
dependsOn(":prepare:build.version:prepare")
manifest.attributes.apply {
put("Built-By", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Vendor", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Title", "${project.description} ${classifierDescr ?: classifier}".trim())
put("Implementation-Version", project.rootProject.extra["build.number"])
}
// from(project.configurations.getByName("build-version").files, action = { into("META-INF/") })
}
fun<T> Project.addArtifact(configuration: Configuration, task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
artifacts.add(configuration.name, artifactRef) {
builtBy(task)
body()
}
}
fun<T> Project.addArtifact(configurationName: String, task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) =
addArtifact(configurations.getOrCreate(configurationName), task, artifactRef, body)
inline fun<reified T: Task> Project.getOrCreateTask(taskName: String, body: T.() -> Unit): T =
(tasks.findByName(taskName)?.let { it as T } ?: task<T>(taskName)).apply{ body() }
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.*
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.kotlin.dsl.*
import org.gradle.plugin.use.PluginDependenciesSpec
import org.gradle.plugin.use.PluginDependencySpec
import java.io.File
import java.util.*
val bootstrapKotlinVersion: String = System.getProperty("bootstrap.kotlin.version") ?: embeddedKotlinVersion
fun PluginDependenciesSpec.kotlin(module: String, version: String? = null): PluginDependencySpec =
id("org.jetbrains.kotlin.$module") version (version ?: bootstrapKotlinVersion)
fun Project.buildVersion(): Dependency {
val cfg = configurations.create("build-version")
return dependencies.add(cfg.name, dependencies.project(":prepare:build.version", configuration = "default"))
}
fun Project.commonDep(coord: String): String {
val parts = coord.split(':')
return when (parts.size) {
1 -> "$coord:$coord:${rootProject.extra["versions.$coord"]}"
2 -> "${parts[0]}:${parts[1]}:${rootProject.extra["versions.${parts[1]}"]}"
3 -> coord
else -> throw IllegalArgumentException("Illegal maven coordinates: $coord")
}
}
fun Project.commonDep(group: String, artifact: String): String = "$group:$artifact:${rootProject.extra["versions.$artifact"]}"
fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File(rootDir, "dependencies"), subdir: String? = null): ConfigurableFileCollection {
val dir = if (subdir != null) File(baseDir, subdir) else baseDir
if (!dir.exists() || !dir.isDirectory) throw GradleException("Invalid base directory $dir")
val matchingFiles = dir.listFiles { file -> artifactBaseNames.any { file.matchMaybeVersionedArtifact(it) } }
if (matchingFiles == null || matchingFiles.size < artifactBaseNames.size)
throw GradleException("Not all matching artifacts '${artifactBaseNames.joinToString()}' found in the '$dir' (found: ${matchingFiles?.joinToString { it.name }})")
return files(*matchingFiles.map { it.canonicalPath }.toTypedArray())
}
fun Project.ideaSdkDeps(vararg artifactBaseNames: String, subdir: String = "lib"): ConfigurableFileCollection =
preloadedDeps(*artifactBaseNames, baseDir = File(rootDir, "ideaSDK"), subdir = subdir)
fun Project.ideaSdkCoreDeps(vararg artifactBaseNames: String): ConfigurableFileCollection = ideaSdkDeps(*artifactBaseNames, subdir = "core")
fun Project.ideaPluginDeps(vararg artifactBaseNames: String, plugin: String, subdir: String = "lib"): ConfigurableFileCollection =
preloadedDeps(*artifactBaseNames, baseDir = File(rootDir, "ideaSDK"), subdir = "plugins/$plugin/$subdir")
fun Project.kotlinDep(artifactBaseName: String, version: String? = null): String = "org.jetbrains.kotlin:kotlin-$artifactBaseName:${version ?: bootstrapKotlinVersion}"
fun DependencyHandler.projectDep(name: String): Dependency = project(name, configuration = "default")
fun DependencyHandler.projectDepIntransitive(name: String): Dependency =
project(name, configuration = "default").apply { isTransitive = false }
fun DependencyHandler.projectTests(name: String): Dependency = project(name, configuration = "tests-jar").apply { isTransitive = false }
val protobufLiteProject = ":custom-dependencies:protobuf-lite"
fun DependencyHandler.protobufLite(): ProjectDependency =
project(protobufLiteProject, configuration = "default").apply { isTransitive = false }
val protobufLiteTask = "$protobufLiteProject:prepare"
fun DependencyHandler.protobufFull(): ProjectDependency =
project(protobufLiteProject, configuration = "relocated").apply { isTransitive = false }
val protobufFullTask = "$protobufLiteProject:prepare-relocated-protobuf"
private fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex())
private val wildcardsRe = """[^*?]+|(\*)|(\?)""".toRegex()
private fun String.wildcardsToEscapedRegexString(): String = buildString {
wildcardsRe.findAll(this@wildcardsToEscapedRegexString).forEach {
when {
it.groups[1] != null -> append(".*")
it.groups[2] != null -> append(".")
else -> append("\\Q${it.groups[0]!!.value}\\E")
}
}
}
private fun String.toMaybeVersionedJarRegex(): Regex {
val hasJarExtension = endsWith(".jar")
val escaped = this.wildcardsToEscapedRegexString()
return Regex(if (hasJarExtension) escaped else "$escaped(-\\d.*)?\\.jar") // TODO: consider more precise version part of the regex
}
val propertiesX =
java.util.Properties().apply { load(java.io.FileInputStream("gradle.properties")) }
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.*
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.HasConvention
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.*
import java.io.File
//import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
private fun Project.configureKotlinProjectSourceSet(srcs: Iterable<File>,
sourceSetName: String,
getSources: SourceSet.() -> SourceDirectorySet,
configureSourceDirs: SourceDirectorySet.() -> Unit) =
configure<JavaPluginConvention> {
// if (srcs.none()) {
// sourceSets.removeIf { it.name == sourceSetName }
// }
// else {
sourceSets.matching { it.name == sourceSetName }.forEach { it.getSources().setSrcDirs(srcs).configureSourceDirs() }
// }
}
private fun Project.configureKotlinProjectSourceSet(vararg srcs: String, sourceSetName: String,
getSources: SourceSet.() -> SourceDirectorySet,
sourcesBaseDir: File? = null,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSourceSet(srcs.map { File(sourcesBaseDir ?: projectDir, it) }, sourceSetName, getSources, configureSourceDirs)
fun Project.configureKotlinProjectSources(vararg srcs: String,
sourcesBaseDir: File? = null,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSourceSet(*srcs, sourceSetName = "main", getSources = { this.java },
sourcesBaseDir = sourcesBaseDir, configureSourceDirs = configureSourceDirs)
fun Project.configureKotlinProjectSources(srcs: Iterable<File>,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSourceSet(srcs, sourceSetName = "main", getSources = { this.java }, configureSourceDirs = configureSourceDirs)
fun Project.configureKotlinProjectSourcesDefault(sourcesBaseDir: File? = null,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSources("src", sourcesBaseDir = sourcesBaseDir, configureSourceDirs = configureSourceDirs)
fun Project.configureKotlinProjectResources(vararg srcs: String,
sourcesBaseDir: File? = null,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSourceSet(*srcs, sourceSetName = "main", getSources = { this.resources },
sourcesBaseDir = sourcesBaseDir, configureSourceDirs = configureSourceDirs)
fun Project.configureKotlinProjectResources(srcs: Iterable<File>,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSourceSet(srcs, sourceSetName = "main", getSources = { this.resources }, configureSourceDirs = configureSourceDirs)
fun Project.configureKotlinProjectResourcesDefault(sourcesBaseDir: File? = null) {
configureKotlinProjectResources("resources", sourcesBaseDir = sourcesBaseDir)
configureKotlinProjectResources("src", sourcesBaseDir = sourcesBaseDir) { include("META-INF/**", "**/*.properties") }
}
fun Project.configureKotlinProjectNoTests() {
configureKotlinProjectSourceSet(sourceSetName = "test", getSources = { this.java })
configureKotlinProjectSourceSet(sourceSetName = "test", getSources = { this.resources })
}
fun Project.configureKotlinProjectTests(vararg srcs: String, sourcesBaseDir: File? = null,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSourceSet(*srcs, sourceSetName = "test", getSources = { this.java },
sourcesBaseDir = sourcesBaseDir, configureSourceDirs = configureSourceDirs)
fun Project.configureKotlinProjectTestsDefault(sourcesBaseDir: File? = null,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectTests("test", "tests", sourcesBaseDir = sourcesBaseDir, configureSourceDirs = configureSourceDirs)
fun Project.configureKotlinProjectTestResources(vararg srcs: String,
sourcesBaseDir: File? = null,
configureSourceDirs: SourceDirectorySet.() -> Unit = {}) =
configureKotlinProjectSourceSet(*srcs, sourceSetName = "test", getSources = { this.resources },
sourcesBaseDir = sourcesBaseDir, configureSourceDirs = configureSourceDirs)
inline fun Project.sourceSets(crossinline body: SourceSetsBuilder.() -> Unit) =
SourceSetsBuilder(this).body()
class SourceSetsBuilder(val project: Project) {
inline operator fun String.invoke(crossinline body: SourceSet.() -> Unit) {
val sourceSetName = this
project.configure<JavaPluginConvention>
{
sourceSets.matching { it.name == sourceSetName }.forEach {
it.body()
}
}
}
}
fun SourceSet.none() {
java.srcDirs()
resources.srcDirs()
}
fun SourceSet.default() {
when (name) {
"main" -> {
java.srcDirs("src")
resources.srcDir("resources")
resources.srcDir("src").apply { include("META-INF/**", "**/*.properties") }
}
"test" -> {
java.srcDirs("test", "tests")
}
}
}
// TODO: adding dep to the plugin breaks the build unexpectedly, resolve and uncomment
//val SourceSet.kotlin: SourceDirectorySet
// get() =
// (this as HasConvention)
// .convention
// .getPlugin(KotlinSourceSet::class.java)
// .kotlin
//
//
//fun SourceSet.kotlin(action: SourceDirectorySet.() -> Unit) =
// kotlin.action()
// Have to stay in the separate dir: attempt to move it to the source root dir lead to invalid import into IDEA
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(project(":core::util.runtime"))
compile(project(":compiler:util"))
compile(project(":compiler:backend"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:util"))
compile(project(":compiler:cli-common"))
compile(project(":compiler:cli"))
compile(project(":compiler:light-classes"))
compile(project(":compiler:serialization"))
compile(project(":compiler:preloader"))
compile(project(":compiler:daemon-common"))
compile(project(":compiler:daemon-client"))
compile(project(":js:js.serializer"))
compile(project(":js:js.frontend"))
compile(project(":js:js.translator"))
compile(project(":plugins:android-extensions-compiler"))
compile(kotlinDep("test"))
compile(commonDep("junit"))
compile(ideaSdkCoreDeps("intellij-core"))
compile(ideaSdkDeps("openapi", "idea", "idea_rt"))
compile(preloadedDeps("dx", subdir = "android-5.0/lib"))
}
configureKotlinProjectSources("tests-common", sourcesBaseDir = File(rootDir, "compiler"))
configureKotlinProjectNoTests()
apply {
plugin("kotlin")
}
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":compiler:util"))
compile(project(":compiler:cli"))
compile(project(":compiler.tests-common"))
compile(project(":compiler:frontend"))
compile(project(":compiler:backend"))
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":core"))
testCompile(project(":compiler:frontend.java"))
testCompile(projectTests(":jps-plugin"))
testCompile(commonDep("junit:junit"))
testCompile(ideaSdkDeps("jps-model.jar", subdir = "jps"))
testCompile(ideaSdkDeps("groovy-all"))
testCompile(ideaSdkDeps("openapi", "idea"))
testCompile(ideaSdkDeps("jps-build-test", subdir = "jps/test"))
testCompile(ideaSdkDeps("jps-builders"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
tasks.withType<Test> {
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:ir.tree"))
}
configureKotlinProjectSources("backend-common/src", "ir/backend.common/src", sourcesBaseDir = File(rootDir, "compiler"))
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:backend-common"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:ir.tree"))
compile(project(":compiler:ir.psi2ir"))
compile(project(":compiler:serialization"))
}
configureKotlinProjectSources("backend/src", "ir/backend.jvm/src", sourcesBaseDir = File(rootDir, "compiler"))
configureKotlinProjectResourcesDefault()
configureKotlinProjectNoTests()
import java.io.File
import proguard.gradle.ProGuardTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.internal.plugins.DslObject
import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
classpath("net.sf.proguard:proguard-gradle:5.3.1")
}
}
apply { plugin("kotlin") }
plugins {
maven
}
//apply { plugin("maven") }
// Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build
val shrink = true
val compilerManifestClassPath =
"kotlin-runtime.jar kotlin-reflect.jar kotlin-script-runtime.jar"
val fatJarContents by configurations.creating
val proguardLibraryJars by configurations.creating
val fatJar by configurations.creating
val compilerJar by configurations.creating
val embeddableCompilerJar by configurations.creating
val compilerBaseName: String by rootProject.extra
val embeddableCompilerBaseName: String by rootProject.extra
val javaHome = File(System.getProperty("java.home"))
val buildLocalRepoPath: File by rootProject.extra
val compilerModules: Array<String> by rootProject.extra
val otherCompilerModules = compilerModules.filter { it != path }
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val packagesToRelocate =
listOf("com.intellij",
"com.google",
"com.sampullara",
"org.apache",
"org.jdom",
"org.picocontainer",
"jline",
"gnu",
"javax.inject",
"org.fusesource")
fun firstFromJavaHomeThatExists(vararg paths: String): File =
paths.mapNotNull { File(javaHome, it).takeIf { it.exists() } }.firstOrNull()
?: throw GradleException("Cannot find under '$javaHome' neither of: ${paths.joinToString()}")
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compileOnly(project(":compiler:cli"))
compileOnly(project(":compiler:daemon-common"))
compileOnly(project(":compiler:incremental-compilation-impl"))
compileOnly(project(":build-common"))
compileOnly(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
compileOnly(commonDep("org.fusesource.jansi", "jansi"))
compileOnly(commonDep("jline"))
testCompile(commonDep("junit:junit"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(project(":compiler.tests-common"))
testCompileOnly(project(":compiler:ir.ir2cfg"))
testCompileOnly(project(":compiler:ir.tree")) // used for deepCopyWithSymbols call that is removed by proguard from the compiler TODO: make it more straightforward
testCompile(ideaSdkDeps("openapi", "idea", "util", "asm-all", "commons-httpclient-3.1-patched"))
// deps below are test runtime deps, but made test compile to split compilation and running to reduce mem req
testCompile(project(":kotlin-stdlib"))
testCompile(project(":kotlin-script-runtime"))
testCompile(project(":kotlin-runtime"))
testCompile(project(":kotlin-reflect"))
testCompile(project(":plugins:android-extensions-compiler"))
testCompile(project(":ant"))
otherCompilerModules.forEach {
testCompile(project(it))
fatJarContents(project(it)) { isTransitive = false }
}
testRuntime(ideaSdkCoreDeps("*.jar"))
testRuntime(ideaSdkDeps("*.jar"))
// testRuntime(project(":prepare:compiler", configuration = "default"))
buildVersion()
fatJarContents(project(":core:builtins", configuration = "builtins"))
fatJarContents(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
fatJarContents(ideaSdkDeps("jna-platform", "oromatcher"))
fatJarContents(ideaSdkDeps("jps-model.jar", subdir = "jps"))
fatJarContents(commonDep("javax.inject"))
fatJarContents(commonDep("jline"))
fatJarContents(protobufFull())
fatJarContents(commonDep("com.github.spullara.cli-parser", "cli-parser"))
fatJarContents(commonDep("com.google.code.findbugs", "jsr305"))
fatJarContents(commonDep("io.javaslang", "javaslang"))
fatJarContents(preloadedDeps("json-org"))
proguardLibraryJars(files(firstFromJavaHomeThatExists("lib/rt.jar", "../Classes/classes.jar"),
firstFromJavaHomeThatExists("lib/jsse.jar", "../Classes/jsse.jar"),
firstFromJavaHomeThatExists("../lib/tools.jar", "../Classes/tools.jar")))
proguardLibraryJars(kotlinDep("stdlib"))
proguardLibraryJars(kotlinDep("script-runtime"))
proguardLibraryJars(kotlinDep("reflect"))
proguardLibraryJars(preloadedDeps("kotlinx-coroutines-core"))
// proguardLibraryJars(project(":prepare:runtime", configuration = "default").apply { isTransitive = false })
// proguardLibraryJars(project(":prepare:reflect", configuration = "default").apply { isTransitive = false })
// proguardLibraryJars(project(":core:script.runtime").apply { isTransitive = false })
}
configureKotlinProjectSources(
"compiler/daemon/src",
"compiler/conditional-preprocessor/src",
sourcesBaseDir = rootDir)
configureKotlinProjectResources("idea/src", sourcesBaseDir = rootDir) {
include("META-INF/extensions/common.xml",
"META-INF/extensions/kotlin2jvm.xml",
"META-INF/extensions/kotlin2js.xml")
}
configureKotlinProjectTests("tests")
testsJar {}
tasks.withType<Test> {
dependsOnTaskIfExistsRec("dist", project = rootProject)
dependsOn(":prepare:mock-runtime-for-test:dist")
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
systemProperty("kotlin.test.script.classpath", the<JavaPluginConvention>().sourceSets.getByName("test").output.classesDirs.joinToString(File.pathSeparator))
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
maxHeapSize = "1200m"
ignoreFailures = true
}
val packCompiler by task<ShadowJar> {
configurations = listOf(fatJar)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = File(buildDir, "libs")
baseName = compilerBaseName
classifier = "before-proguard"
dependsOn(protobufFullTask)
setupRuntimeJar("Kotlin Compiler")
from(getCompiledClasses())
from(fatJarContents)
manifest.attributes.put("Class-Path", compilerManifestClassPath)
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
}
val proguard by task<ProGuardTask> {
dependsOn(packCompiler)
configuration("$rootDir/compiler/compiler.pro")
val outputJar = File(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
inputs.files(packCompiler.outputs.files.singleFile)
outputs.file(outputJar)
// TODO: remove after dropping compatibility with ant build
doFirst {
System.setProperty("kotlin-compiler-jar-before-shrink", packCompiler.outputs.files.singleFile.canonicalPath)
System.setProperty("kotlin-compiler-jar", outputJar.canonicalPath)
}
libraryjars(proguardLibraryJars)
printconfiguration("$buildDir/compiler.pro.dump")
}
val embeddable by task<ShadowJar> {
destinationDir = File(buildDir, "libs")
baseName = embeddableCompilerBaseName
configurations = listOf(embeddableCompilerJar)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(proguard)
from(proguard)
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
packagesToRelocate.forEach {
relocate(it, "$kotlinEmbeddableRootPackage.$it")
}
relocate("org.fusesource", "$kotlinEmbeddableRootPackage.org.fusesource") {
// TODO: remove "it." after #KT-12848 get addressed
exclude("org.fusesource.jansi.internal.CLibrary")
}
}
dist {
if (shrink) {
from(proguard)
} else {
from(packCompiler)
}
rename(".*", compilerBaseName + ".jar")
}
artifacts.add(compilerJar.name, proguard.outputs.files.singleFile) {
builtBy(proguard)
classifier = ""
name = compilerBaseName
}
artifacts.add(embeddableCompilerJar.name, embeddable.outputs.files.singleFile) {
builtBy(embeddable)
classifier = ""
name = embeddableCompilerBaseName
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:cli-common"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:frontend.script"))
compile(project(":compiler:backend-common"))
compile(project(":compiler:backend"))
compile(project(":compiler:light-classes"))
compile(project(":compiler:serialization"))
compile(project(":compiler:plugin-api"))
compile(project(":js:js.translator"))
compile(project(":js:js.serializer"))
compile(project(":js:js.dce"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
compile(commonDep("org.fusesource.jansi", "jansi"))
compile(commonDep("jline"))
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
}
configureKotlinProjectSources("compiler/cli/src",
"plugins/annotation-collector/src",
"compiler/builtins-serializer/src",
"compiler/javac-wrapper/src",
sourcesBaseDir = rootDir)
configureKotlinProjectResourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core:util.runtime"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:frontend.script"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(kotlinDep("stdlib"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin Runner")
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main")
manifest.attributes.put("Class-Path", "kotlin-runtime.jar")
archiveName = "kotlin-runner.jar"
}
dist {
from(jar)
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":build-common"))
compile(project(":compiler:cli-common"))
compile(project(":compiler:preloader"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:daemon-common"))
compile(project(":compiler:daemon-client"))
compile(project(":compiler:util"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":core:util.runtime"))
compile(commonDep("javax.inject"))
compile(ideaSdkCoreDeps("intellij-core"))
testCompile(commonDep("junit:junit"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testRuntime(ideaSdkCoreDeps("trove4j", "intellij-core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
testsJar {}
tasks.withType<Test> {
dependsOnTaskIfExistsRec("dist", project = rootProject)
dependsOn(":prepare:mock-runtime-for-test:dist")
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
val nativePlatformUberjar = "$rootDir/dependencies/native-platform-uberjar.jar"
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:cli-common"))
compile(project(":compiler:daemon-common"))
compile(files(nativePlatformUberjar))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin Daemon Client")
from(zipTree(nativePlatformUberjar))
archiveName = "kotlin-daemon-client.jar"
}
val sourcesJar by task<Jar> {
setupSourceJar("Kotlin Daemon Client")
archiveName = "kotlin-daemon-client-sources.jar"
}
dist {
from(jar)
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(project(":compiler:util"))
compile(project(":compiler:cli-common"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectResourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(kotlinDep("reflect"))
compile(preloadedDeps("kotlinx-coroutines-core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(project(":compiler:util"))
compile(project(":compiler:container"))
compile(project(":compiler:resolution"))
compile(kotlinDep("script-runtime"))
compile(commonDep("io.javaslang","javaslang"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:cli"))
compile(project(":build-common"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:ir.tree"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:backend-common"))
compile(project(":compiler:ir.tree"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:backend"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(ideaSdkCoreDeps("intellij-core"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(ideaSdkDeps("asm-all"))
buildVersion()
}
configureKotlinProjectSources("src", "instrumentation/src")
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin Preloader")
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.preloading.Preloader")
archiveName = "kotlin-preloader.jar"
}
dist {
from(jar)
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
testCompile(commonDep("junit:junit"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(project(":compiler.tests-common"))
testCompile(project(":core"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:backend"))
testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:frontend.java"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:serialization"))
testCompile(ideaSdkDeps("openapi", "idea", "util", "asm-all"))
// deps below are test runtime deps, but made test compile to split compilation and running to reduce mem req
testCompile(project(":kotlin-stdlib"))
testCompile(project(":kotlin-script-runtime"))
testCompile(project(":kotlin-runtime"))
testCompile(project(":kotlin-reflect"))
testCompile(projectTests(":compiler"))
testRuntime(project(":compiler:preloader"))
testRuntime(ideaSdkCoreDeps("*.jar"))
testRuntime(ideaSdkDeps("*.jar"))
}
configureKotlinProjectSources()
configureKotlinProjectTestsDefault()
tasks.withType<KotlinCompile> {
kotlinOptions.jdkHome = rootProject.extra["JDK_18"]!!.toString()
kotlinOptions.jvmTarget = "1.8"
}
testsJar {}
tasks.withType<Test> {
executable = "${rootProject.extra["JDK_18"]!!}/bin/java"
dependsOnTaskIfExistsRec("dist", project = rootProject)
dependsOn(":prepare:mock-runtime-for-test:dist")
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
systemProperty("kotlin.test.script.classpath", the<JavaPluginConvention>().sourceSets.getByName("test").output.classesDirs.joinToString(File.pathSeparator))
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
maxHeapSize = "1200m"
ignoreFailures = true
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
compile(ideaSdkDeps("jps-model.jar", subdir = "jps"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectResources("resources", sourcesBaseDir = rootDir)
configureKotlinProjectNoTests()
import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core:builtins"))
compile(project("util.runtime"))
compile(protobufLite())
compile(commonDep("javax.inject"))
}
configureKotlinProjectSources(
"descriptor.loader.java/src",
"descriptors/src",
"descriptors.runtime/src",
"deserialization/src")
configureKotlinProjectResources(
"descriptor.loader.java/src", "deserialization/src") { include("META-INF/**") }
configureKotlinProjectNoTests()
tasks.withType<JavaCompile> {
dependsOn(protobufLiteTask)
}
tasks.withType<KotlinCompile> {
dependsOn(protobufLiteTask)
}
import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.serialization.builtins.BuiltInsSerializer
import org.gradle.jvm.tasks.Jar
import java.io.File
apply { plugin("kotlin") }
val builtinsSrc = File(rootDir, "core", "builtins", "src")
val builtinsNative = File(rootDir, "core", "builtins", "native")
// TODO: rewrite dependent projects on using build results instead of the fixed location
val builtinsSerialized = File(rootProject.extra["distDir"].toString(), "builtins")
val builtins by configurations.creating
dependencies {
val compile by configurations
compile(protobufLite())
compile(files(builtinsSerialized))
}
configureKotlinProjectSources("core/builtins/src", "core/runtime.jvm/src", sourcesBaseDir = rootDir)
configureKotlinProjectResources(listOf(builtinsSerialized))
configureKotlinProjectNoTests()
val serialize = task("serialize") {
val outDir = builtinsSerialized
val inDirs = arrayOf(builtinsSrc, builtinsNative)
outputs.file(outDir)
inputs.files(*inDirs)
doLast {
System.setProperty("kotlin.colors.enabled", "false")
BuiltInsSerializer(dependOnOldBuiltIns = false)
.serialize(outDir, inDirs.asList(), listOf()) { totalSize, totalFiles ->
println("Total bytes written: $totalSize to $totalFiles files")
}
}
}
tasks.withType<JavaCompile> {
dependsOn(protobufLiteTask)
dependsOn(serialize)
}
tasks.withType<KotlinCompile> {
dependsOn(protobufLiteTask)
dependsOn(serialize)
}
val jar: Jar by tasks
jar.apply {
dependsOn(serialize)
from(builtinsSerialized) { include("kotlin/**") }
}
val builtinsJar by task<Jar> {
dependsOn(serialize)
from(builtinsSerialized) { include("kotlin/**") }
baseName = "platform-builtins"
destinationDir = File(buildDir, "libs")
}
artifacts.add(builtins.name, builtinsJar)
import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
classpath(ideaSdkDeps("asm-all"))
}
}
apply {
plugin("kotlin")
plugin("com.github.johnrengelman.shadow")
}
configure<JavaPluginConvention> {
sourceSets.getByName("main")?.apply {
val srcs = listOf(File(rootDir, "core/reflection.jvm/src"))
java.setSrcDirs(srcs)
}
sourceSets.getByName("test").apply {
java.setSrcDirs(emptyList<File>())
}
}
dependencies {
val compile by configurations
compile(project(":core:builtins"))
compile(project(":core"))
compile(protobufLite())
}
tasks.withType<JavaCompile> {
dependsOn(protobufLiteTask)
}
tasks.withType<KotlinCompile> {
dependsOn(protobufLiteTask)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core:builtins"))
compile(kotlinDep("stdlib"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
tasks.withType<Jar> {
setupRuntimeJar("Kotlin Script Runtime")
archiveName = "kotlin-script-runtime.jar"
}
apply {
plugin("java")
plugin("kotlin")
}
dependencies {
val compile by configurations
compile(project(":core:builtins"))
compile(kotlinDep("stdlib"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.util.jar.JarEntry
import java.util.jar.JarFile
import java.util.zip.ZipOutputStream
import org.gradle.language.assembler.tasks.Assemble
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
}
}
apply { plugin("com.github.johnrengelman.shadow") }
val mainCfg = configurations.create("default")
val relocatedCfg = configurations.create("relocated")
val protobufVersion = rootProject.extra["versions.protobuf-java"]
val protobufJarPrefix = "protobuf-$protobufVersion"
val renamedOutputJarPath = "$buildDir/jars/$protobufJarPrefix-relocated.jar"
val outputJarPath = "$buildDir/libs/$protobufJarPrefix-lite.jar"
artifacts.add(mainCfg.name, File(outputJarPath))
artifacts.add(relocatedCfg.name, File(renamedOutputJarPath))
dependencies {
mainCfg("com.google.protobuf:protobuf-java:$protobufVersion")
}
val relocateTask = task<ShadowJar>("prepare-relocated-protobuf") {
archiveName = renamedOutputJarPath
this.configurations = listOf(relocatedCfg)
from(mainCfg.files.find { it.name.startsWith("protobuf-java") }?.canonicalPath)
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf" ) {
// TODO: remove "it." after #KT-12848 get addressed
exclude("META-INF/maven/com.google.protobuf/protobuf-java/pom.properties")
}
}
val mainTask = task("prepare") {
dependsOn(relocateTask)
val inputJar = renamedOutputJarPath
inputs.files(inputJar)
outputs.file(outputJarPath)
doFirst {
File(outputJarPath).parentFile.mkdirs()
}
doLast {
val INCLUDE_START = "<include>**/"
val INCLUDE_END = ".java</include>"
val POM_PATH = "META-INF/maven/com.google.protobuf/protobuf-java/pom.xml"
fun loadAllFromJar(file: File): Map<String, Pair<JarEntry, ByteArray>> {
val result = hashMapOf<String, Pair<JarEntry, ByteArray>>()
val jar = JarFile(file)
try {
for (jarEntry in jar.entries()) {
result[jarEntry.name] = Pair(jarEntry, jar.getInputStream(jarEntry).readBytes())
}
}
finally {
// Yes, JarFile does not extend Closeable on JDK 6 so we can't use "use" here
jar.close()
}
return result
}
val allFiles = loadAllFromJar(File(inputJar))
val keepClasses = arrayListOf<String>()
val pomBytes = allFiles[POM_PATH]?.second ?: error("pom.xml is not found in protobuf jar at $POM_PATH")
val lines = String(pomBytes).lines()
var liteProfileReached = false
for (lineUntrimmed in lines) {
val line = lineUntrimmed.trim()
if (liteProfileReached && line == "</includes>") {
break
}
else if (line == "<id>lite</id>") {
liteProfileReached = true
continue
}
if (liteProfileReached && line.startsWith(INCLUDE_START) && line.endsWith(INCLUDE_END)) {
keepClasses.add(line.removeSurrounding(INCLUDE_START, INCLUDE_END))
}
}
assert(liteProfileReached && keepClasses.isNotEmpty()) { "Wrong pom.xml or the format has changed, check its contents at $POM_PATH" }
val outputFile = File(outputJarPath).apply { delete() }
ZipOutputStream(BufferedOutputStream(FileOutputStream(outputFile))).use { output ->
for ((name, value) in allFiles) {
val className = name.substringAfter("org/jetbrains/kotlin/protobuf/").substringBeforeLast(".class")
if (keepClasses.any { className == it || className.startsWith(it + "$") }) {
val (entry, bytes) = value
output.putNextEntry(entry)
output.write(bytes)
output.closeEntry()
}
}
}
}
}
defaultTasks(mainTask.name)
tasks.withType<Assemble>() {
dependsOn(mainCfg)
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":kotlin-stdlib"))
compile(project(":kotlin-reflect"))
compile(project(":compiler:backend"))
compile(ideaSdkDeps("asm-all"))
// compile(files(PathUtil.getJdkClassesRootsFromCurrentJre())) // TODO: make this one work instead of the nex one, since it contains more universal logic
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply {
plugin("kotlin")
}
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":core"))
compile(project(":idea"))
compile(project(":compiler:util"))
compile(project(":compiler:cli"))
compile(project(":compiler:backend"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:backend"))
compile(project(":js:js.ast"))
compile(project(":js:js.frontend"))
compile(project(":idea:idea-test-framework"))
compile(project(":kotlin-test:kotlin-test-jvm"))
compile(projectTests(":build-common"))
compile(projectTests(":compiler"))
compile(projectTests(":compiler:tests-java8"))
compile(projectTests(":compiler:container"))
compile(projectTests(":idea"))
compile(projectTests(":idea:idea-android"))
compile(projectTests(":jps-plugin"))
compile(projectTests(":plugins:plugins-tests"))
compile(projectTests(":plugins:android-extensions-idea"))
compile(projectTests(":plugins:kapt3"))
compile(projectTests(":plugins:uast-kotlin"))
compile(projectTests(":js:js.tests"))
compile(protobufFull())
compileOnly(ideaSdkDeps("jps-build-test", subdir = "jps/test"))
testCompile(project(":compiler.tests-common"))
testCompile(project(":idea:idea-test-framework")) { isTransitive = false }
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":plugins:kapt3"))
testCompile(commonDep("junit:junit"))
testCompile(ideaSdkDeps("openapi", "idea"))
testCompile(preloadedDeps("uast-tests"))
testRuntime(ideaSdkDeps("*.jar"))
testRuntime(ideaPluginDeps("idea-junit", "resources_en", plugin = "junit"))
testRuntime(ideaPluginDeps("IntelliLang", plugin = "IntelliLang"))
testRuntime(ideaPluginDeps("jcommander", "testng", "testng-plugin", "resources_en", plugin = "testng"))
testRuntime(ideaPluginDeps("copyright", plugin = "copyright"))
testRuntime(ideaPluginDeps("properties", "resources_en", plugin = "properties"))
testRuntime(ideaPluginDeps("java-i18n", plugin = "java-i18n"))
testRuntime(ideaPluginDeps("*.jar", plugin = "gradle"))
testRuntime(ideaPluginDeps("*.jar", plugin = "Groovy"))
testRuntime(ideaPluginDeps("coverage", "jacocoant", plugin = "coverage"))
testRuntime(ideaPluginDeps("java-decompiler", plugin = "java-decompiler"))
testRuntime(ideaPluginDeps("*.jar", plugin = "maven"))
testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
tasks.withType<Test> {
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Xmx1200m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
testRuntime(ideaSdkDeps("*.jar"))
compile(project(":kotlin-stdlib"))
compile(project(":core"))
compile(project(":compiler:backend"))
compile(project(":compiler:cli-common"))
compile(project(":compiler:daemon-client"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:frontend.script"))
compile(project(":js:js.frontend"))
compile(project(":js:js.serializer"))
compile(project(":compiler:light-classes"))
compile(project(":compiler:util"))
compile(project(":compiler:compiler-runner"))
compile(project(":compiler:plugin-api"))
compile(project(":eval4j"))
compile(project(":j2k"))
compile(project(":idea:formatter"))
compile(project(":idea:idea-core"))
compile(project(":idea:ide-common"))
compile(project(":idea:idea-jps-common"))
compile(project(":idea:kotlin-gradle-tooling"))
compile(project(":plugins:uast-kotlin"))
compile(project(":plugins:uast-kotlin-idea"))
compile(ideaSdkCoreDeps("intellij-core", "util"))
compileOnly(ideaSdkDeps("openapi", "idea", "velocity", "boot", "gson", "swingx-core", "jsr305", "forms_rt"))
compile(ideaPluginDeps("idea-junit", plugin = "junit"))
compile(ideaPluginDeps("IntelliLang", plugin = "IntelliLang"))
compile(ideaPluginDeps("testng", "testng-plugin", plugin = "testng"))
compile(ideaPluginDeps("copyright", plugin = "copyright"))
compile(ideaPluginDeps("properties", plugin = "properties"))
compile(ideaPluginDeps("java-i18n", plugin = "java-i18n"))
compile(ideaPluginDeps("coverage", plugin = "coverage"))
compile(ideaPluginDeps("java-decompiler", plugin = "java-decompiler"))
compileOnly(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle"))
compileOnly(ideaPluginDeps("Groovy", plugin = "Groovy"))
compileOnly(ideaPluginDeps("maven", "maven-server-api", plugin = "maven"))
compile(preloadedDeps("markdown", "kotlinx-coroutines-core"))
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler.tests-common"))
testCompile(project(":idea:idea-test-framework")) { isTransitive = false }
testCompileOnly(ideaPluginDeps("gradle-base-services", "gradle-tooling-extension-impl", "gradle-wrapper", plugin = "gradle"))
testCompileOnly(ideaPluginDeps("Groovy", plugin = "Groovy"))
testCompileOnly(ideaPluginDeps("maven", "maven-server-api", plugin = "maven"))
testCompileOnly(ideaSdkDeps("groovy-all", "velocity", "gson", "jsr305"))
testRuntime(ideaPluginDeps("resources_en", plugin = "junit"))
testRuntime(ideaPluginDeps("jcommander", "resources_en", plugin = "testng"))
testRuntime(ideaPluginDeps("resources_en", plugin = "properties"))
testRuntime(ideaPluginDeps("*.jar", plugin = "gradle"))
testRuntime(ideaPluginDeps("*.jar", plugin = "Groovy"))
testRuntime(ideaPluginDeps("jacocoant", plugin = "coverage"))
testRuntime(ideaPluginDeps("*.jar", plugin = "maven"))
testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
testRuntime(preloadedDeps("uast-common", "uast-java"))
// deps below are test runtime deps, but made test compile to split compilation and running to reduce mem req
testCompile(project(":plugins:android-extensions-compiler"))
testCompile(project(":plugins:android-extensions-idea")) { isTransitive = false }
testCompile(project(":plugins:allopen-ide")) { isTransitive = false }
testCompile(project(":plugins:allopen-cli"))
testCompile(project(":plugins:noarg-ide")) { isTransitive = false }
testCompile(project(":plugins:noarg-cli"))
testCompile(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
testCompile(project(":plugins:sam-with-receiver-ide")) { isTransitive = false }
testCompile(project(":plugins:sam-with-receiver-cli"))
testCompile(project(":idea:idea-android")) { isTransitive = false }
testCompile(project(":plugins:lint")) { isTransitive = false }
testCompile(project(":plugins:uast-kotlin"))
(rootProject.extra["compilerModules"] as Array<String>).forEach {
testCompile(project(it))
}
buildVersion()
}
configureKotlinProjectSources("src",
"idea-maven/src",
"idea-completion/src",
"idea-live-templates/src",
"idea-repl/src")
configure<JavaPluginConvention> {
sourceSets["main"].apply {
resources {
srcDir(File(projectDir, "resources"))
.include("**")
srcDir(File(projectDir, "src"))
.include("META-INF/**",
"**/*.properties")
}
}
}
configureKotlinProjectTests("idea/tests",
"idea/idea-maven/test",
"idea/idea-completion/tests",
"j2k/tests",
"eval4j/test",
sourcesBaseDir = rootDir)
tasks.withType<Test> {
dependsOnTaskIfExistsRec("dist", project = rootProject)
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
maxHeapSize = "1200m"
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
// forkEvery = 100
testLogging {
// events = setOf(TestLogEvent.FAILED)
// showStackTraces = true
// showCauses = true
// exceptionFormat = TestExceptionFormat.FULL
// showStandardStreams = false
}
ignoreFailures = true
}
testsJar {}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(ideaSdkDeps("openapi"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":js:js.frontend"))
compile(project(":js:js.serializer"))
compile(ideaSdkCoreDeps("annotations", "guava", "intellij-core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(kotlinDep("reflect"))
compile(project(":compiler:util"))
compile(project(":compiler:light-classes"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":idea"))
compile(project(":idea:idea-core"))
compile(project(":idea:ide-common"))
compile(ideaSdkDeps("openapi", "idea"))
compile(ideaPluginDeps("gradle-tooling-api", plugin = "gradle"))
compile(ideaPluginDeps("android", "common", "sdklib", "sdk-common", "layoutlib-api", plugin = "android"))
compile(preloadedDeps("uast-common", "uast-java"))
compile(preloadedDeps("dx", subdir = "android-5.0/lib"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":compiler.tests-common"))
testCompile(project(":idea:idea-test-framework")) { isTransitive = false }
testCompile(project(":plugins:lint")) { isTransitive = false }
testCompile(projectTests(":idea"))
testCompile(ideaPluginDeps("android-common", "sdklib", plugin = "android"))
testCompile(ideaPluginDeps("properties", plugin = "properties"))
testCompile(ideaSdkDeps("gson"))
testRuntime(preloadedDeps("uast-common", "uast-java"))
testRuntime(project(":plugins:android-extensions-idea"))
testRuntime(project(":plugins:sam-with-receiver-ide"))
testRuntime(project(":plugins:noarg-ide"))
testRuntime(project(":plugins:allopen-ide"))
testRuntime(ideaSdkDeps("*.jar"))
testRuntime(ideaPluginDeps("idea-junit", "resources_en", plugin = "junit"))
testRuntime(ideaPluginDeps("IntelliLang", plugin = "IntelliLang"))
testRuntime(ideaPluginDeps("jcommander", "testng", "testng-plugin", "resources_en", plugin = "testng"))
testRuntime(ideaPluginDeps("copyright", plugin = "copyright"))
testRuntime(ideaPluginDeps("properties", "resources_en", plugin = "properties"))
testRuntime(ideaPluginDeps("java-i18n", plugin = "java-i18n"))
testRuntime(ideaPluginDeps("*.jar", plugin = "gradle"))
testRuntime(ideaPluginDeps("*.jar", plugin = "Groovy"))
testRuntime(ideaPluginDeps("coverage", "jacocoant", plugin = "coverage"))
testRuntime(ideaPluginDeps("java-decompiler", plugin = "java-decompiler"))
testRuntime(ideaPluginDeps("*.jar", plugin = "maven"))
testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
tasks.withType<Test> {
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
testsJar {}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(ideaSdkCoreDeps("intellij-core"))
compile(ideaPluginDeps("gradle-tooling-api", plugin = "gradle"))
compile(ideaPluginDeps("android", "common", "sdk-common", plugin = "android"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":kotlin-stdlib"))
compile(project(":core"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:frontend.script"))
compile(project(":compiler:light-classes"))
compile(project(":compiler:util"))
compile(project(":j2k"))
compile(project(":idea:ide-common"))
compile(project(":idea:idea-jps-common"))
compile(project(":plugins:android-extensions-compiler"))
compile(ideaSdkCoreDeps("intellij-core", "util"))
compile(ideaSdkDeps("openapi", "idea"))
compile(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle"))
compile(preloadedDeps("uast-common", "kotlinx-coroutines-core", "kotlinx-coroutines-jdk8"))
buildVersion()
}
configureKotlinProjectSources("idea-core/src", "idea-analysis/src", sourcesBaseDir = File(rootDir, "idea"))
configureKotlinProjectResources("idea-analysis/src", sourcesBaseDir = File(rootDir, "idea")) {
include("**/*.properties")
}
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":kotlin-stdlib"))
compile(project(":compiler:util"))
compile(project(":compiler:cli-common"))
compile(project(":compiler:frontend.java"))
compile(ideaSdkCoreDeps("intellij-core", "util"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.script"))
compile(project(":compiler.tests-common"))
compile(project(":idea"))
compile(project(":idea:idea-core"))
compile(project(":idea:idea-jps-common"))
compile(ideaSdkDeps("openapi", "idea"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":kotlin-stdlib"))
compile(project(":compiler:cli-common"))
compile(ideaSdkDeps("gradle-tooling-api",
"gradle-tooling-extension-api",
"gradle",
"gradle-core",
"gradle-base-services-groovy",
subdir = "plugins/gradle/lib"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
ideaPlugin {
from(jar)
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":kotlin-stdlib"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:light-classes"))
compile(project(":compiler:util"))
compile(ideaSdkCoreDeps("intellij-core", "util"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply {
plugin("kotlin")
}
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
testRuntime(ideaSdkCoreDeps("*.jar"))
testRuntime(ideaSdkDeps("*.jar"))
testRuntime(ideaSdkDeps("*.jar", subdir = "jps/test"))
testRuntime(ideaSdkDeps("*.jar", subdir = "jps"))
compile(project(":build-common"))
compile(project(":core"))
compile(project(":compiler:compiler-runner"))
compile(project(":compiler:daemon-common"))
compile(project(":compiler:daemon-client"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:preloader"))
compile(project(":idea:idea-jps-common"))
compile(ideaSdkDeps("jps-builders", "jps-builders-6", subdir = "jps"))
buildVersion()
testCompile(project(":compiler.tests-common"))
testCompile(project(":compiler:incremental-compilation-impl"))
testCompileOnly(ideaSdkDeps("jps-build-test", subdir = "jps/test"))
testCompile(commonDep("junit:junit"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(projectTests(":build-common"))
(rootProject.extra["compilerModules"] as Array<String>).forEach {
testRuntime(project(it))
}
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectResourcesDefault()
configureKotlinProjectTests("test", sourcesBaseDir = File(projectDir, "jps-tests"))
configureKotlinProjectTestResources("testData")
tasks.withType<Test> {
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
maxHeapSize = "1200m"
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
forkEvery = 100
ignoreFailures = true
}
testsJar {}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(ideaSdkCoreDeps("trove4j", "intellij-core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":js:js.ast"))
compile(project(":js:js.translator"))
compile(ideaSdkCoreDeps("intellij-core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":js:js.ast"))
compile(project(":js:js.parser"))
compile(project(":js:js.serializer"))
compile(ideaSdkCoreDeps("intellij-core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":js:js.ast"))
compile(ideaSdkCoreDeps("intellij-core"))
compile(preloadedDeps("json-org"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:serialization"))
compile(project(":js:js.ast"))
compile(ideaSdkCoreDeps("intellij-core"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
testCompile(project(":compiler.tests-common"))
testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:cli"))
testCompileOnly(project(":compiler:util"))
testCompile(project(":js:js.translator"))
testCompile(project(":js:js.serializer"))
testCompile(project(":js:js.dce"))
testCompile(ideaSdkDeps("openapi", "idea"))
testRuntime(project(":kotlin-stdlib"))
testRuntime(project(":compiler:backend-common"))
testRuntime(ideaSdkDeps("*.jar"))
}
configureKotlinProjectSources()
configureKotlinProjectTestsDefault()
val test: Test by tasks
test.apply {
dependsOnTaskIfExistsRec("dist", project = rootProject)
dependsOn(":prepare:mock-runtime-for-test:dist")
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
testsJar {}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":core"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:backend-common"))
compile(project(":js:js.ast"))
compile(project(":js:js.frontend"))
compile(project(":js:js.parser"))
compile(ideaSdkCoreDeps("intellij-core"))
}
configureKotlinProjectSources("js.translator/src", "js.inliner/src", sourcesBaseDir = File(rootDir, "js"))
configureKotlinProjectNoTests()
description = "Simple Annotation Processor for testing kapt"
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(kotlinDep("stdlib"))
}
configureKotlinProjectSources("src/kotlin")
configureKotlinProjectResources("src/resources")
configureKotlinProjectNoTests()
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(ideaSdkCoreDeps("intellij-core"))
compile(project(":compiler:plugin-api"))
compile(project(":compiler:frontend"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin AllOpen Compiler Plugin")
from(fileTree("$projectDir/src")) { include("META-INF/**") }
archiveName = "allopen-compiler-plugin.jar"
}
dist {
from(jar)
}
ideaPlugin {
from(jar)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":plugins:allopen-cli"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:cli-common"))
compile(project(":idea"))
compile(project(":idea:idea-jps-common"))
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
compile(ideaSdkDeps("openapi", "idea"))
compile(ideaPluginDeps("maven", plugin = "maven"))
compile(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
ideaPlugin {
from(jar)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(ideaSdkCoreDeps("intellij-core"))
compile(project(":compiler:util"))
compile(project(":compiler:plugin-api"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:backend"))
compile(ideaPluginDeps("layoutlib", plugin = "android"))
}
configureKotlinProjectSources("android-extensions-compiler/src", "android-extensions-runtime/src", sourcesBaseDir = File(rootDir, "plugins", "android-extensions"))
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin Android Extensions Compiler")
}
dist {
from(jar)
}
ideaPlugin {
from(jar)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":compiler:util"))
compile(project(":compiler:light-classes"))
compile(project(":idea:idea-core"))
compile(project(":idea"))
compile(project(":plugins:android-extensions-compiler"))
compile(ideaPluginDeps("android", "sdk-tools", "sdk-common", plugin = "android"))
compile(ideaPluginDeps("Groovy", plugin = "Groovy"))
testCompile(project(":compiler.tests-common"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:frontend.java"))
testCompile(project(":idea:idea-test-framework")) { isTransitive = false }
testCompile(projectTests(":idea"))
testCompile(projectTests(":idea:idea-android"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testRuntime(project(":plugins:android-extensions-jps"))
testRuntime(project(":plugins:sam-with-receiver-ide"))
testRuntime(project(":plugins:noarg-ide"))
testRuntime(project(":plugins:allopen-ide"))
testRuntime(ideaSdkDeps("*.jar"))
testRuntime(ideaPluginDeps("idea-junit", "resources_en", plugin = "junit"))
testRuntime(ideaPluginDeps("IntelliLang", plugin = "IntelliLang"))
testRuntime(ideaPluginDeps("jcommander", "testng", "testng-plugin", "resources_en", plugin = "testng"))
testRuntime(ideaPluginDeps("copyright", plugin = "copyright"))
testRuntime(ideaPluginDeps("properties", "resources_en", plugin = "properties"))
testRuntime(ideaPluginDeps("java-i18n", plugin = "java-i18n"))
testRuntime(ideaPluginDeps("*.jar", plugin = "gradle"))
testRuntime(ideaPluginDeps("*.jar", plugin = "Groovy"))
testRuntime(ideaPluginDeps("coverage", "jacocoant", plugin = "coverage"))
testRuntime(ideaPluginDeps("java-decompiler", plugin = "java-decompiler"))
testRuntime(ideaPluginDeps("*.jar", plugin = "maven"))
testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
testsJar {}
tasks.withType<Test> {
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
val jar: Jar by tasks
ideaPlugin {
from(jar)
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:util"))
compile(project(":jps-plugin"))
compile(project(":plugins:android-extensions-compiler"))
compile(ideaPluginDeps("android-jps-plugin", plugin = "android", subdir = "lib/jps"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:cli-common"))
compile(project(":idea"))
compile(project(":idea:idea-jps-common"))
compileOnly(ideaPluginDeps("maven", "maven-server-api", plugin = "maven"))
compileOnly(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle"))
compileOnly(ideaSdkDeps("openapi", "idea"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":compiler:util"))
compile(project(":compiler:cli"))
compile(project(":compiler:backend"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:plugin-api"))
testCompile(project(":compiler.tests-common"))
testCompile(commonDep("junit:junit"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
testsJar {}
tasks.withType<Test> {
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
apply {
plugin("kotlin")
plugin("java")
}
dependencies {
val compile by configurations
compile(project(":compiler:frontend"))
compile(project(":idea"))
compile(project(":idea:idea-core"))
compile(project(":idea:idea-android"))
compile(project(":plugins:uast-kotlin"))
compile(preloadedDeps("uast-common", "uast-java"))
compile(ideaPluginDeps("android", "android-common", "common", "sdk-common", "sdklib", "sdk-tools", "repository", "lombok-ast", "kxml2", plugin = "android"))
compile(ideaSdkCoreDeps("intellij-core", "util"))
compile(ideaSdkDeps("guava"))
}
configureKotlinProjectSources("android-annotations/src",
"lint-api/src",
"lint-checks/src",
"lint-idea/src")
configureKotlinProjectNoTests()
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:backend"))
compile(project(":compiler:util"))
compile(project(":compiler:plugin-api"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin NoArg Compiler Plugin")
from(fileTree("$projectDir/src")) { include("META-INF/**") }
archiveName = "noarg-compiler-plugin.jar"
}
dist {
from(jar)
}
ideaPlugin {
from(jar)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":plugins:noarg-cli"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:backend"))
compile(project(":compiler:cli-common"))
compile(project(":idea"))
compile(project(":idea:idea-jps-common"))
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
compile(ideaSdkDeps("openapi", "idea"))
compile(ideaPluginDeps("maven", plugin = "maven"))
compile(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
ideaPlugin {
from(jar)
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
testCompile(project(":compiler:util"))
testCompile(project(":compiler:backend"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler.tests-common"))
testCompile(project(":plugins:android-extensions-compiler"))
testCompile(project(":plugins:android-extensions-idea"))
testCompile(project(":plugins:allopen-ide")) { isTransitive = false }
testCompile(project(":plugins:allopen-cli"))
testCompile(project(":plugins:noarg-ide")) { isTransitive = false }
testCompile(project(":plugins:noarg-cli"))
testCompile(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
testCompile(project(":plugins:sam-with-receiver-ide")) { isTransitive = false }
testCompile(project(":plugins:sam-with-receiver-cli"))
testCompile(project(":idea:idea-android")) { isTransitive = false }
testCompile(project(":plugins:lint")) { isTransitive = false }
testCompile(project(":plugins:uast-kotlin"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(projectTests(":jps-plugin"))
testCompileOnly(ideaSdkDeps("jps-builders"))
testCompile(ideaSdkDeps("jps-build-test", subdir = "jps/test"))
testCompile(ideaPluginDeps("*.jar", plugin = "android", subdir = "lib/jps"))
testRuntime(project(":jps-plugin"))
testRuntime(ideaSdkDeps("*.jar"))
testRuntime(ideaPluginDeps("idea-junit", "resources_en", plugin = "junit"))
testRuntime(ideaPluginDeps("*.jar", plugin = "gradle"))
testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
}
configureKotlinProjectSources()
configureKotlinProjectTestsDefault()
testsJar {}
val test: Test by tasks
test.apply {
dependsOnTaskIfExistsRec("dist", project = rootProject)
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:plugin-api"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin SamWithReceiver Compiler Plugin")
from(fileTree("$projectDir/src")) { include("META-INF/**") }
archiveName = "sam-with-receiver-compiler-plugin.jar"
}
dist {
from(jar)
}
ideaPlugin {
from(jar)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":plugins:sam-with-receiver-cli"))
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":idea:idea-core"))
compile(project(":idea:idea-android"))
compile(project(":idea"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
val jar: Jar by tasks
ideaPlugin {
from(jar)
}
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.script"))
compile(project(":compiler:plugin-api"))
testCompile(project(":compiler.tests-common"))
testCompile(commonDep("junit:junit"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:cli-common"))
testCompile(project(":compiler:frontend.java"))
testCompile(project(":compiler:daemon-common"))
testCompile(project(":compiler:daemon-client"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectResources("src") {
include("META-INF/**")
}
configureKotlinProjectTestsDefault()
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin SourceSections Compiler Plugin")
archiveName = "kotlin-source-sections-compiler-plugin.jar"
}
dist {
from(jar)
}
tasks.withType<Test> {
dependsOnTaskIfExistsRec("dist", project = rootProject)
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":kotlin-stdlib"))
compile(project(":core:util.runtime"))
compile(project(":compiler:backend"))
compile(project(":compiler:frontend.java"))
compile(project(":idea:ide-common"))
compile(project(":plugins:uast-kotlin"))
compile(preloadedDeps("uast-common", "uast-java"))
buildVersion()
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectNoTests()
apply { plugin("kotlin") }
dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":kotlin-stdlib"))
compile(project(":core:util.runtime"))
compile(project(":compiler:backend"))
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:light-classes"))
compile(preloadedDeps("uast-common", "uast-java"))
buildVersion()
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":compiler.tests-common"))
testCompile(commonDep("junit:junit"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:cli"))
testCompile(project(":idea:idea-android"))
testCompile(preloadedDeps("uast-tests"))
testRuntime(ideaSdkDeps("*.jar"))
}
configureKotlinProjectSourcesDefault()
configureKotlinProjectTestsDefault()
testsJar {}
tasks.withType<Test> {
workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
import org.gradle.jvm.tasks.Jar
apply { plugin("java") }
val projectsToShadow = listOf(
":plugins:lint",
":plugins:uast-kotlin",
":plugins:uast-kotlin-idea")
tasks.withType<Jar> {
setupRuntimeJar("Kotlin Android Lint")
archiveName = "android-lint.jar"
projectsToShadow.forEach {
dependsOn("$it:classes")
project(it).let { p ->
p.pluginManager.withPlugin("java") {
from(p.the<JavaPluginConvention>().sourceSets.getByName("main").output)
}
}
}
}
configureKotlinProjectSources() // no sources
configureKotlinProjectNoTests()
val jar: Jar by tasks
ideaPlugin {
from(jar)
}
import java.io.File
val buildVersionFilePath = "${rootProject.extra["distDir"]}/build.txt"
val mainCfg = configurations.create("default")
artifacts.add(mainCfg.name, file(buildVersionFilePath))
val mainTask = task("prepare") {
val versionString = rootProject.extra["build.number"].toString()
val versionFile = File(buildVersionFilePath)
outputs.file(buildVersionFilePath)
outputs.upToDateWhen {
(versionFile.exists() && versionFile.readText().trim() == versionString).apply {
if (!this) {
println("!!! not up-to-date $versionFile: ${versionFile.takeIf { it.exists() }?.readText()?.trim()}")
}
}
}
doLast {
versionFile.parentFile.mkdirs()
versionFile.writeText(versionString)
}
}
defaultTasks(mainTask.name)
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
}
}
val embedCfg = configurations.create("embed")
val mainCfg = configurations.create("default")
val embeddableCompilerBaseName: String by rootProject.extra
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val packagesToRelocate =
listOf("com.intellij",
"com.google",
"com.sampullara",
"org.apache",
"org.jdom",
"org.picocontainer",
"jline",
"gnu",
"javax.inject",
"org.fusesource")
dependencies {
embedCfg(project(":prepare:compiler", configuration = "default"))
}
val embeddableTask = task<ShadowJar>("prepare") {
destinationDir = File(buildDir, "libs")
baseName = embeddableCompilerBaseName
configurations = listOf(mainCfg)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(":build-common:assemble", ":core:script.runtime:assemble")
from(embedCfg.files)
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
packagesToRelocate.forEach {
relocate(it, "$kotlinEmbeddableRootPackage.$it")
}
relocate("org.fusesource", "$kotlinEmbeddableRootPackage.org.fusesource") {
// TODO: remove "it." after #KT-12848 get addressed
exclude("org.fusesource.jansi.internal.CLibrary")
}
}
defaultTasks(embeddableTask.name)
artifacts.add(mainCfg.name, embeddableTask.outputs.files.singleFile) {
builtBy(embeddableTask)
classifier = ""
}
import java.io.File
import proguard.gradle.ProGuardTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.file.DuplicatesStrategy
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
classpath("net.sf.proguard:proguard-gradle:5.3.1")
}
}
apply { plugin("maven") }
// Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build
val shrink = true
val bootstrapBuild = false
val compilerManifestClassPath =
if (bootstrapBuild) "kotlin-runtime-internal-bootstrap.jar kotlin-reflect-internal-bootstrap.jar kotlin-script-runtime-internal-bootstrap.jar"
else "kotlin-runtime.jar kotlin-reflect.jar kotlin-script-runtime.jar"
val ideaSdkCoreCfg = configurations.create("ideaSdk-core")
val otherDepsCfg = configurations.create("other-deps")
val proguardLibraryJarsCfg = configurations.create("library-jars")
val mainCfg = configurations.create("default_")
val packedCfg = configurations.create("packed")
//val withBootstrapRuntimeCfg = configurations.create("withBootstrapRuntime")
val compilerBaseName: String by rootProject.extra
val outputJar = File(buildDir, "libs", "$compilerBaseName.jar")
val javaHome = System.getProperty("java.home")
val compilerProject = project(":compiler")
dependencies {
ideaSdkCoreCfg(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
ideaSdkCoreCfg(ideaSdkDeps("jna-platform", "oromatcher"))
ideaSdkCoreCfg(ideaSdkDeps("jps-model.jar", subdir = "jps"))
otherDepsCfg(commonDep("javax.inject"))
otherDepsCfg(commonDep("jline"))
otherDepsCfg(protobufFull())
otherDepsCfg(commonDep("com.github.spullara.cli-parser", "cli-parser"))
otherDepsCfg(commonDep("com.google.code.findbugs", "jsr305"))
otherDepsCfg(commonDep("io.javaslang","javaslang"))
otherDepsCfg(preloadedDeps("json-org"))
buildVersion()
proguardLibraryJarsCfg(files("$javaHome/lib/rt.jar".takeIf { File(it).exists() } ?: "$javaHome/../Classes/classes.jar",
"$javaHome/lib/jsse.jar".takeIf { File(it).exists() } ?: "$javaHome/../Classes/jsse.jar"))
proguardLibraryJarsCfg(kotlinDep("stdlib"))
proguardLibraryJarsCfg(kotlinDep("script-runtime"))
proguardLibraryJarsCfg(kotlinDep("reflect"))
proguardLibraryJarsCfg(files("${System.getProperty("java.home")}/../lib/tools.jar"))
// proguardLibraryJarsCfg(project(":prepare:runtime", configuration = "default").apply { isTransitive = false })
// proguardLibraryJarsCfg(project(":prepare:reflect", configuration = "default").apply { isTransitive = false })
// proguardLibraryJarsCfg(project(":core:script.runtime").apply { isTransitive = false })
}
val packCompilerTask = task<ShadowJar>("internal.pack-compiler") {
configurations = listOf(packedCfg)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = File(buildDir, "libs")
baseName = compilerBaseName + "-before-shrink"
dependsOn(protobufFullTask)
setupRuntimeJar("Kotlin Compiler")
(rootProject.extra["compilerModules"] as Array<String>).forEach {
dependsOn("$it:classes")
from(project(it).getCompiledClasses())
}
from(ideaSdkCoreCfg.files)
from(otherDepsCfg.files)
from(project(":core:builtins").getResourceFiles()) { include("kotlin/**") }
manifest.attributes.put("Class-Path", compilerManifestClassPath)
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
}
val proguardTask = task<ProGuardTask>("internal.proguard-compiler") {
dependsOn(packCompilerTask)
configuration("$rootDir/compiler/compiler.pro")
inputs.files(packCompilerTask.outputs.files.singleFile)
outputs.file(outputJar)
// TODO: remove after dropping compatibility with ant build
doFirst {
System.setProperty("kotlin-compiler-jar-before-shrink", packCompilerTask.outputs.files.singleFile.canonicalPath)
System.setProperty("kotlin-compiler-jar", outputJar.canonicalPath)
}
proguardLibraryJarsCfg.files.forEach { jar ->
libraryjars(jar)
}
printconfiguration("$buildDir/compiler.pro.dump")
}
dist {
if (shrink) {
from(proguardTask)
} else {
from(packCompilerTask)
rename("-before-shrink", "")
}
}
artifacts.add(mainCfg.name, proguardTask.outputs.files.singleFile) {
builtBy(proguardTask)
classifier = ""
}
import org.gradle.jvm.tasks.Jar
apply { plugin("java") }
tasks.withType<Jar> {
setupRuntimeJar("Kotlin Formatter")
archiveName = "kotlin-formatter.jar"
dependsOn(":idea:formatter:classes")
project(":idea:formatter").let { p ->
p.pluginManager.withPlugin("java") {
from(p.the<JavaPluginConvention>().sourceSets.getByName("main").output)
}
}
from(fileTree("$rootDir/idea/formatter")) { include("src/**") } // Eclipse formatter sources navigation depends on this
}
configureKotlinProjectSources() // no sources
configureKotlinProjectNoTests()
import org.gradle.jvm.tasks.Jar
apply { plugin("java") }
tasks.withType<Jar> {
setupRuntimeJar("Kotlin IDE Lazy Resolver")
archiveName = "kotlin-ide-common.jar"
dependsOn(":idea:ide-common:classes")
project(":idea:ide-common").let { p ->
p.pluginManager.withPlugin("java") {
from(p.the<JavaPluginConvention>().sourceSets.getByName("main").output)
}
}
from(fileTree("$rootDir/idea/ide-common")) { include("src/**") } // Eclipse formatter sources navigation depends on this
}
configureKotlinProjectSources() // no sources
configureKotlinProjectNoTests()
import org.gradle.jvm.tasks.Jar
apply { plugin("java") }
val projectsToShadow = listOf(
":build-common",
":compiler:cli-common",
":compiler:compiler-runner",
":compiler:daemon-client",
":compiler:daemon-common",
":core",
":idea:idea-jps-common",
":jps-plugin",
":compiler:preloader",
":compiler:util",
":core:util.runtime",
":plugins:android-extensions-jps")
dependencies {}
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin JPS plugin")
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main")
manifest.attributes.put("Class-Path", "kotlin-runtime.jar")
archiveName = "kotlin-jps-plugin.jar"
projectsToShadow.forEach {
dependsOn("$it:classes")
project(it).let { p ->
p.pluginManager.withPlugin("java") {
from(p.the<JavaPluginConvention>().sourceSets.getByName("main").output)
}
}
}
from(fileTree("$rootDir/jps-plugin/src")) { include("META-INF/**") }
from(files("$rootDir/resources/kotlinManifest.properties"))
from(zipTree("$rootDir/dependencies/native-platform-uberjar.jar"))
}
configureKotlinProjectSources() // no sources
configureKotlinProjectNoTests()
ideaPlugin("lib/jps") {
from(jar)
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
}
}
val projectsToShadow = listOf(
":core:builtins",
":plugins:annotation-based-compiler-plugins-ide-support",
":compiler:backend",
":compiler:backend-common",
":build-common",
":compiler:cli-common",
":compiler:container",
":compiler:daemon-common",
":core",
":eval4j",
":idea:formatter",
":compiler:frontend",
":compiler:frontend.java",
":compiler:frontend.script",
":idea:ide-common",
":idea",
":idea:idea-android",
":idea:idea-android-output-parser",
":idea:idea-core",
":idea:idea-jps-common",
//":idea-ultimate",
":compiler:ir.psi2ir",
":compiler:ir.tree",
":j2k",
":js:js.ast",
":js:js.frontend",
":js:js.parser",
":js:js.serializer",
":compiler:light-classes",
":compiler:plugin-api",
":compiler:preloader",
":compiler:resolution",
":compiler:serialization",
":compiler:util",
":core:util.runtime")
val packedJars by configurations.creating
val sideJars by configurations.creating
dependencies {
packedJars(commonDep("com.github.spullara.cli-parser", "cli-parser"))
packedJars(preloadedDeps("protobuf-${rootProject.extra["versions.protobuf-java"]}"))
sideJars(project(":kotlin-script-runtime"))
sideJars(commonDep("io.javaslang", "javaslang"))
sideJars(commonDep("javax.inject"))
sideJars(preloadedDeps("markdown", "kotlinx-coroutines-core", "kotlinx-coroutines-jdk8", "uast-java"))
}
val targetJar = File(buildDir, "libs", "kotlin-plugin.jar")
val shadowTask = task<ShadowJar>("shadowJar") {
setupRuntimeJar("Kotlin IDEA plugin")
archiveName = targetJar.canonicalPath
projectsToShadow.forEach {
dependsOn("$it:classes")
project(it).let { p ->
p.pluginManager.withPlugin("java") {
from(p.the<JavaPluginConvention>().sourceSets.getByName("main").output)
}
}
}
from(files("$rootDir/resources/kotlinManifest.properties"))
from(packedJars.files)
}
ideaPlugin {
dependsOn(shadowTask)
from(targetJar)
dependsOn(":kotlin-script-runtime:jar")
from(sideJars)
}
import org.gradle.jvm.tasks.Jar
import org.gradle.api.internal.HasConvention
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
apply { plugin("kotlin") }
dependencies {
val compile by configurations
compile(project(":kotlin-stdlib"))
}
val jar: Jar by tasks
jar.apply {
setupRuntimeJar("Kotlin Mock Runtime for Tests")
from(fileTree("${rootProject.extra["distDir"]}/builtins")) { include("kotlin/**") }
archiveName = "kotlin-mock-runtime-for-test.jar"
}
configure<JavaPluginConvention> {
sourceSets["main"].apply {
(this as HasConvention).convention.getPlugin<KotlinSourceSet>().kotlin.apply {
srcDir(File(rootDir, "core", "runtime.jvm", "src"))
.include("kotlin/TypeAliases.kt",
"kotlin/text/TypeAliases.kt")
srcDir(File(rootDir, "libraries", "stdlib", "src"))
.include("kotlin/collections/TypeAliases.kt",
"kotlin/jvm/JvmVersion.kt",
"kotlin/util/Standard.kt",
"kotlin/internal/Annotations.kt")
}
}
}
configureKotlinProjectNoTests()
task<Copy>("dist") {
into(rootProject.extra["distDir"].toString())
from(jar)
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.jetbrains.org.objectweb.asm.*
import org.gradle.jvm.tasks.Jar
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.util.jar.JarFile
import java.util.zip.ZipOutputStream
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
classpath(ideaSdkDeps("asm-all"))
}
}
apply { plugin("com.github.johnrengelman.shadow") }
// Set to false to prevent relocation and metadata stripping on kotlin-reflect.jar and reflection sources. Use to debug reflection
val obfuscateReflect = true
val classesFromProjectsCfg = configurations.create("classes-from-projects")
val otherDepsCfg = configurations.create("other-deps")
val mainCfg = configurations.create("default")
val outputReflectJarFileBase = "$buildDir/libs/kotlin-reflect"
val coreProjectName = ":core"
val reflectionProjectName = ":core:reflection.jvm"
artifacts.add(mainCfg.name, File(outputReflectJarFileBase + ".jar"))
dependencies {
classesFromProjectsCfg.name(projectDepIntransitive(coreProjectName))
classesFromProjectsCfg.name(projectDepIntransitive(":core:util.runtime"))
classesFromProjectsCfg.name(projectDepIntransitive(reflectionProjectName))
otherDepsCfg.name(protobufLite())
otherDepsCfg.name(commonDep("javax.inject"))
buildVersion()
}
val prePackReflectTask = task<ShadowJar>("pre-pack-reflect") {
classifier = if (obfuscateReflect) outputReflectJarFileBase + "_beforeStrip" else outputReflectJarFileBase
configurations = listOf(mainCfg)
setupRuntimeJar("Kotlin Reflect")
dependsOn("$coreProjectName:assemble", "$reflectionProjectName:assemble", protobufLiteTask)
from(project(reflectionProjectName).getCompiledClasses())
from(project(coreProjectName).getCompiledClasses())
from(project(":core:util.runtime").getCompiledClasses())
from(project(coreProjectName).file("descriptor.loader.java/src")) {
include("META-INF/services/**")
}
from(otherDepsCfg.files)
manifest.attributes.put("Class-Path", "kotlin-runtime.jar")
if (obfuscateReflect) {
relocate("org.jetbrains.kotlin", "kotlin.reflect.jvm.internal.impl")
relocate("javax.inject", "kotlin.reflect.jvm.internal.impl.javax.inject")
}
}
val mainTask = task("prepare") {
dependsOn(prePackReflectTask)
val inFile = File(outputReflectJarFileBase + "_beforeStrip.jar")
val outFile = File(outputReflectJarFileBase + ".jar")
inputs.file(inFile)
outputs.file(outFile)
val annotationRegex = "kotlin/Metadata".toRegex()
val classRegex = "kotlin/reflect/jvm/internal/impl/.*".toRegex()
doLast {
println("Stripping annotations from all classes in $inFile")
println("Input file size: ${inFile.length()} bytes")
fun transform(entryName: String, bytes: ByteArray): ByteArray {
if (!entryName.endsWith(".class")) return bytes
if (!classRegex.matches(entryName.removeSuffix(".class"))) return bytes
var changed = false
val classWriter = ClassWriter(0)
val classVisitor = object : ClassVisitor(Opcodes.ASM5, classWriter) {
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
if (annotationRegex.matches(Type.getType(desc).internalName)) {
changed = true
return null
}
return super.visitAnnotation(desc, visible)
}
}
ClassReader(bytes).accept(classVisitor, 0)
if (!changed) return bytes
return classWriter.toByteArray()
}
ZipOutputStream(BufferedOutputStream(FileOutputStream(outFile))).use { outJar ->
val inJar = JarFile(inFile)
try {
for (entry in inJar.entries()) {
if (entry.isDirectory) continue
val inBytes = inJar.getInputStream(entry).readBytes()
val outBytes = transform(entry.name, inBytes)
if (inBytes.size < outBytes.size) {
error("Size increased for ${entry.name}: was ${inBytes.size} bytes, became ${outBytes.size} bytes")
}
entry.compressedSize = -1L
outJar.putNextEntry(entry)
outJar.write(outBytes)
outJar.closeEntry()
}
}
finally {
// Yes, JarFile does not extend Closeable on JDK 6 so we can't use "use" here
inJar.close()
}
}
println("Output written to $outFile")
println("Output file size: ${outFile.length()} bytes")
}
}
defaultTasks(mainTask.name)
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.io.File
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
classpath(ideaSdkDeps("asm-all"))
}
}
apply { plugin("com.github.johnrengelman.shadow") }
val mainCfg = configurations.create("default")
val outputRuntimeJarFileBase = "$buildDir/libs/kotlin-runtime"
artifacts.add(mainCfg.name, File(outputRuntimeJarFileBase + ".jar"))
dependencies {
mainCfg.name(projectDepIntransitive(":core:builtins"))
mainCfg.name(projectDepIntransitive(":kotlin-stdlib"))
buildVersion()
}
val mainTask = task<ShadowJar>("prepare") {
classifier = outputRuntimeJarFileBase
configurations = listOf(mainCfg)
dependsOn(":core:builtins:assemble", ":kotlin-stdlib:assemble")
setupRuntimeJar("Kotlin Runtime")
from(mainCfg.files)
}
defaultTasks(mainTask.name)
// modules
include 'buildSrc' // this fixes import into idea, so buildsrc is not longer imported with different gradle version
include "build-common"
include "compiler"
include "compiler:util"
include "compiler:daemon-common"
include "compiler:daemon-client"
include "compiler:preloader"
include "compiler:cli-runner"
include "compiler:container"
include "compiler:resolution"
include "compiler:serialization"
include "compiler:frontend"
include "compiler:frontend.java"
include "compiler:frontend.script"
include "compiler:compiler-runner"
include "compiler:cli-common"
include "compiler:ir.tree"
include "compiler:ir.psi2ir"
include "compiler:ir.ir2cfg"
include "compiler:backend-common"
include "compiler:backend"
include "compiler:plugin-api"
include "compiler:light-classes"
include "compiler:cli"
include "compiler:incremental-compilation-impl"
include "compiler:android-tests"
include "compiler.tests-common"
include "js:js.ast"
include "js:js.serializer"
include "js:js.parser"
include "js:js.frontend"
include "js:js.translator"
include "js:js.dce"
include "js:js.tests"
include "jps-plugin"
include "core"
include "core:builtins"
include "core:reflection.jvm"
include "core:script.runtime"
include "core:util.runtime"
include "custom-dependencies:protobuf-lite"
include "idea:idea-jps-common"
include "idea:formatter"
include "idea:ide-common"
include "idea:idea-core"
include "idea:kotlin-gradle-tooling"
include "idea:idea-android"
include "idea:idea-android-output-parser"
include "idea:idea-test-framework"
include "idea"
include "eval4j"
include "j2k"
include "plugins:lint"
include "plugins:android-extensions-compiler"
include "plugins:android-extensions-idea"
include "plugins:android-extensions-jps"
include "plugins:allopen-cli"
include "plugins:allopen-ide"
include "plugins:noarg-cli"
include "plugins:noarg-ide"
include "plugins:sam-with-receiver-cli"
include "plugins:sam-with-receiver-ide"
include "plugins:source-sections-compiler"
include "plugins:uast-kotlin"
include "plugins:uast-kotlin-idea"
include "plugins:annotation-based-compiler-plugins-ide-support"
include "plugins:kapt3"
include "plugins:plugins-tests"
include "kotlin-script-runtime"
include "kotlin-runtime"
include "kotlin-test:kotlin-test-common"
include "kotlin-test:kotlin-test-jvm"
include "kotlin-test:kotlin-test-junit"
include "kotlin-test:kotlin-test-js"
include "kotlin-stdlib-common"
include "kotlin-stdlib"
include "kotlin-stdlib-js"
include "kotlin-stdlib-jre7"
include "kotlin-stdlib-jre8"
include "kotlin-stdlib:samples"
include "prepare:build.version"
//include "prepare:compiler"
//include "prepare:compiler-embeddable"
//include "prepare:reflect"
//include "prepare:runtime"
include "prepare:jps-plugin"
include "prepare:formatter"
include "prepare:ide-lazy-resolver"
include "prepare:kotlin-plugin"
include "prepare:android-lint"
include "prepare:mock-runtime-for-test"
include "kotlin-reflect"
include "ant"
include "compiler:tests-java8"
include "generators"
include 'tools:binary-compatibility-validator'
include 'tools:kotlin-stdlib-js-merger'
include 'tools:kotlin-stdlib-gen'
include ':kotlin-gradle-plugin-api',
':kotlin-gradle-plugin',
':kotlin-gradle-plugin-integration-tests',
':kotlin-allopen',
':kotlin-noarg',
':kotlin-sam-with-receiver',
':kotlin-gradle-subplugin-example'
include ':examples:annotation-processor-example'
rootProject.name = "kotlin"
project(':kotlin-runtime').projectDir = "$rootDir/libraries/tools/runtime" as File
project(':kotlin-script-runtime').projectDir = "$rootDir/libraries/tools/script-runtime" as File
project(':kotlin-test:kotlin-test-common').projectDir = "$rootDir/libraries/kotlin.test/common" as File
project(':kotlin-test:kotlin-test-jvm').projectDir = "$rootDir/libraries/kotlin.test/jvm" as File
project(':kotlin-test:kotlin-test-junit').projectDir = "$rootDir/libraries/kotlin.test/junit" as File
project(':kotlin-test:kotlin-test-js').projectDir = "$rootDir/libraries/kotlin.test/js" as File
project(':kotlin-stdlib-common').projectDir = "$rootDir/libraries/stdlib/common" as File
project(':kotlin-stdlib').projectDir = "$rootDir/libraries/stdlib" as File
project(':kotlin-stdlib-js').projectDir = "$rootDir/libraries/stdlib/js" as File
project(':kotlin-stdlib-jre7').projectDir = "$rootDir/libraries/stdlib/jre7" as File
project(':kotlin-stdlib-jre8').projectDir = "$rootDir/libraries/stdlib/jre8" as File
project(':kotlin-stdlib:samples').projectDir = "$rootDir/libraries/stdlib/samples" as File
project(':kotlin-reflect').projectDir = "$rootDir/libraries/tools/kotlin-reflect" as File
project(':compiler:cli-common').projectDir = "$rootDir/compiler/cli/cli-common" as File
project(':compiler:cli-runner').projectDir = "$rootDir/compiler/cli/cli-runner" as File
project(':compiler:daemon-common').projectDir = "$rootDir/compiler/daemon/daemon-common" as File
project(':compiler:daemon-client').projectDir = "$rootDir/compiler/daemon/daemon-client" as File
project(':compiler:ir.tree').projectDir = "$rootDir/compiler/ir/ir.tree" as File
project(':compiler:ir.psi2ir').projectDir = "$rootDir/compiler/ir/ir.psi2ir" as File
project(':compiler:ir.ir2cfg').projectDir = "$rootDir/compiler/ir/ir.ir2cfg" as File
project(':idea:idea-android-output-parser').projectDir = "$rootDir/idea/idea-android/idea-android-output-parser" as File
project(':plugins:android-extensions-compiler').projectDir = "$rootDir/plugins/android-extensions/android-extensions-compiler" as File
project(':plugins:android-extensions-idea').projectDir = "$rootDir/plugins/android-extensions/android-extensions-idea" as File
project(':plugins:android-extensions-jps').projectDir = "$rootDir/plugins/android-extensions/android-extensions-jps" as File
project(':plugins:allopen-cli').projectDir = "$rootDir/plugins/allopen/allopen-cli" as File
project(':plugins:allopen-ide').projectDir = "$rootDir/plugins/allopen/allopen-ide" as File
project(':plugins:noarg-cli').projectDir = "$rootDir/plugins/noarg/noarg-cli" as File
project(':plugins:noarg-ide').projectDir = "$rootDir/plugins/noarg/noarg-ide" as File
project(':plugins:sam-with-receiver-cli').projectDir = "$rootDir/plugins/sam-with-receiver/sam-with-receiver-cli" as File
project(':plugins:sam-with-receiver-ide').projectDir = "$rootDir/plugins/sam-with-receiver/sam-with-receiver-ide" as File
project(':plugins:source-sections-compiler').projectDir = "$rootDir/plugins/source-sections/source-sections-compiler" as File
project(':tools:binary-compatibility-validator').projectDir = "$rootDir/libraries/tools/binary-compatibility-validator" as File
project(':tools:kotlin-stdlib-js-merger').projectDir = "$rootDir/libraries/tools/kotlin-stdlib-js-merger" as File
project(':tools:kotlin-stdlib-gen').projectDir = "$rootDir/libraries/tools/kotlin-stdlib-gen" as File
project(':kotlin-gradle-plugin-api').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-api" as File
project(':kotlin-gradle-plugin').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin" as File
project(':kotlin-gradle-plugin-integration-tests').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-integration-tests" as File
project(':kotlin-allopen').projectDir = "$rootDir/libraries/tools/kotlin-allopen" as File
project(':kotlin-noarg').projectDir = "$rootDir/libraries/tools/kotlin-noarg" as File
project(':kotlin-sam-with-receiver').projectDir = "$rootDir/libraries/tools/kotlin-sam-with-receiver" as File
project(':kotlin-gradle-subplugin-example').projectDir = "$rootDir/libraries/examples/kotlin-gradle-subplugin-example" as File
project(':examples:annotation-processor-example').projectDir = "$rootDir/libraries/examples/annotation-processor-example" as File
def setBuildFile(ProjectDescriptor project) {
if (project.projectDir.listFiles().any { file -> file.name == "build.gradle.kts"}) {
project.buildFileName = "build.gradle.kts"
}
project.children.each { p -> setBuildFile(p) }
}
setBuildFile(rootProject)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册