Cleanup (minor optimization; typos; formatting)

GitOrigin-RevId: 7022f336b562f965bf63a628e7679e0c6fc7dcff
This commit is contained in:
Roman Shevchenko
2025-10-06 22:08:21 +00:00
committed by intellij-monorepo-bot
parent 88f432bdc4
commit a59527ec0e
6 changed files with 63 additions and 104 deletions
@@ -13,16 +13,11 @@ import org.jetbrains.intellij.build.kotlin.KotlinBinaries
import java.nio.file.Path
internal suspend fun createCommunityBuildContext(
options: BuildOptions = BuildOptions(),
options: BuildOptions,
projectHome: Path = COMMUNITY_ROOT.communityRoot,
): BuildContext {
return BuildContextImpl.createContext(
projectHome = projectHome,
productProperties = IdeaCommunityProperties(COMMUNITY_ROOT.communityRoot),
setupTracer = true,
options = options,
)
}
): BuildContext = BuildContextImpl.createContext(
projectHome, IdeaCommunityProperties(COMMUNITY_ROOT.communityRoot), setupTracer = true, options = options
)
open class IdeaCommunityProperties(private val communityHomeDir: Path) : BaseIdeaProperties() {
companion object {
@@ -151,9 +146,8 @@ open class IdeaCommunityProperties(private val communityHomeDir: Path) : BaseIde
override fun getFullNameIncludingEditionAndVendor(appInfo: ApplicationInfoProperties): String = "IntelliJ IDEA Community Edition"
override fun getUninstallFeedbackPageUrl(appInfo: ApplicationInfoProperties): String {
return "https://www.jetbrains.com/idea/uninstall/?edition=IC-${appInfo.majorVersion}.${appInfo.minorVersion}"
}
override fun getUninstallFeedbackPageUrl(appInfo: ApplicationInfoProperties): String =
"https://www.jetbrains.com/idea/uninstall/?edition=IC-${appInfo.majorVersion}.${appInfo.minorVersion}"
}
protected open inner class CommunityLinuxDistributionCustomizer : LinuxDistributionCustomizer() {
@@ -173,11 +167,10 @@ open class IdeaCommunityProperties(private val communityHomeDir: Path) : BaseIde
includeRuntime: Boolean,
arch: JvmArchitecture,
targetLibcImpl: LibcImpl,
): Sequence<String> {
return super.generateExecutableFilesPatterns(context, includeRuntime, arch, targetLibcImpl)
): Sequence<String> =
super.generateExecutableFilesPatterns(context, includeRuntime, arch, targetLibcImpl)
.plus(KotlinBinaries.kotlinCompilerExecutables)
.filterNot { it == "plugins/**/*.sh" }
}
}
protected open inner class CommunityMacDistributionCustomizer : MacDistributionCustomizer() {
@@ -191,25 +184,18 @@ open class IdeaCommunityProperties(private val communityHomeDir: Path) : BaseIde
dmgImagePath = "${communityHomeDir}/build/conf/ideaCE/mac/images/dmg_background.tiff"
}
override fun getRootDirectoryName(appInfo: ApplicationInfoProperties, buildNumber: String): String {
if (appInfo.isEAP) {
return "IntelliJ IDEA ${appInfo.majorVersion}.${appInfo.minorVersionMainPart} CE EAP.app"
}
else {
return "IntelliJ IDEA CE.app"
}
}
override fun getRootDirectoryName(appInfo: ApplicationInfoProperties, buildNumber: String): String =
if (appInfo.isEAP) "IntelliJ IDEA ${appInfo.majorVersion}.${appInfo.minorVersionMainPart} CE EAP.app"
else "IntelliJ IDEA CE.app"
override fun generateExecutableFilesPatterns(context: BuildContext, includeRuntime: Boolean, arch: JvmArchitecture): Sequence<String> {
return super.generateExecutableFilesPatterns(context, includeRuntime, arch)
override fun generateExecutableFilesPatterns(context: BuildContext, includeRuntime: Boolean, arch: JvmArchitecture): Sequence<String> =
super.generateExecutableFilesPatterns(context, includeRuntime, arch)
.plus(KotlinBinaries.kotlinCompilerExecutables)
.filterNot { it == "plugins/**/*.sh" }
}
}
override fun getSystemSelector(appInfo: ApplicationInfoProperties, buildNumber: String): String {
return "IdeaIC${appInfo.majorVersion}.${appInfo.minorVersionMainPart}"
}
override fun getSystemSelector(appInfo: ApplicationInfoProperties, buildNumber: String): String =
"IdeaIC${appInfo.majorVersion}.${appInfo.minorVersionMainPart}"
override fun getBaseArtifactName(appInfo: ApplicationInfoProperties, buildNumber: String): String = "ideaIC-$buildNumber"
@@ -61,7 +61,7 @@ internal class ApplicationInfoPropertiesImpl(
get() = if (edition == null) fullProductName else "$fullProductName $edition"
init {
val root = readXmlAsModel(findApplicationInfoInSources(project = project, productProperties = productProperties))
val root = readXmlAsModel(findApplicationInfoInSources(project, productProperties))
@Suppress("DEPRECATION")
val applicationInfoOverrides = productProperties.applicationInfoOverride(project)
val versionTag = root.getChild("version")!!
@@ -26,7 +26,7 @@ open class LinuxDistributionCustomizer {
* Enables the use of the new cross-platform launcher (which loads launch data from `product-info.json` instead of hardcoding into a script).
* It's now recommended to use the new launcher, so it must always be built. Setting this property to `false` will have no effect.
*/
var useXPlatLauncher = true
var useXPlatLauncher: Boolean = true
/**
* Relative paths to files in Linux distribution which should take 'executable' permissions
@@ -41,28 +41,28 @@ open class LinuxDistributionCustomizer {
"bin/restarter",
"bin/${context.productProperties.baseFileName}",
)
val rtPatterns = if (includeRuntime) {
val distribution = if (targetLibcImpl == LinuxLibcImpl.MUSL) {
JetBrainsRuntimeDistribution.LIGHTWEIGHT
} else {
context.productProperties.runtimeDistribution
}
val distribution =
if (targetLibcImpl == LinuxLibcImpl.MUSL) JetBrainsRuntimeDistribution.LIGHTWEIGHT
else context.productProperties.runtimeDistribution
context.bundledRuntime.executableFilesPatterns(OsFamily.LINUX, distribution)
}
else {
emptySequence()
}
return basePatterns + rtPatterns +
return basePatterns +
rtPatterns +
RepairUtilityBuilder.executableFilesPatterns(context) +
extraExecutables +
context.getExtraExecutablePattern(OsFamily.LINUX)
}
/**
* If `true`, a separate *[org.jetbrains.intellij.build.impl.LinuxDistributionBuilder.NO_RUNTIME_SUFFIX].tar.gz artifact without a runtime will be produced.
* If `true`, a separate `*${LinuxDistributionBuilder.NO_RUNTIME_SUFFIX}.tar.gz` artifact without a runtime will be produced.
*/
var buildArtifactWithoutRuntime = false
var buildArtifactWithoutRuntime: Boolean = false
/**
* Set both properties if a .snap package should be produced.
@@ -82,6 +82,6 @@ open class LinuxDistributionCustomizer {
* Override this method to copy additional files to the Linux distribution of the product.
*/
open suspend fun copyAdditionalFiles(context: BuildContext, targetDir: Path, arch: JvmArchitecture) {
RepairUtilityBuilder.bundle(context = context, os = OsFamily.LINUX, arch = arch, distributionDir = targetDir)
RepairUtilityBuilder.bundle(context, OsFamily.LINUX, arch, targetDir)
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.pycharm
import kotlinx.collections.immutable.persistentListOf
@@ -43,7 +43,7 @@ open class PyCharmCommunityProperties(protected val communityHome: Path) : PyCha
mavenArtifacts.forIdeModules = true
additionalVmOptions = persistentListOf("-Dllm.show.ai.promotion.window.on.start=false")
qodanaProductProperties = QodanaProductProperties("QDPYC", "Qodana Community for Python")
qodanaProductProperties = QodanaProductProperties(@Suppress("SpellCheckingInspection") "QDPYC", "Qodana Community for Python")
}
override suspend fun copyAdditionalFiles(context: BuildContext, targetDir: Path) {
@@ -54,52 +54,45 @@ open class PyCharmCommunityProperties(protected val communityHome: Path) : PyCha
copyFileToDir(context.paths.communityHomeDir.resolve("NOTICE.txt"), licenseTargetDir)
}
override fun getSystemSelector(appInfo: ApplicationInfoProperties, buildNumber: String): String {
return "PyCharmCE${appInfo.majorVersion}.${appInfo.minorVersionMainPart}"
}
override fun getSystemSelector(appInfo: ApplicationInfoProperties, buildNumber: String): String =
"PyCharmCE${appInfo.majorVersion}.${appInfo.minorVersionMainPart}"
override fun getBaseArtifactName(appInfo: ApplicationInfoProperties, buildNumber: String): String = "pycharmPC-$buildNumber"
override fun createWindowsCustomizer(projectHome: String): WindowsDistributionCustomizer {
return PyCharmCommunityWindowsDistributionCustomizer(communityHome)
}
override fun createLinuxCustomizer(projectHome: String): LinuxDistributionCustomizer {
return object : PyCharmCommunityLinuxDistributionCustomizer(communityHome) {
init {
snapName = "pycharm-community"
snapDescription = "Python IDE for professional developers. Save time while PyCharm takes care of the routine. " +
"Focus on bigger things and embrace the keyboard-centric approach to get the most of PyCharm’s many productivity features."
}
override fun createWindowsCustomizer(projectHome: String): WindowsDistributionCustomizer = object : WindowsDistributionCustomizer() {
init {
icoPath = "${communityHome}/python/build/resources/PyCharmCore.ico"
icoPathForEAP = "${communityHome}/python/build/resources/PyCharmCore_EAP.ico"
installerImagesPath = "${communityHome}/python/build/resources"
fileAssociations = listOf("py")
}
override fun getFullNameIncludingEdition(appInfo: ApplicationInfoProperties) = "PyCharm Community Edition"
override suspend fun copyAdditionalFiles(context: BuildContext, targetDir: Path, arch: JvmArchitecture) {
super.copyAdditionalFiles(context, targetDir, arch)
PyCharmBuildUtils.copySkeletons(context, targetDir, "skeletons-win*.zip")
}
override fun getUninstallFeedbackPageUrl(appInfo: ApplicationInfoProperties): String =
"https://www.jetbrains.com/pycharm/uninstall/?version=${appInfo.productCode}-${appInfo.majorVersion}.${appInfo.minorVersion}"
}
override fun createMacCustomizer(projectHome: String): MacDistributionCustomizer {
return PyCharmMacDistributionCustomizer(communityHome)
override fun createMacCustomizer(projectHome: String): MacDistributionCustomizer = PyCharmMacDistributionCustomizer(communityHome)
override fun createLinuxCustomizer(projectHome: String): LinuxDistributionCustomizer = object : LinuxDistributionCustomizer() {
init {
iconPngPath = "${communityHome}/python/build/resources/PyCharmCore128.png"
iconPngPathForEAP = "${communityHome}/python/build/resources/PyCharmCore128_EAP.png"
snapName = "pycharm-community"
snapDescription =
"Python IDE for professional developers. Save time while PyCharm takes care of the routine. " +
"Focus on bigger things and embrace the keyboard-centric approach to get the most of PyCharm’s many productivity features."
}
override fun getRootDirectoryName(appInfo: ApplicationInfoProperties, buildNumber: String): String =
"pycharm-community-${if (appInfo.isEAP) buildNumber else appInfo.fullVersion}"
}
override fun getOutputDirectoryName(appInfo: ApplicationInfoProperties): String = "pycharm-ce"
}
private class PyCharmCommunityWindowsDistributionCustomizer(projectHome: Path) : PyCharmWindowsDistributionCustomizer() {
init {
icoPath = "$projectHome/python/build/resources/PyCharmCore.ico"
icoPathForEAP = "$projectHome/python/build/resources/PyCharmCore_EAP.ico"
installerImagesPath = "$projectHome/python/build/resources"
fileAssociations = listOf("py")
}
override fun getFullNameIncludingEdition(appInfo: ApplicationInfoProperties) = "PyCharm Community Edition"
}
private open class PyCharmCommunityLinuxDistributionCustomizer(projectHome: Path) : LinuxDistributionCustomizer() {
init {
iconPngPath = "$projectHome/python/build/resources/PyCharmCore128.png"
iconPngPathForEAP = "$projectHome/python/build/resources/PyCharmCore128_EAP.png"
}
override fun getRootDirectoryName(appInfo: ApplicationInfoProperties, buildNumber: String): String {
return "pycharm-community-${if (appInfo.isEAP) buildNumber else appInfo.fullVersion}"
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.pycharm
import org.jetbrains.intellij.build.ApplicationInfoProperties
@@ -25,7 +25,6 @@ open class PyCharmMacDistributionCustomizer(projectHome: Path) : MacDistribution
PyCharmBuildUtils.copySkeletons(context, targetDir, "skeletons-mac*.zip")
}
override fun getCustomIdeaProperties(appInfo: ApplicationInfoProperties): Map<String, String> {
return mapOf("ide.mac.useNativeClipboard" to "false")
}
override fun getCustomIdeaProperties(appInfo: ApplicationInfoProperties): Map<String, String> =
mapOf("ide.mac.useNativeClipboard" to "false")
}
@@ -1,19 +0,0 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.pycharm
import org.jetbrains.intellij.build.ApplicationInfoProperties
import org.jetbrains.intellij.build.BuildContext
import org.jetbrains.intellij.build.JvmArchitecture
import org.jetbrains.intellij.build.WindowsDistributionCustomizer
import java.nio.file.Path
open class PyCharmWindowsDistributionCustomizer : WindowsDistributionCustomizer() {
override suspend fun copyAdditionalFiles(context: BuildContext, targetDir: Path, arch: JvmArchitecture) {
super.copyAdditionalFiles(context, targetDir, arch)
PyCharmBuildUtils.copySkeletons(context, targetDir, "skeletons-win*.zip")
}
override fun getUninstallFeedbackPageUrl(appInfo: ApplicationInfoProperties): String? {
return "https://www.jetbrains.com/pycharm/uninstall/?version=${appInfo.productCode}-${appInfo.majorVersion}.${appInfo.minorVersion}"
}
}