mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
serverless dev build for local usage
GitOrigin-RevId: f94f660db15bce64cb3fee17e748d40e6815267d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
867095cf3b
commit
6c812d4f25
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -767,6 +767,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/analysis-impl/intellij.platform.analysis.impl.iml" filepath="$PROJECT_DIR$/platform/analysis-impl/intellij.platform.analysis.impl.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/boot/intellij.platform.boot.iml" filepath="$PROJECT_DIR$/platform/boot/intellij.platform.boot.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/bootstrap/intellij.platform.bootstrap.iml" filepath="$PROJECT_DIR$/platform/bootstrap/intellij.platform.bootstrap.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/bootstrap/dev/intellij.platform.bootstrap.dev.iml" filepath="$PROJECT_DIR$/platform/bootstrap/dev/intellij.platform.bootstrap.dev.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/build-scripts/intellij.platform.buildScripts.iml" filepath="$PROJECT_DIR$/platform/build-scripts/intellij.platform.buildScripts.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/build-scripts/downloader/intellij.platform.buildScripts.downloader.iml" filepath="$PROJECT_DIR$/platform/build-scripts/downloader/intellij.platform.buildScripts.downloader.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/build-scripts/testFramework/intellij.platform.buildScripts.testFramework.iml" filepath="$PROJECT_DIR$/platform/build-scripts/testFramework/intellij.platform.buildScripts.testFramework.iml" />
|
||||
|
||||
16
platform/bootstrap/dev/intellij.platform.bootstrap.dev.iml
Normal file
16
platform/bootstrap/dev/intellij.platform.bootstrap.dev.iml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.bootstrap" />
|
||||
<orderEntry type="module" module-name="intellij.platform.devBuildServer" />
|
||||
<orderEntry type="library" name="kotlinx-coroutines-jdk8" level="project" />
|
||||
<orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.intellij.build.devServer
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.nio.file.Path
|
||||
|
||||
fun main(rawArgs: Array<String>) {
|
||||
runBlocking(Dispatchers.Default) {
|
||||
buildProductInProcess(BuildRequest(
|
||||
platformPrefix = System.getProperty("idea.platform.prefix") ?: "idea",
|
||||
additionalModules = emptyList(),
|
||||
homePath = Path.of(PathManager.getHomePath()),
|
||||
))
|
||||
}
|
||||
|
||||
System.setProperty("idea.vendor.name", "JetBrains")
|
||||
System.setProperty("idea.use.dev.build.server", "true")
|
||||
com.intellij.idea.main(rawArgs)
|
||||
}
|
||||
@@ -125,8 +125,8 @@ internal suspend fun buildProduct(productConfiguration: ProductConfiguration, re
|
||||
withContext(Dispatchers.IO) {
|
||||
Files.createDirectories(pluginRootDir)
|
||||
}
|
||||
spanBuilder("build plugins").setAttribute(AttributeKey.longKey("count"), pluginBuildDescriptors.size.toLong()).useWithScope2 {
|
||||
initialBuild(pluginBuildDescriptors = pluginBuildDescriptors, pluginBuilder = pluginBuilder)
|
||||
launch {
|
||||
buildPlugins(pluginBuildDescriptors = pluginBuildDescriptors, pluginBuilder = pluginBuilder)
|
||||
}
|
||||
launch {
|
||||
computeLibClassPath(targetFile = runDir.resolve(if (isServerMode) "libClassPath.txt" else "core-classpath.txt"),
|
||||
@@ -232,6 +232,10 @@ private fun checkBuildModulesModificationAndMark(productConfiguration: ProductCo
|
||||
|
||||
createMarkFile(markFile)
|
||||
}
|
||||
|
||||
if (isApplicable) {
|
||||
Span.current().addEvent("plugin cache will be reused (build modules were not changed)")
|
||||
}
|
||||
return isApplicable
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:Suppress("BlockingMethodInNonBlockingContext")
|
||||
@file:Suppress("BlockingMethodInNonBlockingContext", "PrivatePropertyName")
|
||||
|
||||
package org.jetbrains.intellij.build.devServer
|
||||
|
||||
import com.intellij.diagnostic.telemetry.useWithScope2
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.jetbrains.intellij.build.BuildContext
|
||||
import org.jetbrains.intellij.build.TraceManager.spanBuilder
|
||||
import org.jetbrains.intellij.build.impl.ModuleOutputPatcher
|
||||
@@ -17,6 +21,7 @@ import java.nio.file.NoSuchFileException
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.StandardOpenOption
|
||||
import java.util.*
|
||||
import java.util.concurrent.atomic.LongAdder
|
||||
|
||||
private val TOUCH_OPTIONS = EnumSet.of(StandardOpenOption.CREATE, StandardOpenOption.WRITE)
|
||||
|
||||
@@ -40,11 +45,19 @@ internal data class PluginBuildDescriptor(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun CoroutineScope.initialBuild(pluginBuildDescriptors: List<PluginBuildDescriptor>, pluginBuilder: PluginBuilder) {
|
||||
for (plugin in pluginBuildDescriptors) {
|
||||
launch {
|
||||
pluginBuilder.buildPlugin(plugin = plugin)
|
||||
internal suspend fun buildPlugins(pluginBuildDescriptors: List<PluginBuildDescriptor>, pluginBuilder: PluginBuilder) {
|
||||
spanBuilder("build plugins").setAttribute(AttributeKey.longKey("count"), pluginBuildDescriptors.size.toLong()).useWithScope2 { span ->
|
||||
val counter = LongAdder()
|
||||
coroutineScope {
|
||||
for (plugin in pluginBuildDescriptors) {
|
||||
launch {
|
||||
if (pluginBuilder.buildPlugin(plugin = plugin)) {
|
||||
counter.add(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
span.setAttribute("reusedCount", counter.toLong())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,10 +112,10 @@ internal class PluginBuilder(private val outDir: Path,
|
||||
return "Plugins ${dirtyPlugins.joinToString { it.dir.fileName.toString() }} were updated"
|
||||
}
|
||||
|
||||
internal suspend fun buildPlugin(plugin: PluginBuildDescriptor) {
|
||||
internal suspend fun buildPlugin(plugin: PluginBuildDescriptor): Boolean {
|
||||
val mainModule = plugin.layout.mainModule
|
||||
val moduleOutputPatcher = ModuleOutputPatcher()
|
||||
spanBuilder("build plugin")
|
||||
return spanBuilder("build plugin")
|
||||
.setAttribute("mainModule", mainModule)
|
||||
.setAttribute("dir", plugin.layout.directoryName)
|
||||
.useWithScope2 { span ->
|
||||
@@ -122,19 +135,19 @@ internal class PluginBuilder(private val outDir: Path,
|
||||
}
|
||||
|
||||
if (isCached) {
|
||||
return@useWithScope2
|
||||
return@useWithScope2 true
|
||||
}
|
||||
|
||||
layoutDistribution(layout = plugin.layout,
|
||||
targetDirectory = plugin.dir,
|
||||
copyFiles = true,
|
||||
simplify = true,
|
||||
moduleOutputPatcher = moduleOutputPatcher,
|
||||
jarToModule = plugin.layout.jarToModules,
|
||||
context = context)
|
||||
withContext(Dispatchers.IO) {
|
||||
plugin.markAsBuilt(outDir)
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +164,7 @@ internal class PluginBuilder(private val outDir: Path,
|
||||
else {
|
||||
Files.move(cacheDir!!, plugin.dir)
|
||||
}
|
||||
span.addEvent("reuse $dirName from cache")
|
||||
span.setAttribute("reused", true)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -901,8 +901,8 @@ private suspend fun buildKeymapPlugins(targetDir: Path, context: BuildContext):
|
||||
|
||||
suspend fun layoutDistribution(layout: BaseLayout,
|
||||
targetDirectory: Path,
|
||||
copyFiles: Boolean,
|
||||
simplify: Boolean,
|
||||
copyFiles: Boolean = true,
|
||||
simplify: Boolean = false,
|
||||
moduleOutputPatcher: ModuleOutputPatcher,
|
||||
jarToModule: Map<String, List<String>>,
|
||||
context: BuildContext): Pair<List<DistributionFileEntry>, Path> {
|
||||
@@ -1078,7 +1078,7 @@ private fun addArtifactMapping(artifact: JpsArtifact, entries: MutableCollection
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkModuleExcludes(moduleExcludes: Map<String, List<String>>, context: BuildContext) {
|
||||
private fun checkModuleExcludes(moduleExcludes: Map<String, List<String>>, context: CompilationContext) {
|
||||
for ((module, value) in moduleExcludes) {
|
||||
for (pattern in value) {
|
||||
check(Files.exists(context.getModuleOutputDir(context.findRequiredModule(module)))) {
|
||||
|
||||
Reference in New Issue
Block a user