From bed57bbd7c9bdd4d68ec44e3e51d741e3fd5df66 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 26 Mar 2024 08:55:31 +0100 Subject: [PATCH] IJPL-866 load maven libs in parallel GitOrigin-RevId: c825967f1444a6756f7f6302dd057e82af5693b7 --- .../build/impl/DistributionJARsBuilder.kt | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt index 0ecadc280071..af3e66fce3ca 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.kt @@ -1358,20 +1358,26 @@ suspend fun createIdeClassPath(platform: PlatformLayout, context: BuildContext): return classPath } -suspend fun buildSearchableOptions(platform: PlatformLayout, - context: BuildContext, - systemProperties: Map = emptyMap()): Path? { - return buildSearchableOptions(ideClassPath = createIdeClassPath(platform, context), - context = context, - systemProperties = systemProperties) +suspend fun buildSearchableOptions( + platform: PlatformLayout, + context: BuildContext, + systemProperties: Map = emptyMap(), +): Path? { + return buildSearchableOptions( + ideClassPath = createIdeClassPath(platform, context), + context = context, + systemProperties = systemProperties, + ) } /** * Build index which is used to search options in the Settings dialog. */ -suspend fun buildSearchableOptions(ideClassPath: Set, - context: BuildContext, - systemProperties: Map = emptyMap()): Path? { +suspend fun buildSearchableOptions( + ideClassPath: Set, + context: BuildContext, + systemProperties: Map = emptyMap(), +): Path? { val span = Span.current() if (context.isStepSkipped(BuildOptions.SEARCHABLE_OPTIONS_INDEX_STEP)) { span.addEvent("skip building searchable options index") @@ -1384,18 +1390,30 @@ suspend fun buildSearchableOptions(ideClassPath: Set, // bundled maven is also downloaded during traverseUI execution in an external process, // making it fragile to call more than one traverseUI at the same time (in the reproducibility test, for example), // so it's pre-downloaded with proper synchronization - BundledMavenDownloader.downloadMaven4Libs(context.paths.communityHomeDirRoot) - BundledMavenDownloader.downloadMaven3Libs(context.paths.communityHomeDirRoot) - BundledMavenDownloader.downloadMavenDistribution(context.paths.communityHomeDirRoot) - BundledMavenDownloader.downloadMavenTelemetryDependencies(context.paths.communityHomeDirRoot) + coroutineScope { + launch { + BundledMavenDownloader.downloadMaven4Libs(context.paths.communityHomeDirRoot) + } + launch { + BundledMavenDownloader.downloadMaven3Libs(context.paths.communityHomeDirRoot) + } + launch { + BundledMavenDownloader.downloadMavenDistribution(context.paths.communityHomeDirRoot) + } + launch { + BundledMavenDownloader.downloadMavenTelemetryDependencies(context.paths.communityHomeDirRoot) + } + } // Start the product in headless mode using com.intellij.ide.ui.search.TraverseUIStarter. // It'll process all UI elements in the `Settings` dialog and build an index for them. - runApplicationStarter(context = context, - tempDir = context.paths.tempDir.resolve("searchableOptions"), - ideClasspath = ideClassPath, - arguments = listOf("traverseUI", targetDirectory.toString(), "true"), - vmOptions = listOf("-Xmx2g"), - systemProperties = systemProperties) + runApplicationStarter( + context = context, + tempDir = context.paths.tempDir.resolve("searchableOptions"), + ideClasspath = ideClassPath, + arguments = listOf("traverseUI", targetDirectory.toString(), "true"), + vmOptions = listOf("-Xmx2g"), + systemProperties = systemProperties, + ) check(Files.isDirectory(targetDirectory)) { "Failed to build searchable options index: $targetDirectory does not exist. See log above for error output from traverseUI run." }