IJPL-223808 IJ-MR-181153 cleanup

GitOrigin-RevId: 2f09f15b9464864202b44ddf11a3aef897c74178
This commit is contained in:
Vladimir Krivosheev
2025-12-15 19:57:35 +00:00
committed by intellij-monorepo-bot
parent 440d28788f
commit 12d9dfa841
4 changed files with 67 additions and 42 deletions
@@ -15,9 +15,9 @@ import java.nio.file.Path
import kotlin.io.path.invariantSeparatorsPathString
data class BuildDevInfo(
val mainClassName: String,
val classPath: Collection<Path>,
val systemProperties: Map<String, String>,
@JvmField val mainClassName: String,
@JvmField val classPath: Collection<Path>,
@JvmField val systemProperties: Map<String, String>,
)
/**
@@ -1,5 +1,5 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplacePutWithAssignment")
@file:Suppress("ReplacePutWithAssignment", "ReplaceGetOrSet")
package org.jetbrains.intellij.build.dev
@@ -25,7 +25,6 @@ import java.util.Properties
import kotlin.io.path.inputStream
import kotlin.io.path.readLines
/**
* Custom path for product properties
*/
@@ -50,7 +49,7 @@ fun getIdeSystemProperties(runDir: Path): VmProperties {
vmOptions.asSequence()
.filter { it.startsWith("-D") }
.map { it.removePrefix("-D") }
.associateByTo(result, { it.substringBefore("=") }, { it.substringAfter("=", "") })
.associateByTo(result, { it.substringBefore('=') }, { it.substringAfter('=', "") })
return VmProperties(result)
}
@@ -102,7 +101,7 @@ fun readVmOptions(runDir: Path): List<String> {
val result = ArrayList<String>()
val vmOptionsFile = Files.newDirectoryStream(runDir.resolve("bin"), "*.vmoptions").use { it.singleOrNull() }
require(vmOptionsFile != null) {
requireNotNull(vmOptionsFile) {
"No single *.vmoptions file in ${runDir} (${NioFiles.list(runDir).map(Path::getFileName).joinToString()})}"
}
result.addAll(vmOptionsFile.readLines())
@@ -119,7 +118,7 @@ fun readVmOptions(runDir: Path): List<String> {
return result
}
/** Returns IDE installation directory */
// returns IDE installation directory
suspend fun buildProductInProcess(request: BuildRequest): Path {
request.tracer?.let {
TraceManager.setTracer(it)
@@ -158,7 +157,7 @@ private fun createConfiguration(productionClassOutput: Path, homePath: Path): Pr
}
val projectPropertiesPath = getProductPropertiesPath(homePath)
return Json.decodeFromString(ProductConfigurationRegistry.serializer(), Files.readString(projectPropertiesPath))
return Json.decodeFromString(Files.readString(projectPropertiesPath))
}
internal fun getProductPropertiesPath(homePath: Path): Path {
@@ -168,8 +167,8 @@ internal fun getProductPropertiesPath(homePath: Path): Path {
}
private fun getProductConfiguration(configuration: ProductConfigurationRegistry, platformPrefix: String, baseIdePlatformPrefixForFrontend: String?): ProductConfiguration {
val key = if (baseIdePlatformPrefixForFrontend != null) "$baseIdePlatformPrefixForFrontend$platformPrefix" else platformPrefix
return configuration.products[key]
val key = if (baseIdePlatformPrefixForFrontend == null) platformPrefix else "$baseIdePlatformPrefixForFrontend$platformPrefix"
return configuration.products.get(key)
?: throw ConfigurationException("No production configuration for `$key`; please add to `${PRODUCT_REGISTRY_PATH}` if needed")
}
+7 -7
View File
@@ -1,12 +1,12 @@
f:com.intellij.platform.buildData.productInfo.CustomCommandLaunchData
- sf:Companion:com.intellij.platform.buildData.productInfo.CustomCommandLaunchData$Companion
- f:getAdditionalJvmArguments():java.util.List
- f:getBootClassPathJarNames():java.util.List
- f:getCommands():java.util.List
- f:getDataDirectoryName():java.lang.String
- f:getEnvVarBaseName():java.lang.String
- f:getMainClass():java.lang.String
- f:getVmOptionsFilePath():java.lang.String
- f:additionalJvmArguments:java.util.List
- f:bootClassPathJarNames:java.util.List
- f:commands:java.util.List
- f:dataDirectoryName:java.lang.String
- f:envVarBaseName:java.lang.String
- f:mainClass:java.lang.String
- f:vmOptionsFilePath:java.lang.String
bf:com.intellij.platform.buildData.productInfo.CustomCommandLaunchData$$serializer
- kotlinx.serialization.internal.GeneratedSerializer
- sf:INSTANCE:com.intellij.platform.buildData.productInfo.CustomCommandLaunchData$$serializer
@@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.Serializer
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.ApiStatus.Internal
import java.time.LocalDate
import java.time.format.DateTimeFormatter
@@ -43,8 +43,8 @@ class ProductInfoData private constructor(
val flavors: List<ProductFlavorData> = emptyList(),
// not used by the launcher; must be at the end
@ApiStatus.Internal
val layout: List<ProductInfoLayoutItem> = emptyList(),
@Internal
@JvmField val layout: List<ProductInfoLayoutItem> = emptyList(),
) {
companion object {
/**
@@ -52,8 +52,7 @@ class ProductInfoData private constructor(
* Some properties that are nullable in the primary constructor are deliberately marked as not-null in this function to state that they
* are required in the current version, and internal clients may rely on their presence.
*/
@ApiStatus.Internal
@JvmStatic
@Internal
fun create(
name: String,
version: String,
@@ -72,15 +71,32 @@ class ProductInfoData private constructor(
fileExtensions: List<String>,
flavors: List<ProductFlavorData>,
layout: List<ProductInfoLayoutItem>,
): ProductInfoData = ProductInfoData(
name, version, versionSuffix, buildNumber, productCode, envVarBaseName, dataDirectoryName, svgIconPath, productVendor,
majorVersionReleaseDate, launch, customProperties, bundledPlugins, modules, fileExtensions, flavors, layout
)
): ProductInfoData {
return ProductInfoData(
name = name,
version = version,
versionSuffix = versionSuffix,
buildNumber = buildNumber,
productCode = productCode,
envVarBaseName = envVarBaseName,
dataDirectoryName = dataDirectoryName,
svgIconPath = svgIconPath,
productVendor = productVendor,
majorVersionReleaseDate = majorVersionReleaseDate,
launch = launch,
customProperties = customProperties,
bundledPlugins = bundledPlugins,
modules = modules,
fileExtensions = fileExtensions,
flavors = flavors,
layout = layout
)
}
}
}
@Serializable
class ProductFlavorData @ApiStatus.Internal constructor(@JvmField val id: String)
class ProductFlavorData @Internal constructor(@JvmField val id: String)
/**
* Describes 'launch' section in [product-info.json][ProductInfoData] file.
@@ -104,7 +120,7 @@ class ProductInfoLaunchData private constructor(
* Some properties that are nullable in the primary constructor are deliberately marked as not-null in this function to state that they
* are required in the current version, and internal clients may rely on their presence.
*/
@ApiStatus.Internal
@Internal
@JvmStatic
fun create(
os: String,
@@ -117,27 +133,37 @@ class ProductInfoLaunchData private constructor(
mainClass: String,
startupWmClass: String? = null,
customCommands: List<CustomCommandLaunchData> = emptyList(),
): ProductInfoLaunchData = ProductInfoLaunchData(
os, arch, launcherPath, javaExecutablePath, vmOptionsFilePath, startupWmClass, bootClassPathJarNames, additionalJvmArguments,
mainClass, customCommands
)
): ProductInfoLaunchData {
return ProductInfoLaunchData(
os = os,
arch = arch,
launcherPath = launcherPath,
javaExecutablePath = javaExecutablePath,
vmOptionsFilePath = vmOptionsFilePath,
startupWmClass = startupWmClass,
bootClassPathJarNames = bootClassPathJarNames,
additionalJvmArguments = additionalJvmArguments,
mainClass = mainClass,
customCommands = customCommands,
)
}
}
}
@Serializable
@Suppress("unused")
class CustomCommandLaunchData @ApiStatus.Internal constructor(
val commands: List<String>,
val vmOptionsFilePath: String? = null,
val bootClassPathJarNames: List<String> = emptyList(),
val additionalJvmArguments: List<String> = emptyList(),
val mainClass: String? = null,
val envVarBaseName: String? = null,
val dataDirectoryName: String? = null,
class CustomCommandLaunchData @Internal constructor(
@JvmField val commands: List<String>,
@JvmField val vmOptionsFilePath: String? = null,
@JvmField val bootClassPathJarNames: List<String> = emptyList(),
@JvmField val additionalJvmArguments: List<String> = emptyList(),
@JvmField val mainClass: String? = null,
@JvmField val envVarBaseName: String? = null,
@JvmField val dataDirectoryName: String? = null,
)
@Serializable
class CustomProperty @ApiStatus.Internal constructor(
class CustomProperty @Internal constructor(
val key: String,
val value: String,
)