diff --git a/platform/build-scripts/dev-server/src/DevMainImpl.kt b/platform/build-scripts/dev-server/src/DevMainImpl.kt index 01836eebb3e4..2c7c5240c2e5 100644 --- a/platform/build-scripts/dev-server/src/DevMainImpl.kt +++ b/platform/build-scripts/dev-server/src/DevMainImpl.kt @@ -15,9 +15,9 @@ import java.nio.file.Path import kotlin.io.path.invariantSeparatorsPathString data class BuildDevInfo( - val mainClassName: String, - val classPath: Collection, - val systemProperties: Map, + @JvmField val mainClassName: String, + @JvmField val classPath: Collection, + @JvmField val systemProperties: Map, ) /** diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/dev/BuildServer.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/dev/BuildServer.kt index dd6a1701df81..05cee975fd39 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/dev/BuildServer.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/dev/BuildServer.kt @@ -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 { val result = ArrayList() 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 { 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") } diff --git a/platform/buildData/api-dump.txt b/platform/buildData/api-dump.txt index ecb1abe161ff..a432dee6869e 100644 --- a/platform/buildData/api-dump.txt +++ b/platform/buildData/api-dump.txt @@ -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 diff --git a/platform/buildData/src/productInfo/ProductInfoData.kt b/platform/buildData/src/productInfo/ProductInfoData.kt index 67fe55c421fa..d3068957caed 100644 --- a/platform/buildData/src/productInfo/ProductInfoData.kt +++ b/platform/buildData/src/productInfo/ProductInfoData.kt @@ -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 = emptyList(), // not used by the launcher; must be at the end - @ApiStatus.Internal - val layout: List = emptyList(), + @Internal + @JvmField val layout: List = 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, flavors: List, layout: List, - ): 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 = 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, - val vmOptionsFilePath: String? = null, - val bootClassPathJarNames: List = emptyList(), - val additionalJvmArguments: List = emptyList(), - val mainClass: String? = null, - val envVarBaseName: String? = null, - val dataDirectoryName: String? = null, +class CustomCommandLaunchData @Internal constructor( + @JvmField val commands: List, + @JvmField val vmOptionsFilePath: String? = null, + @JvmField val bootClassPathJarNames: List = emptyList(), + @JvmField val additionalJvmArguments: List = 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, )