IJPL-219222 ultimate linux dist customizer (part 2 - use NIO)

GitOrigin-RevId: c87f598c51f423bd01b2190da2772c065a932e95
This commit is contained in:
Vladimir Krivosheev
2025-11-24 19:52:57 +00:00
committed by intellij-monorepo-bot
parent ff7f63eb1f
commit e3d973ad11
4 changed files with 10 additions and 18 deletions
@@ -142,8 +142,8 @@ class LinuxCustomizerBuilder @PublishedApi internal constructor(private val proj
private val projectHome: Path,
) : LinuxDistributionCustomizer() {
init {
builder.iconPngPath?.let { iconPngPath = projectHome.resolve(it).toString() }
builder.iconPngPathForEAP?.let { iconPngPathForEAP = projectHome.resolve(it).toString() }
builder.iconPngPath?.let { iconPngPath = projectHome.resolve(it) }
builder.iconPngPathForEAP?.let { iconPngPathForEAP = projectHome.resolve(it) }
extraExecutables = builder.extraExecutables
buildArtifactWithoutRuntime = builder.buildArtifactWithoutRuntime
snaps = builder.snaps
@@ -210,12 +210,12 @@ open class LinuxDistributionCustomizer {
* Path to a 128x128 PNG product icon for Linux distribution.
* If omitted, only an SVG icon will be included.
*/
var iconPngPath: String? = null
var iconPngPath: Path? = null
/**
* Path to a PNG product icon for EAP builds (if `null`, [iconPngPath] will be used).
*/
var iconPngPathForEAP: String? = null
var iconPngPathForEAP: Path? = null
@Suppress("unused")
@ApiStatus.ScheduledForRemoval
@@ -611,8 +611,8 @@ private suspend fun checkProductProperties(context: BuildContext) {
}
context.linuxDistributionCustomizer?.let { linuxDistributionCustomizer ->
checkStringPaths(listOfNotNull(linuxDistributionCustomizer.iconPngPath), "productProperties.linuxCustomizer.iconPngPath")
checkStringPaths(listOfNotNull(linuxDistributionCustomizer.iconPngPathForEAP), "productProperties.linuxCustomizer.iconPngPathForEAP")
checkPaths(listOfNotNull(linuxDistributionCustomizer.iconPngPath), "productProperties.linuxCustomizer.iconPngPath")
checkPaths(listOfNotNull(linuxDistributionCustomizer.iconPngPathForEAP), "productProperties.linuxCustomizer.iconPngPathForEAP")
}
context.macDistributionCustomizer?.let { macCustomizer ->
@@ -778,13 +778,6 @@ private fun checkPaths(paths: Collection<Path>, propertyName: String) {
}
}
private fun checkStringPaths(paths: Collection<String>, propertyName: String) {
val nonExistingFiles = paths.filter { Files.notExists(Path.of(it)) }
check(nonExistingFiles.isEmpty()) {
"$propertyName contains non-existing files: ${nonExistingFiles.joinToString()}"
}
}
private fun checkPaths2(paths: Collection<Path>, propertyName: String) {
val nonExistingFiles = paths.filter { Files.notExists(it) }
check(nonExistingFiles.isEmpty()) {
@@ -62,8 +62,7 @@ class LinuxDistributionBuilder(
private val iconPngPath: Path?
init {
val iconPng = (if (context.applicationInfo.isEAP) customizer.iconPngPathForEAP else null) ?: customizer.iconPngPath
iconPngPath = if (iconPng.isNullOrEmpty()) null else Path.of(iconPng)
iconPngPath = (if (context.applicationInfo.isEAP) customizer.iconPngPathForEAP else null) ?: customizer.iconPngPath
}
override val targetOs: OsFamily
@@ -96,7 +96,7 @@ open class PyCharmCommunityProperties(protected val communityHome: Path) : PyCha
fullName { "PyCharm Community Edition" }
copyAdditionalFiles { targetDir, arch, context ->
copyAdditionalFiles { targetDir, _, context ->
PyCharmBuildUtils.copySkeletons(context, targetDir, "skeletons-win*.zip")
}
@@ -110,8 +110,8 @@ open class PyCharmCommunityProperties(protected val communityHome: Path) : PyCha
override fun createLinuxCustomizer(projectHome: String): LinuxDistributionCustomizer {
return object : LinuxDistributionCustomizer() {
init {
iconPngPath = "${communityHome}/python/build/resources/PyCharmCore128.png"
iconPngPathForEAP = "${communityHome}/python/build/resources/PyCharmCore128_EAP.png"
iconPngPath = communityHome.resolve("python/build/resources/PyCharmCore128.png")
iconPngPathForEAP = communityHome.resolve("python/build/resources/PyCharmCore128_EAP.png")
snaps += Snap(
name = "pycharm-community",
description =