Build: Collect sources for compiler lazily to avoid evaluationDependsOn

This commit is contained in:
Vyacheslav Gerasimov
2019-04-23 23:05:08 +03:00
parent 8851029baa
commit c218385ba8
3 changed files with 20 additions and 58 deletions
+6 -16
View File
@@ -1,8 +1,5 @@
import java.io.File
import proguard.gradle.ProGuardTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.artifacts.maven.Conf2ScopeMappingContainer.COMPILE import proguard.gradle.ProGuardTask
import org.gradle.api.file.DuplicatesStrategy
description = "Kotlin Compiler" description = "Kotlin Compiler"
@@ -21,7 +18,6 @@ val fatJarContents by configurations.creating
val fatJarContentsStripMetadata by configurations.creating val fatJarContentsStripMetadata by configurations.creating
val fatJarContentsStripServices by configurations.creating val fatJarContentsStripServices by configurations.creating
val fatSourcesJarContents by configurations.creating
val fatJar by configurations.creating val fatJar by configurations.creating
val compilerJar by configurations.creating val compilerJar by configurations.creating
val runtimeJar by configurations.creating val runtimeJar by configurations.creating
@@ -40,12 +36,6 @@ val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
val compilerModules: Array<String> by rootProject.extra val compilerModules: Array<String> by rootProject.extra
compilerModules.forEach { evaluationDependsOn(it) }
val compiledModulesSources = compilerModules.map {
project(it).mainSourceSet.allSource
}
dependencies { dependencies {
compile(kotlinStdlib()) compile(kotlinStdlib())
compile(project(":kotlin-script-runtime")) compile(project(":kotlin-script-runtime"))
@@ -65,10 +55,6 @@ dependencies {
fatJarContents(project(it)) { isTransitive = false } fatJarContents(project(it)) { isTransitive = false }
} }
compiledModulesSources.forEach {
fatSourcesJarContents(it)
}
trove4jJar(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } } trove4jJar(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } }
fatJarContents(kotlinBuiltins()) fatJarContents(kotlinBuiltins())
@@ -154,7 +140,11 @@ runtimeJarArtifactBy(pack, pack.outputs.files.singleFile) {
} }
sourcesJar { sourcesJar {
from(fatSourcesJarContents) from {
compilerModules.map {
project(it).mainSourceSet.allSource
}
}
} }
javadocJar() javadocJar()
+8 -26
View File
@@ -1,8 +1,5 @@
import java.io.File
import proguard.gradle.ProGuardTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.artifacts.maven.Conf2ScopeMappingContainer.COMPILE import proguard.gradle.ProGuardTask
import org.gradle.api.file.DuplicatesStrategy
description = "Kotlin Compiler" description = "Kotlin Compiler"
@@ -21,7 +18,6 @@ val fatJarContents by configurations.creating
val fatJarContentsStripMetadata by configurations.creating val fatJarContentsStripMetadata by configurations.creating
val fatJarContentsStripServices by configurations.creating val fatJarContentsStripServices by configurations.creating
val fatSourcesJarContents by configurations.creating
val fatJar by configurations.creating val fatJar by configurations.creating
val compilerJar by configurations.creating val compilerJar by configurations.creating
val runtimeJar by configurations.creating val runtimeJar by configurations.creating
@@ -40,12 +36,6 @@ val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
val compilerModules: Array<String> by rootProject.extra val compilerModules: Array<String> by rootProject.extra
compilerModules.forEach { evaluationDependsOn(it) }
val compiledModulesSources = compilerModules.map {
project(it).mainSourceSet.allSource
}
dependencies { dependencies {
compile(kotlinStdlib()) compile(kotlinStdlib())
compile(project(":kotlin-script-runtime")) compile(project(":kotlin-script-runtime"))
@@ -65,10 +55,6 @@ dependencies {
fatJarContents(project(it)) { isTransitive = false } fatJarContents(project(it)) { isTransitive = false }
} }
compiledModulesSources.forEach {
fatSourcesJarContents(it)
}
trove4jJar(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } } trove4jJar(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } }
fatJarContents(kotlinBuiltins()) fatJarContents(kotlinBuiltins())
@@ -86,17 +72,9 @@ dependencies {
!(it.startsWith("jdom") || it.startsWith("log4j") || it.startsWith("trove4j")) !(it.startsWith("jdom") || it.startsWith("log4j") || it.startsWith("trove4j"))
} }
} }
when { fatJarContents(intellijDep()) { includeJars("jna-platform", "lz4-1.3.0") }
Platform[181].orLower() -> {
fatJarContents(intellijDep()) { includeJars("jna-platform", "lz4-java-1.3") }
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro-2.0.8", "jdom", "log4j") }
}
else -> {
fatJarContents(intellijDep()) { includeJars("jna-platform", "lz4-1.3.0") }
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro-2.0.8", "jdom", "log4j") }
}
}
fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") } fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") }
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro-2.0.8", "jdom", "log4j" ) }
} }
publish() publish()
@@ -162,7 +140,11 @@ runtimeJarArtifactBy(pack, pack.outputs.files.singleFile) {
} }
sourcesJar { sourcesJar {
from(fatSourcesJarContents) from {
compilerModules.map {
project(it).mainSourceSet.allSource
}
}
} }
javadocJar() javadocJar()
+6 -16
View File
@@ -1,8 +1,5 @@
import java.io.File
import proguard.gradle.ProGuardTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.artifacts.maven.Conf2ScopeMappingContainer.COMPILE import proguard.gradle.ProGuardTask
import org.gradle.api.file.DuplicatesStrategy
description = "Kotlin Compiler" description = "Kotlin Compiler"
@@ -21,7 +18,6 @@ val fatJarContents by configurations.creating
val fatJarContentsStripMetadata by configurations.creating val fatJarContentsStripMetadata by configurations.creating
val fatJarContentsStripServices by configurations.creating val fatJarContentsStripServices by configurations.creating
val fatSourcesJarContents by configurations.creating
val fatJar by configurations.creating val fatJar by configurations.creating
val compilerJar by configurations.creating val compilerJar by configurations.creating
val runtimeJar by configurations.creating val runtimeJar by configurations.creating
@@ -40,12 +36,6 @@ val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
val compilerModules: Array<String> by rootProject.extra val compilerModules: Array<String> by rootProject.extra
compilerModules.forEach { evaluationDependsOn(it) }
val compiledModulesSources = compilerModules.map {
project(it).mainSourceSet.allSource
}
dependencies { dependencies {
compile(kotlinStdlib()) compile(kotlinStdlib())
compile(project(":kotlin-script-runtime")) compile(project(":kotlin-script-runtime"))
@@ -65,10 +55,6 @@ dependencies {
fatJarContents(project(it)) { isTransitive = false } fatJarContents(project(it)) { isTransitive = false }
} }
compiledModulesSources.forEach {
fatSourcesJarContents(it)
}
trove4jJar(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } } trove4jJar(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } }
fatJarContents(kotlinBuiltins()) fatJarContents(kotlinBuiltins())
@@ -154,7 +140,11 @@ runtimeJarArtifactBy(pack, pack.outputs.files.singleFile) {
} }
sourcesJar { sourcesJar {
from(fatSourcesJarContents) from {
compilerModules.map {
project(it).mainSourceSet.allSource
}
}
} }
javadocJar() javadocJar()