Continue switching projects to improved dsl: sourceSets and test running

This commit is contained in:
Ilya Chernikov
2017-08-21 20:53:48 +02:00
parent 336e24b837
commit deda50dbbb
76 changed files with 372 additions and 614 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ dependencies {
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" { none() } "test" {}
} }
runtimeJar { runtimeJar {
+5 -76
View File
@@ -1,83 +1,11 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly @file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.* 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.plugins.JavaPluginConvention
import org.gradle.api.tasks.* import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.* import org.gradle.kotlin.dsl.*
import java.io.File
//import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet //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) = inline fun Project.sourceSets(crossinline body: SourceSetsBuilder.() -> Unit) =
SourceSetsBuilder(this).body() SourceSetsBuilder(this).body()
@@ -88,6 +16,7 @@ class SourceSetsBuilder(val project: Project) {
project.configure<JavaPluginConvention> project.configure<JavaPluginConvention>
{ {
sourceSets.matching { it.name == sourceSetName }.forEach { sourceSets.matching { it.name == sourceSetName }.forEach {
none()
it.body() it.body()
} }
} }
@@ -95,15 +24,15 @@ class SourceSetsBuilder(val project: Project) {
} }
fun SourceSet.none() { fun SourceSet.none() {
java.srcDirs() java.setSrcDirs(emptyList<String>())
resources.srcDirs() resources.setSrcDirs(emptyList<String>())
} }
fun SourceSet.projectDefault() { fun SourceSet.projectDefault() {
when (name) { when (name) {
"main" -> { "main" -> {
java.srcDirs("src") java.srcDirs("src")
resources.srcDir("resources") resources.srcDir("resources").apply { include("**") }
resources.srcDir("src").apply { include("META-INF/**", "**/*.properties") } resources.srcDir("src").apply { include("META-INF/**", "**/*.properties") }
} }
"test" -> { "test" -> {
@@ -112,7 +41,7 @@ fun SourceSet.projectDefault() {
} }
} }
// TODO: adding dep to the plugin breaks the build unexpectedly, resolve and uncomment // TODO: adding KotlinSourceSet dep to the plugin breaks the build unexpectedly, resolve and uncomment
//val SourceSet.kotlin: SourceDirectorySet //val SourceSet.kotlin: SourceDirectorySet
// get() = // get() =
// (this as HasConvention) // (this as HasConvention)
+4 -4
View File
@@ -4,7 +4,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(project(":core::util.runtime")) compile(project(":core::util.runtime"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
@@ -30,6 +29,7 @@ dependencies {
compile(preloadedDeps("dx", subdir = "android-5.0/lib")) compile(preloadedDeps("dx", subdir = "android-5.0/lib"))
} }
configureKotlinProjectSources("tests-common", sourcesBaseDir = File(rootDir, "compiler")) sourceSets {
configureKotlinProjectNoTests() "main" { java.srcDir("../compiler/tests-common") }
"test" {}
}
+8 -18
View File
@@ -1,15 +1,7 @@
apply { apply { plugin("kotlin") }
plugin("kotlin")
}
dependencies { 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:util"))
compile(project(":compiler:cli")) compile(project(":compiler:cli"))
compile(project(":compiler.tests-common")) compile(project(":compiler.tests-common"))
@@ -28,13 +20,11 @@ dependencies {
testCompile(ideaSdkDeps("jps-builders")) testCompile(ideaSdkDeps("jps-builders"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { java.srcDirs() }
"test" { projectDefault() }
}
tasks.withType<Test> {
workingDir = rootDir projectTest {
systemProperty("idea.is.unit.test", "true") workingDir = rootDir
systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
+7 -4
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -10,6 +9,10 @@ dependencies {
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
} }
configureKotlinProjectSources("backend-common/src", "ir/backend.common/src", sourcesBaseDir = File(rootDir, "compiler")) sourceSets {
configureKotlinProjectNoTests() "main" {
projectDefault()
java.srcDir("../ir/backend.common/src")
}
"test" {}
}
+7 -4
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:backend-common")) compile(project(":compiler:backend-common"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -12,7 +11,11 @@ dependencies {
compile(project(":compiler:serialization")) compile(project(":compiler:serialization"))
} }
configureKotlinProjectSources("backend/src", "ir/backend.jvm/src", sourcesBaseDir = File(rootDir, "compiler")) sourceSets {
configureKotlinProjectResourcesDefault() "main" {
configureKotlinProjectNoTests() projectDefault()
java.srcDir("../ir/backend.jvm/src")
}
"test" {}
}
+12 -15
View File
@@ -39,28 +39,25 @@ dependencies {
buildVersion() buildVersion()
} }
configureKotlinProjectSources( sourceSets {
"compiler/daemon/src", "main" {
"compiler/conditional-preprocessor/src", java.srcDirs("daemon/src",
sourcesBaseDir = rootDir) "conditional-preprocessor/src")
configureKotlinProjectResources("idea/src", sourcesBaseDir = rootDir) { resources.srcDir("../idea/src").apply {
include("META-INF/extensions/common.xml", include("META-INF/extensions/common.xml",
"META-INF/extensions/kotlin2jvm.xml", "META-INF/extensions/kotlin2jvm.xml",
"META-INF/extensions/kotlin2js.xml") "META-INF/extensions/kotlin2js.xml")
}
}
"test" { projectDefault() }
} }
configureKotlinProjectTests("tests")
testsJar {} testsJar {}
tasks.withType<Test> { projectTest {
dependsOnTaskIfExistsRec("dist", project = rootProject) dependsOnTaskIfExistsRec("dist", project = rootProject)
dependsOn(":prepare:mock-runtime-for-test:dist") dependsOn(":prepare:mock-runtime-for-test:dist")
workingDir = rootDir 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)) 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
} }
+9 -9
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -22,11 +21,12 @@ dependencies {
compile(files("${System.getProperty("java.home")}/../lib/tools.jar")) compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
} }
configureKotlinProjectSources("compiler/cli/src", sourceSets {
"plugins/annotation-collector/src", "main" {
"compiler/builtins-serializer/src", projectDefault()
"compiler/javac-wrapper/src", java.srcDirs("../../plugins/annotation-collector/src",
sourcesBaseDir = rootDir) "../builtins-serializer/src",
configureKotlinProjectResourcesDefault() "../javac-wrapper/src")
configureKotlinProjectNoTests() }
"test" {}
}
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core:util.runtime")) compile(project(":core:util.runtime"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
@@ -10,6 +9,8 @@ dependencies {
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>))) compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+1 -1
View File
@@ -11,7 +11,7 @@ dependencies {
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" { none() } "test" {}
} }
runtimeJar { runtimeJar {
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-build-common")) compile(project(":kotlin-build-common"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
compile(project(":kotlin-preloader")) compile(project(":kotlin-preloader"))
@@ -12,6 +11,8 @@ dependencies {
compile(project(":compiler:util")) compile(project(":compiler:util"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+5 -12
View File
@@ -2,11 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { 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(":core:util.runtime"))
compile(commonDep("javax.inject")) compile(commonDep("javax.inject"))
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
@@ -15,17 +10,15 @@ dependencies {
testRuntime(ideaSdkCoreDeps("trove4j", "intellij-core")) testRuntime(ideaSdkCoreDeps("trove4j", "intellij-core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
testsJar {} testsJar {}
projectTest {
tasks.withType<Test> {
dependsOnTaskIfExistsRec("dist", project = rootProject) dependsOnTaskIfExistsRec("dist", project = rootProject)
dependsOn(":prepare:mock-runtime-for-test:dist") dependsOn(":prepare:mock-runtime-for-test:dist")
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
@@ -14,7 +14,7 @@ dependencies {
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" { none() } "test" {}
} }
runtimeJar { runtimeJar {
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>))) compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -4
View File
@@ -2,13 +2,13 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectResourcesDefault() "main" { projectDefault() }
configureKotlinProjectNoTests() "test" {}
}
+4 -3
View File
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":kotlin-reflect")) compile(project(":kotlin-reflect"))
compile(preloadedDeps("kotlinx-coroutines-core")) compile(preloadedDeps("kotlinx-coroutines-core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:container")) compile(project(":compiler:container"))
@@ -11,6 +10,8 @@ dependencies {
compile(commonDep("io.javaslang","javaslang")) compile(commonDep("io.javaslang","javaslang"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -14,7 +13,9 @@ dependencies {
testCompile(projectTests(":kotlin-build-common")) testCompile(projectTests(":kotlin-build-common"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
testsJar() testsJar()
+4 -3
View File
@@ -2,12 +2,13 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:ir.tree")) compile(project(":compiler:ir.tree"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:backend-common")) compile(project(":compiler:backend-common"))
compile(project(":compiler:ir.tree")) compile(project(":compiler:ir.tree"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,11 +2,12 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:backend")) compile(project(":compiler:backend"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,12 +2,13 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+1 -1
View File
@@ -15,7 +15,7 @@ sourceSets {
srcDirs( "src", "instrumentation/src") srcDirs( "src", "instrumentation/src")
} }
} }
"test" { none() } "test" {}
} }
runtimeJar { runtimeJar {
+4 -3
View File
@@ -2,11 +2,12 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":core")) compile(project(":core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,11 +2,12 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":core")) compile(project(":core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+5 -13
View File
@@ -3,11 +3,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { 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(commonDep("junit:junit"))
testCompile(project(":kotlin-test:kotlin-test-jvm")) testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":kotlin-test:kotlin-test-junit")) testCompile(project(":kotlin-test:kotlin-test-junit"))
@@ -31,8 +26,10 @@ dependencies {
testRuntime(ideaSdkDeps("*.jar")) testRuntime(ideaSdkDeps("*.jar"))
} }
configureKotlinProjectSources() sourceSets {
configureKotlinProjectTestsDefault() "main" {}
"test" { projectDefault() }
}
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
kotlinOptions.jdkHome = rootProject.extra["JDK_18"]!!.toString() kotlinOptions.jdkHome = rootProject.extra["JDK_18"]!!.toString()
@@ -41,16 +38,11 @@ tasks.withType<KotlinCompile> {
testsJar {} testsJar {}
tasks.withType<Test> { projectTest {
executable = "${rootProject.extra["JDK_18"]!!}/bin/java" executable = "${rootProject.extra["JDK_18"]!!}/bin/java"
dependsOnTaskIfExistsRec("dist", project = rootProject) dependsOnTaskIfExistsRec("dist", project = rootProject)
dependsOn(":prepare:mock-runtime-for-test:dist") dependsOn(":prepare:mock-runtime-for-test:dist")
workingDir = rootDir 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)) 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
} }
+7 -4
View File
@@ -2,13 +2,16 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>))) compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
compile(ideaSdkDeps("jps-model.jar", subdir = "jps")) compile(ideaSdkDeps("jps-model.jar", subdir = "jps"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectResources("resources", sourcesBaseDir = rootDir) "main" {
configureKotlinProjectNoTests() projectDefault()
resources.srcDir(File(rootDir, "resources")).apply { include("**") }
}
"test" {}
}
+10 -8
View File
@@ -12,14 +12,16 @@ dependencies {
compile(commonDep("javax.inject")) compile(commonDep("javax.inject"))
} }
configureKotlinProjectSources( sourceSets {
"descriptor.loader.java/src", "main" {
"descriptors/src", java.srcDirs("descriptor.loader.java/src",
"descriptors.runtime/src", "descriptors/src",
"deserialization/src") "descriptors.runtime/src",
configureKotlinProjectResources( "deserialization/src")
"descriptor.loader.java/src", "deserialization/src") { include("META-INF/**") } resources.srcDirs("descriptor.loader.java/src", "deserialization/src").apply { include("META-INF/**") }
configureKotlinProjectNoTests() }
"test" {}
}
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
dependsOn(protobufLiteTask) dependsOn(protobufLiteTask)
+8 -3
View File
@@ -20,9 +20,14 @@ dependencies {
compile(files(builtinsSerialized)) compile(files(builtinsSerialized))
} }
configureKotlinProjectSources("core/builtins/src", "core/runtime.jvm/src", sourcesBaseDir = rootDir) sourceSets {
configureKotlinProjectResources(listOf(builtinsSerialized)) "main" {
configureKotlinProjectNoTests() projectDefault()
java.srcDir("../runtime.jvm/src")
resources.srcDir(builtinsSerialized).apply { include("**") }
}
"test" {}
}
val serialize = task("serialize") { val serialize = task("serialize") {
val outDir = builtinsSerialized val outDir = builtinsSerialized
+5 -13
View File
@@ -1,7 +1,6 @@
import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
buildscript { buildscript {
repositories { repositories {
@@ -20,16 +19,6 @@ apply {
plugin("com.github.johnrengelman.shadow") 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 { dependencies {
val compile by configurations val compile by configurations
compile(project(":core:builtins")) compile(project(":core:builtins"))
@@ -37,6 +26,11 @@ dependencies {
compile(protobufLite()) compile(protobufLite())
} }
sourceSets {
"main" { projectDefault() }
"test" {}
}
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
dependsOn(protobufLiteTask) dependsOn(protobufLiteTask)
} }
@@ -44,5 +38,3 @@ tasks.withType<JavaCompile> {
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
dependsOn(protobufLiteTask) dependsOn(protobufLiteTask)
} }
+4 -2
View File
@@ -10,8 +10,10 @@ dependencies {
buildVersion() buildVersion()
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
tasks.withType<Jar> { tasks.withType<Jar> {
setupRuntimeJar("Kotlin Script Runtime") setupRuntimeJar("Kotlin Script Runtime")
+4 -3
View File
@@ -5,11 +5,12 @@ apply {
} }
dependencies { dependencies {
val compile by configurations
compile(project(":core:builtins")) compile(project(":core:builtins"))
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+8 -13
View File
@@ -1,8 +1,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
val testCompile by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
compile(project(":kotlin-reflect")) compile(project(":kotlin-reflect"))
compile(project(":compiler:backend")) compile(project(":compiler:backend"))
@@ -13,15 +11,12 @@ dependencies {
buildVersion() buildVersion()
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
tasks.withType<Test> { }
dependsOnTaskIfExistsRec("dist", project = rootProject)
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true") projectTest {
maxHeapSize = "1200m" dependsOnTaskIfExistsRec("dist", project = rootProject)
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
+8 -17
View File
@@ -1,14 +1,7 @@
apply { apply { plugin("kotlin") }
plugin("kotlin")
}
dependencies { 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(":core"))
compile(project(":idea")) compile(project(":idea"))
compile(project(":j2k")) compile(project(":j2k"))
@@ -59,13 +52,11 @@ dependencies {
testRuntime(ideaPluginDeps("*.jar", plugin = "android")) testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
tasks.withType<Test> {
workingDir = rootDir projectTest {
systemProperty("idea.is.unit.test", "true") workingDir = rootDir
systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
+2 -6
View File
@@ -258,7 +258,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -295,7 +294,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -1941,7 +1939,8 @@
"testImplementation", "testImplementation",
"testRuntime", "testRuntime",
"testRuntimeClasspath", "testRuntimeClasspath",
"testRuntimeOnly" "testRuntimeOnly",
"tests-jar"
], ],
"extensions": { "extensions": {
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension", "ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
@@ -2679,7 +2678,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -2715,7 +2713,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3569,7 +3566,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
+16 -36
View File
@@ -2,14 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { 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(":kotlin-stdlib"))
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:backend")) compile(project(":compiler:backend"))
@@ -64,6 +56,8 @@ dependencies {
testCompileOnly(ideaSdkDeps("groovy-all", "velocity", "gson", "jsr305")) testCompileOnly(ideaSdkDeps("groovy-all", "velocity", "gson", "jsr305"))
testRuntime(ideaSdkDeps("*.jar"))
testRuntime(ideaPluginDeps("resources_en", plugin = "junit")) testRuntime(ideaPluginDeps("resources_en", plugin = "junit"))
testRuntime(ideaPluginDeps("jcommander", "resources_en", plugin = "testng")) testRuntime(ideaPluginDeps("jcommander", "resources_en", plugin = "testng"))
testRuntime(ideaPluginDeps("resources_en", plugin = "properties")) testRuntime(ideaPluginDeps("resources_en", plugin = "properties"))
@@ -90,41 +84,27 @@ dependencies {
(rootProject.extra["compilerModules"] as Array<String>).forEach { (rootProject.extra["compilerModules"] as Array<String>).forEach {
testCompile(project(it)) testCompile(project(it))
} }
buildVersion()
} }
configureKotlinProjectSources("src", sourceSets {
"idea-maven/src", "main" {
"idea-gradle/src", projectDefault()
"idea-completion/src", java.srcDirs("idea-maven/src",
"idea-live-templates/src", "idea-gradle/src",
"idea-repl/src") "idea-completion/src",
configure<JavaPluginConvention> { "idea-live-templates/src",
sourceSets["main"].apply { "idea-repl/src")
resources { }
srcDir(File(projectDir, "resources")) "test" {
.include("**") java.srcDirs("tests",
srcDir(File(projectDir, "src")) "idea-maven/test",
.include("META-INF/**", "idea-completion/tests")
"**/*.properties")
}
} }
} }
configureKotlinProjectTests("tests",
"idea-maven/test",
"idea-completion/tests")
tasks.withType<Test> { projectTest {
dependsOnTaskIfExistsRec("dist", project = rootProject) dependsOnTaskIfExistsRec("dist", project = rootProject)
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
maxHeapSize = "1200m"
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
testsJar {} testsJar {}
+4 -3
View File
@@ -2,12 +2,13 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(ideaSdkDeps("openapi")) compile(ideaSdkDeps("openapi"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
@@ -11,6 +10,8 @@ dependencies {
compile(ideaSdkCoreDeps("annotations", "guava", "intellij-core")) compile(ideaSdkCoreDeps("annotations", "guava", "intellij-core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+6 -12
View File
@@ -1,12 +1,7 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":kotlin-reflect")) compile(project(":kotlin-reflect"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:light-classes")) compile(project(":compiler:light-classes"))
@@ -47,14 +42,13 @@ dependencies {
testRuntime(ideaPluginDeps("*.jar", plugin = "android")) testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
tasks.withType<Test> { projectTest {
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
testsJar {} testsJar {}
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
compile(ideaPluginDeps("gradle-tooling-api", plugin = "gradle")) compile(ideaPluginDeps("gradle-tooling-api", plugin = "gradle"))
compile(ideaPluginDeps("android", "android-common", "sdk-common", plugin = "android")) compile(ideaPluginDeps("android", "android-common", "sdk-common", plugin = "android"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+7 -8
View File
@@ -1,7 +1,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -17,13 +16,13 @@ dependencies {
compile(ideaSdkDeps("openapi", "idea")) compile(ideaSdkDeps("openapi", "idea"))
compile(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle")) compile(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle"))
compile(preloadedDeps("kotlinx-coroutines-core", "kotlinx-coroutines-jdk8")) compile(preloadedDeps("kotlinx-coroutines-core", "kotlinx-coroutines-jdk8"))
buildVersion()
} }
configureKotlinProjectSources("idea-core/src", "idea-analysis/src", sourcesBaseDir = File(rootDir, "idea")) sourceSets {
configureKotlinProjectResources("idea-analysis/src", sourcesBaseDir = File(rootDir, "idea")) { "main" {
include("**/*.properties") projectDefault()
java.srcDir("../idea-analysis/src")
resources.srcDir("../idea-analysis/src").apply { include("**/*.properties") }
}
"test" {}
} }
configureKotlinProjectNoTests()
+4 -4
View File
@@ -2,15 +2,15 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
compile(ideaSdkCoreDeps("intellij-core", "util")) compile(ideaSdkCoreDeps("intellij-core", "util"))
buildVersion()
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.script")) compile(project(":compiler:frontend.script"))
compile(project(":compiler.tests-common")) compile(project(":compiler.tests-common"))
@@ -12,7 +11,9 @@ dependencies {
compile(ideaSdkDeps("openapi", "idea")) compile(ideaSdkDeps("openapi", "idea"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -16,9 +16,10 @@ dependencies {
buildVersion() buildVersion()
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
val jar: Jar by tasks val jar: Jar by tasks
+5 -12
View File
@@ -6,9 +6,6 @@ apply { plugin("kotlin") }
//} //}
dependencies { dependencies {
val compile by configurations
val testCompile by configurations
val testRuntime by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
@@ -42,20 +39,16 @@ dependencies {
// testRuntime(ideaPluginDeps("*.jar", plugin = "java-i18n")) // testRuntime(ideaPluginDeps("*.jar", plugin = "java-i18n"))
// testRuntime(ideaPluginDeps("*.jar", plugin = "coverage")) // testRuntime(ideaPluginDeps("*.jar", plugin = "coverage"))
// testRuntime(ideaPluginDeps("*.jar", plugin = "java-decompiler")) // testRuntime(ideaPluginDeps("*.jar", plugin = "java-decompiler"))
buildVersion()
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
tasks.withType<Test> { projectTest {
dependsOnTaskIfExistsRec("dist", project = rootProject) dependsOnTaskIfExistsRec("dist", project = rootProject)
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
maxHeapSize = "1200m"
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
testsJar() testsJar()
+4 -3
View File
@@ -2,12 +2,13 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(ideaSdkCoreDeps("trove4j", "intellij-core")) compile(ideaSdkCoreDeps("trove4j", "intellij-core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":js:js.ast")) compile(project(":js:js.ast"))
compile(project(":js:js.translator")) compile(project(":js:js.translator"))
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":js:js.ast")) compile(project(":js:js.ast"))
@@ -11,6 +10,8 @@ dependencies {
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":js:js.ast")) compile(project(":js:js.ast"))
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
compile(preloadedDeps("json-org")) compile(preloadedDeps("json-org"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:serialization")) compile(project(":compiler:serialization"))
@@ -10,6 +9,8 @@ dependencies {
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+4 -6
View File
@@ -2,10 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
testCompile(project(":compiler.tests-common")) testCompile(project(":compiler.tests-common"))
testCompile(project(":compiler:frontend")) testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:cli")) testCompile(project(":compiler:cli"))
@@ -19,8 +15,10 @@ dependencies {
testRuntime(ideaSdkDeps("*.jar")) testRuntime(ideaSdkDeps("*.jar"))
} }
configureKotlinProjectSources() sourceSets {
configureKotlinProjectTestsDefault() "main" {}
"test" { projectDefault() }
}
val test: Test by tasks val test: Test by tasks
test.apply { test.apply {
+7 -4
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -13,6 +12,10 @@ dependencies {
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
} }
configureKotlinProjectSources("js.translator/src", "js.inliner/src", sourcesBaseDir = File(rootDir, "js")) sourceSets {
configureKotlinProjectNoTests() "main" {
projectDefault()
java.srcDir("../js.inliner/src")
}
"test" {}
}
@@ -3,10 +3,10 @@ description = "Simple Annotation Processor for testing kapt"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
} }
configureKotlinProjectSources("src/kotlin") sourceSets {
configureKotlinProjectResources("src/resources") "test" {}
configureKotlinProjectNoTests() }
@@ -1,44 +1,7 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":plugins:kapt3")) compile(project(":plugins:kapt3"))
compileOnly("org.jetbrains.kotlin:gradle-api:1.6") compileOnly("org.jetbrains.kotlin:gradle-api:1.6")
compileOnly("com.android.tools.build:gradle:1.1.0") compileOnly("com.android.tools.build:gradle:1.1.0")
@@ -46,13 +9,12 @@ dependencies {
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
tasks.withType<Test> { }
workingDir = projectDir
systemProperty("idea.is.unit.test", "true") projectTest {
environment("NO_FS_ROOTS_ACCESS_CHECK", "true") workingDir = projectDir
ignoreFailures = true
} }
@@ -18,13 +18,7 @@ dependencies {
testRuntime("org.apache.maven:maven-core:3.0.3") testRuntime("org.apache.maven:maven-core:3.0.3")
} }
tasks.withType<Test> { projectTest()
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
maxHeapSize = "1200m"
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
}
runtimeJar() runtimeJar()
sourcesJar() sourcesJar()
+1 -1
View File
@@ -15,7 +15,7 @@ dependencies {
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" { none() } "test" {}
} }
val jar = runtimeJar { val jar = runtimeJar {
+4 -2
View File
@@ -17,8 +17,10 @@ dependencies {
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
val jar: Jar by tasks val jar: Jar by tasks
@@ -4,7 +4,6 @@ description = "Kotlin Android Extensions Compiler"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(ideaSdkCoreDeps("intellij-core")) compile(ideaSdkCoreDeps("intellij-core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:plugin-api")) compile(project(":compiler:plugin-api"))
@@ -14,16 +13,12 @@ dependencies {
compile(ideaPluginDeps("layoutlib", plugin = "android")) compile(ideaPluginDeps("layoutlib", plugin = "android"))
} }
configureKotlinProjectSources("android-extensions-compiler/src", "android-extensions-runtime/src", sourcesBaseDir = File(rootDir, "plugins", "android-extensions"))
configureKotlinProjectResourcesDefault(sourcesBaseDir = File(rootDir, "plugins", "android-extensions", "android-extensions-compiler", "src"))
configureKotlinProjectNoTests()
sourceSets { sourceSets {
"main" { "main" {
projectDefault() projectDefault()
java.srcDir("../android-extensions-runtime/src") java.srcDir("../android-extensions-runtime/src")
} }
"test" { none() } "test" {}
} }
runtimeJar () runtimeJar ()
@@ -43,17 +43,15 @@ dependencies {
testRuntime(ideaPluginDeps("*.jar", plugin = "android")) testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
testsJar {} testsJar {}
projectTest {
tasks.withType<Test> {
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
val jar: Jar by tasks val jar: Jar by tasks
@@ -2,13 +2,14 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":jps-plugin")) compile(project(":jps-plugin"))
compile(project(":android-extensions-compiler")) compile(project(":android-extensions-compiler"))
compile(ideaPluginDeps("android-jps-plugin", plugin = "android", subdir = "lib/jps")) compile(ideaPluginDeps("android-jps-plugin", plugin = "android", subdir = "lib/jps"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
@@ -2,11 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { 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:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
@@ -17,6 +12,8 @@ dependencies {
compileOnly(ideaSdkDeps("openapi", "idea")) compileOnly(ideaSdkDeps("openapi", "idea"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+5 -11
View File
@@ -2,11 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { 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:util"))
compile(project(":compiler:cli")) compile(project(":compiler:cli"))
compile(project(":compiler:backend")) compile(project(":compiler:backend"))
@@ -17,15 +12,14 @@ dependencies {
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
testsJar {} testsJar {}
tasks.withType<Test> { projectTest {
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
+9 -6
View File
@@ -5,7 +5,6 @@ apply {
} }
dependencies { dependencies {
val compile by configurations
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":idea")) compile(project(":idea"))
compile(project(":idea:idea-core")) compile(project(":idea:idea-core"))
@@ -16,9 +15,13 @@ dependencies {
compile(ideaSdkDeps("guava")) compile(ideaSdkDeps("guava"))
} }
configureKotlinProjectSources("android-annotations/src", sourceSets {
"lint-api/src", "main" {
"lint-checks/src", java.srcDirs("android-annotations/src",
"lint-idea/src") "lint-api/src",
configureKotlinProjectNoTests() "lint-checks/src",
"lint-idea/src")
}
"test" {}
}
+4 -4
View File
@@ -4,8 +4,6 @@ description = "Kotlin NoArg Compiler Plugin"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compileOnly by configurations
val runtime by configurations
compileOnly(project(":compiler:frontend")) compileOnly(project(":compiler:frontend"))
compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":compiler:backend")) compileOnly(project(":compiler:backend"))
@@ -15,8 +13,10 @@ dependencies {
runtime(project(":kotlin-stdlib")) runtime(project(":kotlin-stdlib"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
val jar = runtimeJar { val jar = runtimeJar {
from(fileTree("$projectDir/src")) { include("META-INF/**") } from(fileTree("$projectDir/src")) { include("META-INF/**") }
+4 -3
View File
@@ -20,9 +20,10 @@ dependencies {
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
val jar: Jar by tasks val jar: Jar by tasks
+4 -7
View File
@@ -2,11 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { 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:util"))
testCompile(project(":compiler:backend")) testCompile(project(":compiler:backend"))
testCompile(project(":compiler:cli")) testCompile(project(":compiler:cli"))
@@ -35,8 +30,10 @@ dependencies {
testRuntime(ideaPluginDeps("*.jar", plugin = "android")) testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
} }
configureKotlinProjectSources() sourceSets {
configureKotlinProjectTestsDefault() "main" {}
"test" { projectDefault() }
}
testsJar {} testsJar {}
@@ -15,7 +15,7 @@ dependencies {
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" { none() } "test" {}
} }
val jar = runtimeJar { val jar = runtimeJar {
@@ -14,8 +14,10 @@ dependencies {
compile(project(":idea")) compile(project(":idea"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
val jar: Jar by tasks val jar: Jar by tasks
+4 -3
View File
@@ -2,7 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
compile(project(":core:util.runtime")) compile(project(":core:util.runtime"))
compile(project(":compiler:backend")) compile(project(":compiler:backend"))
@@ -12,6 +11,8 @@ dependencies {
buildVersion() buildVersion()
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectNoTests() "main" { projectDefault() }
"test" {}
}
+5 -13
View File
@@ -2,11 +2,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { 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(":kotlin-stdlib"))
compile(project(":core:util.runtime")) compile(project(":core:util.runtime"))
compile(project(":compiler:backend")) compile(project(":compiler:backend"))
@@ -14,7 +9,6 @@ dependencies {
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
compile(project(":compiler:light-classes")) compile(project(":compiler:light-classes"))
compileOnly(ideaSdkDeps("openapi", "idea")) compileOnly(ideaSdkDeps("openapi", "idea"))
buildVersion()
testCompile(project(":kotlin-test:kotlin-test-jvm")) testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(project(":compiler.tests-common")) testCompile(project(":compiler.tests-common"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
@@ -25,15 +19,13 @@ dependencies {
testRuntime(ideaSdkDeps("*.jar")) testRuntime(ideaSdkDeps("*.jar"))
} }
configureKotlinProjectSourcesDefault() sourceSets {
configureKotlinProjectTestsDefault() "main" { projectDefault() }
"test" { projectDefault() }
}
testsJar {} testsJar {}
projectTest {
tasks.withType<Test> {
workingDir = rootDir workingDir = rootDir
systemProperty("idea.is.unit.test", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
ignoreFailures = true
} }
+4 -2
View File
@@ -21,8 +21,10 @@ tasks.withType<Jar> {
} }
} }
configureKotlinProjectSources() // no sources sourceSets {
configureKotlinProjectNoTests() "main" {}
"test" {}
}
val jar: Jar by tasks val jar: Jar by tasks
@@ -43,19 +43,18 @@ dependencies {
testScriptRuntimeJar(project(":kotlin-script-runtime", configuration = "mainJar")) testScriptRuntimeJar(project(":kotlin-script-runtime", configuration = "mainJar"))
} }
configureKotlinProjectSources() // no sources sourceSets {
configureKotlinProjectTests("libraries/tools/kotlin-compiler-client-embeddable-test/src", sourcesBaseDir = rootDir) "main" {}
"test" {
// TODO: move closer
java.srcDir("../../libraries/tools/kotlin-compiler-client-embeddable-test/src")
}
}
tasks.withType<Test> { projectTest {
dependsOnTaskIfExistsRec("dist", project = rootProject) dependsOnTaskIfExistsRec("dist", project = rootProject)
workingDir = File(rootDir, "libraries/tools/kotlin-compiler-client-embeddable-test/src") workingDir = File(rootDir, "libraries/tools/kotlin-compiler-client-embeddable-test/src")
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)) 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
systemProperty("idea.is.unit.test", "true")
systemProperty("compilerJar", testRuntimeCompilerJar.singleFile.canonicalPath) systemProperty("compilerJar", testRuntimeCompilerJar.singleFile.canonicalPath)
systemProperty("stdlibJar", testStdlibJar.singleFile.canonicalPath) systemProperty("stdlibJar", testStdlibJar.singleFile.canonicalPath)
systemProperty("scriptRuntimeJar", testScriptRuntimeJar.singleFile.canonicalPath) systemProperty("scriptRuntimeJar", testScriptRuntimeJar.singleFile.canonicalPath)
@@ -76,73 +75,3 @@ sourcesJar()
javadocJar() javadocJar()
publish() publish()
// TODO: remove after finalizing publishing (now due to the problems with sam-with-receiver, the code is not fully navigable in the buildSrc)
//tasks {
// "uploadArchives"(Upload::class) {
//
// val preparePublication by rootProject.tasks
// dependsOn(preparePublication)
//
// val username: String? by preparePublication.extra
// val password: String? by preparePublication.extra
//
// repositories {
// withConvention(MavenRepositoryHandlerConvention::class) {
//
// mavenDeployer {
// withGroovyBuilder {
// "repository"("url" to uri(preparePublication.extra["repoUrl"]))
//
// if (username != null && password != null) {
// "authentication"("userName" to username, "password" to password)
// }
// }
//
// pom.project {
// withGroovyBuilder {
// "licenses" {
// "license" {
// "name"("The Apache Software License, Version 2.0")
// "url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
// "distribution"("repo")
// }
// }
// "name"("${project.group}:${project.name}")
// "packaging"("jar")
// // optionally artifactId can be defined here
// "description"(project.description)
// "url"("https://kotlinlang.org/")
// "licenses" {
// "license" {
// "name"("The Apache License, Version 2.0")
// "url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
// }
// }
// "scm" {
// "url"("https://github.com/JetBrains/kotlin")
// "connection"("scm:git:https://github.com/JetBrains/kotlin.git")
// "developerConnection"("scm:git:https://github.com/JetBrains/kotlin.git")
// }
// "developers" {
// "developer" {
// "name"("Kotlin Team")
// "organization"("JetBrains")
// "organizationUrl"("https://www.jetbrains.com")
// }
// }
// }
// }
// pom.whenConfigured {
// dependencies.clear()
//// dependencies.removeIf {
//// withGroovyBuilder {
//// "scope"(*emptyArray()) == "test"
//// }
//// }
// }
// }
// }
// }
// }
//}
+4 -2
View File
@@ -15,6 +15,8 @@ tasks.withType<Jar> {
from(fileTree("$rootDir/idea/formatter")) { include("src/**") } // Eclipse formatter sources navigation depends on this from(fileTree("$rootDir/idea/formatter")) { include("src/**") } // Eclipse formatter sources navigation depends on this
} }
configureKotlinProjectSources() // no sources sourceSets {
configureKotlinProjectNoTests() "main" {}
"test" {}
}
+4 -2
View File
@@ -15,6 +15,8 @@ tasks.withType<Jar> {
from(fileTree("$rootDir/idea/ide-common")) { include("src/**") } // Eclipse formatter sources navigation depends on this from(fileTree("$rootDir/idea/ide-common")) { include("src/**") } // Eclipse formatter sources navigation depends on this
} }
configureKotlinProjectSources() // no sources sourceSets {
configureKotlinProjectNoTests() "main" {}
"test" {}
}
+14 -14
View File
@@ -18,22 +18,22 @@ jar.apply {
archiveName = "kotlin-mock-runtime-for-test.jar" archiveName = "kotlin-mock-runtime-for-test.jar"
} }
configure<JavaPluginConvention> { sourceSets {
sourceSets["main"].apply { "main" {
(this as HasConvention).convention.getPlugin<KotlinSourceSet>().kotlin.apply { java.apply {
srcDir(File(rootDir, "core", "runtime.jvm", "src")) srcDir(File(rootDir, "core", "runtime.jvm", "src"))
.include("kotlin/TypeAliases.kt", .include("kotlin/TypeAliases.kt",
"kotlin/text/TypeAliases.kt") "kotlin/text/TypeAliases.kt")
srcDir(File(rootDir, "libraries", "stdlib", "src")) srcDir(File(rootDir, "libraries", "stdlib", "src"))
.include("kotlin/collections/TypeAliases.kt", .include("kotlin/collections/TypeAliases.kt",
"kotlin/jvm/JvmVersion.kt", "kotlin/jvm/JvmVersion.kt",
"kotlin/util/Standard.kt", "kotlin/util/Standard.kt",
"kotlin/internal/Annotations.kt") "kotlin/internal/Annotations.kt")
} }
} }
"test" {}
} }
configureKotlinProjectNoTests()
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
sourceCompatibility = "1.6" sourceCompatibility = "1.6"