Build: Minor cleanup & format root build.gradle.kts

This commit is contained in:
Vyacheslav Gerasimov
2019-05-20 14:45:40 +03:00
parent 40e9f48bd0
commit c2a2d80d4c
2 changed files with 156 additions and 134 deletions
+2
View File
@@ -4,9 +4,11 @@
<w>cidr</w> <w>cidr</w>
<w>foldable</w> <w>foldable</w>
<w>instrumentator</w> <w>instrumentator</w>
<w>jdks</w>
<w>protobuf</w> <w>protobuf</w>
<w>redirector</w> <w>redirector</w>
<w>remapper</w> <w>remapper</w>
<w>unpresent</w>
</words> </words>
</dictionary> </dictionary>
</component> </component>
+47 -27
View File
@@ -1,4 +1,3 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.plugins.ide.idea.model.IdeaModel import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
@@ -65,8 +64,8 @@ buildScan {
val configuredJdks: List<JdkId> = val configuredJdks: List<JdkId> =
getConfiguredJdks().also { getConfiguredJdks().also {
it.forEach { it.forEach { jdkId ->
logger.info("Using ${it.majorVersion} home: ${it.homeDir}") logger.info("Using ${jdkId.majorVersion} home: ${jdkId.homeDir}")
} }
} }
@@ -136,10 +135,20 @@ fun checkJDK() {
if (jdkChecked) { if (jdkChecked) {
return return
} }
var unpresentJdks = JdkMajorVersion.values().filter { it.isMandatory() }.map { it -> it.name }.filter { it == null || extra[it] == jdkNotFoundConst }.toList()
if (!unpresentJdks.isEmpty()) { val unpresentJdks = JdkMajorVersion.values()
throw GradleException("Please set environment variable${if (unpresentJdks.size > 1) "s" else ""}: ${unpresentJdks.joinToString()} to point to corresponding JDK installation.") .filter { it.isMandatory() }
.map { it.name }
.filter { extra[it] == jdkNotFoundConst }
.toList()
if (unpresentJdks.isNotEmpty()) {
throw GradleException("Please set environment variable" +
(if (unpresentJdks.size > 1) "s" else "") +
": " + unpresentJdks.joinToString() +
" to point to corresponding JDK installation.")
} }
jdkChecked = true jdkChecked = true
} }
@@ -191,7 +200,8 @@ extra["intellijUltimateEnabled"] = intellijUltimateEnabled
extra["intellijSeparateSdks"] = intellijSeparateSdks extra["intellijSeparateSdks"] = intellijSeparateSdks
extra["IntellijCoreDependencies"] = extra["IntellijCoreDependencies"] =
listOf(if (Platform[191].orHigher()) "asm-all-7.0.1" else "asm-all", listOf(
if (Platform[191].orHigher()) "asm-all-7.0.1" else "asm-all",
"guava", "guava",
"jdom", "jdom",
"jna", "jna",
@@ -199,7 +209,8 @@ extra["IntellijCoreDependencies"] =
"picocontainer", "picocontainer",
"snappy-in-java", "snappy-in-java",
"streamex", "streamex",
"trove4j") "trove4j"
)
extra["compilerModules"] = arrayOf( extra["compilerModules"] = arrayOf(
@@ -308,16 +319,11 @@ allprojects {
configurations.maybeCreate("embedded") configurations.maybeCreate("embedded")
jvmTarget = defaultJvmTarget jvmTarget = defaultJvmTarget
if (defaultJavaHome != null) {
javaHome = defaultJavaHome javaHome = defaultJavaHome
} else {
logger.error("Could not find default java home. Please set environment variable JDK_${defaultJavaHome} to point to JDK ${defaultJavaHome} installation.")
}
// There are problems with common build dir: // There are problems with common build dir:
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location // - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
// - idea seems unable to exclude common builddir from indexing // - idea seems unable to exclude common buildDir from indexing
// therefore it is disabled by default // therefore it is disabled by default
// buildDir = File(commonBuildDir, project.name) // buildDir = File(commonBuildDir, project.name)
@@ -387,7 +393,11 @@ allprojects {
fun FileCollection.printClassPath(role: String) = fun FileCollection.printClassPath(role: String) =
println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() }}") println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() }}")
try { javaPluginConvention() } catch (_: UnknownDomainObjectException) { null }?.let { javaConvention -> try {
javaPluginConvention()
} catch (_: UnknownDomainObjectException) {
null
}?.let { javaConvention ->
task("printCompileClasspath") { doFirst { javaConvention.sourceSets["main"].compileClasspath.printClassPath("compile") } } task("printCompileClasspath") { doFirst { javaConvention.sourceSets["main"].compileClasspath.printClassPath("compile") } }
task("printRuntimeClasspath") { doFirst { javaConvention.sourceSets["main"].runtimeClasspath.printClassPath("runtime") } } task("printRuntimeClasspath") { doFirst { javaConvention.sourceSets["main"].runtimeClasspath.printClassPath("runtime") } }
task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } } task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } }
@@ -476,13 +486,13 @@ tasks {
":kotlinx-metadata-jvm", ":kotlinx-metadata-jvm",
":tools:binary-compatibility-validator" ":tools:binary-compatibility-validator"
)).forEach { )).forEach {
dependsOn(it + ":check") dependsOn("$it:check")
} }
} }
create("gradlePluginTest") { create("gradlePluginTest") {
gradlePluginProjects.forEach { gradlePluginProjects.forEach {
dependsOn(it + ":check") dependsOn("$it:check")
} }
} }
@@ -492,10 +502,12 @@ tasks {
create("jvmCompilerTest") { create("jvmCompilerTest") {
dependsOn("dist") dependsOn("dist")
dependsOn(":compiler:test", dependsOn(
":compiler:test",
":compiler:container:test", ":compiler:container:test",
":compiler:tests-java8:test", ":compiler:tests-java8:test",
":compiler:tests-spec:remoteRunTests") ":compiler:tests-spec:remoteRunTests"
)
dependsOn(":plugins:jvm-abi-gen:test") dependsOn(":plugins:jvm-abi-gen:test")
} }
@@ -566,36 +578,44 @@ tasks {
create("idea-plugin-additional-tests") { create("idea-plugin-additional-tests") {
dependsOn("dist") dependsOn("dist")
dependsOn(":idea:idea-gradle:test", dependsOn(
":idea:idea-gradle:test",
":idea:idea-gradle-native:test", ":idea:idea-gradle-native:test",
":idea:idea-maven:test", ":idea:idea-maven:test",
":j2k:test", ":j2k:test",
":idea:eval4j:test") ":idea:eval4j:test"
)
} }
create("idea-plugin-tests") { create("idea-plugin-tests") {
dependsOn("dist") dependsOn("dist")
dependsOn("idea-plugin-main-tests", dependsOn(
"idea-plugin-additional-tests") "idea-plugin-main-tests",
"idea-plugin-additional-tests"
)
} }
create("android-ide-tests") { create("android-ide-tests") {
dependsOn("dist") dependsOn("dist")
dependsOn(":plugins:android-extensions-ide:test", dependsOn(
":plugins:android-extensions-ide:test",
":idea:idea-android:test", ":idea:idea-android:test",
":kotlin-annotation-processing:test") ":kotlin-annotation-processing:test"
)
} }
create("plugins-tests") { create("plugins-tests") {
dependsOn("dist") dependsOn("dist")
dependsOn(":kotlin-annotation-processing:test", dependsOn(
":kotlin-annotation-processing:test",
":kotlin-source-sections-compiler-plugin:test", ":kotlin-source-sections-compiler-plugin:test",
":kotlin-allopen-compiler-plugin:test", ":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test", ":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test", ":kotlin-sam-with-receiver-compiler-plugin:test",
":plugins:uast-kotlin:test", ":plugins:uast-kotlin:test",
":kotlin-annotation-processing-gradle:test", ":kotlin-annotation-processing-gradle:test",
":kotlinx-serialization-ide-plugin:test") ":kotlinx-serialization-ide-plugin:test"
)
} }