mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
build scripts: excessive dependencies resolution calls
GitOrigin-RevId: 8931d6cfb4f551ba24e5f750a749400b8d4dce63
This commit is contained in:
committed by
intellij-monorepo-bot
parent
51aecab66b
commit
a4adc6110f
@@ -75,6 +75,9 @@ interface CompilationTasks {
|
||||
*/
|
||||
fun compileModules(moduleNames: Collection<String>?, includingTestsInModules: List<String>? = emptyList())
|
||||
|
||||
/**
|
||||
* [compileModules] is called if required
|
||||
*/
|
||||
fun buildProjectArtifacts(artifactNames: Set<String>)
|
||||
|
||||
fun resolveProjectDependencies()
|
||||
|
||||
@@ -573,10 +573,6 @@ private fun compilePlatformAndPluginModules(pluginsToPublish: Set<PluginLayout>,
|
||||
compilationTasks.compileModules(
|
||||
distState.getModulesForPluginsToPublish() +
|
||||
listOf("intellij.idea.community.build.tasks", "intellij.platform.images.build", "intellij.tools.launcherGenerator"))
|
||||
|
||||
// we need this to ensure that all libraries which may be used in the distribution are resolved,
|
||||
// even if product modules don't depend on them (e.g. JUnit5)
|
||||
compilationTasks.resolveProjectDependencies()
|
||||
compilationTasks.buildProjectArtifacts(distState.getIncludedProjectArtifacts())
|
||||
return distState
|
||||
}
|
||||
|
||||
+9
-12
@@ -8,24 +8,21 @@ import org.jetbrains.intellij.build.impl.compilation.CompiledClasses
|
||||
|
||||
class CompilationTasksImpl(private val context: CompilationContext) : CompilationTasks {
|
||||
override fun compileModules(moduleNames: Collection<String>?, includingTestsInModules: List<String>?) {
|
||||
resolveProjectDependencies()
|
||||
context.messages.block("Compiling modules") {
|
||||
resolveProjectDependencies()
|
||||
CompiledClasses.reuseOrCompile(context, moduleNames, includingTestsInModules)
|
||||
}
|
||||
}
|
||||
|
||||
override fun buildProjectArtifacts(artifactNames: Set<String>) {
|
||||
if (artifactNames.isEmpty()) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
resolveProjectDependencies()
|
||||
CompiledClasses.reuseOrCompile(context)
|
||||
val buildIncludedModules = !context.options.useCompiledClassesFromProjectOutput
|
||||
JpsCompilationRunner(context).buildArtifacts(artifactNames, buildIncludedModules)
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
context.messages.error("Building project artifacts failed with exception: $e", e)
|
||||
if (artifactNames.isNotEmpty()) {
|
||||
val jps = JpsCompilationRunner(context)
|
||||
if (!context.options.useCompiledClassesFromProjectOutput) {
|
||||
compileModules(jps.getModulesIncludedInArtifacts(artifactNames))
|
||||
}
|
||||
context.messages.block("Building project artifacts $artifactNames") {
|
||||
jps.buildArtifacts(artifactNames, buildIncludedModules = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -159,6 +159,9 @@ internal class JpsCompilationRunner(private val context: CompilationContext) {
|
||||
resolveProjectDependencies = false)
|
||||
}
|
||||
|
||||
fun getModulesIncludedInArtifacts(artifactNames: Collection<String>): Collection<String> =
|
||||
getModulesIncludedInArtifacts(getArtifactsWithIncluded(artifactNames))
|
||||
|
||||
private fun getModulesIncludedInArtifacts(artifacts: Collection<JpsArtifact>): Set<String> {
|
||||
val modulesSet: MutableSet<String> = LinkedHashSet()
|
||||
for (artifact in artifacts) {
|
||||
@@ -172,7 +175,7 @@ internal class JpsCompilationRunner(private val context: CompilationContext) {
|
||||
return modulesSet
|
||||
}
|
||||
|
||||
private fun getArtifactsWithIncluded(artifactNames: Set<String>): Set<JpsArtifact> {
|
||||
private fun getArtifactsWithIncluded(artifactNames: Collection<String>): Set<JpsArtifact> {
|
||||
val artifacts = JpsArtifactService.getInstance().getArtifacts(context.project).filter { it.name in artifactNames }
|
||||
return ArtifactSorter.addIncludedArtifacts(artifacts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user