mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-217839 simplify createWindowsCustomizer
GitOrigin-RevId: 351c923e4ee8c641b371e3ce62e1407461a48913
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1b515e542b
commit
e4364da218
@@ -134,7 +134,7 @@ open class IdeaCommunityProperties(private val communityHomeDir: Path) : JetBrai
|
||||
|
||||
protected open suspend fun bundleExternalPlugins(context: BuildContext, targetDirectory: Path) {}
|
||||
|
||||
override fun createWindowsCustomizer(projectHome: String): WindowsDistributionCustomizer = CommunityWindowsDistributionCustomizer()
|
||||
override fun createWindowsCustomizer(projectHome: Path): WindowsDistributionCustomizer = CommunityWindowsDistributionCustomizer()
|
||||
|
||||
override fun createLinuxCustomizer(projectHome: String): LinuxDistributionCustomizer = CommunityLinuxDistributionCustomizer()
|
||||
|
||||
@@ -145,9 +145,11 @@ open class IdeaCommunityProperties(private val communityHomeDir: Path) : JetBrai
|
||||
icoPath = "${communityHomeDir}/build/conf/ideaCE/win/images/idea_CE.ico"
|
||||
icoPathForEAP = "${communityHomeDir}/build/conf/ideaCE/win/images/idea_CE_EAP.ico"
|
||||
installerImagesPath = "${communityHomeDir}/build/conf/ideaCE/win/images"
|
||||
fileAssociations = listOf("java", "gradle", "groovy", "kt", "kts", "pom")
|
||||
}
|
||||
|
||||
override val fileAssociations: List<String>
|
||||
get() = listOf("java", "gradle", "groovy", "kt", "kts", "pom")
|
||||
|
||||
override fun getFullNameIncludingEdition(appInfo: ApplicationInfoProperties): String = "IntelliJ IDEA Community Edition"
|
||||
|
||||
override fun getFullNameIncludingEditionAndVendor(appInfo: ApplicationInfoProperties): String = "IntelliJ IDEA Community Edition"
|
||||
|
||||
@@ -63,7 +63,9 @@ data class BuildOptions(
|
||||
/**
|
||||
* Pass comma-separated names of build steps (see below) to [BUILD_STEPS_TO_SKIP_PROPERTY] system property to skip them when building locally.
|
||||
*/
|
||||
@JvmField var buildStepsToSkip: Set<String> = System.getProperty(BUILD_STEPS_TO_SKIP_PROPERTY, "").split(',').dropLastWhile { it.isEmpty() }
|
||||
@JvmField var buildStepsToSkip: Set<String> = System.getProperty(BUILD_STEPS_TO_SKIP_PROPERTY, "")
|
||||
.split(',')
|
||||
.dropLastWhile { it.isEmpty() }
|
||||
.filterNot { it.isBlank() }
|
||||
.toMutableSet()
|
||||
.apply {
|
||||
|
||||
+9
-6
@@ -152,12 +152,14 @@ open class MacDistributionCustomizer {
|
||||
"MacOS/*"
|
||||
)
|
||||
|
||||
val rtPatterns =
|
||||
if (includeRuntime) context.bundledRuntime.executableFilesPatterns(OsFamily.MACOS, context.productProperties.runtimeDistribution)
|
||||
else emptySequence()
|
||||
val rtPatterns = if (includeRuntime) {
|
||||
context.bundledRuntime.executableFilesPatterns(OsFamily.MACOS, context.productProperties.runtimeDistribution)
|
||||
}
|
||||
else {
|
||||
emptySequence()
|
||||
}
|
||||
|
||||
val utilPatters = RepairUtilityBuilder.executableFilesPatterns(context)
|
||||
|
||||
return basePatterns + rtPatterns + utilPatters + extraExecutables + context.getExtraExecutablePattern(OsFamily.MACOS)
|
||||
}
|
||||
|
||||
@@ -173,6 +175,7 @@ open class MacDistributionCustomizer {
|
||||
* > For example, the network subsystem might apply constraints for one of your apps to the other app.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
open fun getDistributionUUID(context: BuildContext, currentUuid: UUID?): UUID =
|
||||
UUID.nameUUIDFromBytes("${context.fullBuildNumber}-${context.options.buildDateInSeconds}".toByteArray())
|
||||
open fun getDistributionUUID(context: BuildContext, currentUuid: UUID?): UUID {
|
||||
return UUID.nameUUIDFromBytes("${context.fullBuildNumber}-${context.options.buildDateInSeconds}".toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ abstract class ProductProperties {
|
||||
* @return an instance of the class containing properties specific for Windows distribution,
|
||||
* or `null` if the product doesn't have Windows distribution.
|
||||
*/
|
||||
abstract fun createWindowsCustomizer(projectHome: String): WindowsDistributionCustomizer?
|
||||
abstract fun createWindowsCustomizer(projectHome: Path): WindowsDistributionCustomizer?
|
||||
|
||||
/**
|
||||
* @return an instance of the class containing properties specific for Linux distribution,
|
||||
|
||||
+13
-10
@@ -1,12 +1,10 @@
|
||||
// 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
|
||||
|
||||
import kotlinx.collections.immutable.PersistentList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import org.jetbrains.intellij.build.impl.support.RepairUtilityBuilder
|
||||
import java.nio.file.Path
|
||||
|
||||
open class WindowsDistributionCustomizer {
|
||||
abstract class WindowsDistributionCustomizer {
|
||||
/**
|
||||
* Path to 256x256 *.ico file for Windows distribution.
|
||||
*/
|
||||
@@ -38,7 +36,8 @@ open class WindowsDistributionCustomizer {
|
||||
/**
|
||||
* If `true`, Windows Installer will associate *.ipr files with the IDE in Registry.
|
||||
*/
|
||||
var associateIpr: Boolean = true
|
||||
open val associateIpr: Boolean
|
||||
get() = true
|
||||
|
||||
/**
|
||||
* Path to a directory containing images for installer: `logo.bmp`, `headerlogo.bmp`, `install.ico`, `uninstall.ico`.
|
||||
@@ -53,12 +52,14 @@ open class WindowsDistributionCustomizer {
|
||||
/**
|
||||
* List of file extensions (without a leading dot) which the installer will suggest to associate with the product.
|
||||
*/
|
||||
var fileAssociations: List<String> = emptyList()
|
||||
open val fileAssociations: List<String>
|
||||
get() = emptyList()
|
||||
|
||||
/**
|
||||
* Paths to files which will be used to overwrite the standard *.nsi files.
|
||||
*/
|
||||
var customNsiConfigurationFiles: PersistentList<String> = persistentListOf()
|
||||
open val customNsiConfigurationFiles: List<Path>
|
||||
get() = emptyList()
|
||||
|
||||
/**
|
||||
* Name of the root directory in Windows .zip archive
|
||||
@@ -69,8 +70,9 @@ open class WindowsDistributionCustomizer {
|
||||
/**
|
||||
* Name of the Windows installation directory and Desktop shortcut.
|
||||
*/
|
||||
open fun getNameForInstallDirAndDesktopShortcut(appInfo: ApplicationInfoProperties, buildNumber: String): String =
|
||||
"${getFullNameIncludingEdition(appInfo)} ${if (appInfo.isEAP) buildNumber else appInfo.fullVersion}"
|
||||
open fun getNameForInstallDirAndDesktopShortcut(appInfo: ApplicationInfoProperties, buildNumber: String): String {
|
||||
return "${getFullNameIncludingEdition(appInfo)} ${if (appInfo.isEAP) buildNumber else appInfo.fullVersion}"
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to copy additional files to the Windows distribution of the product.
|
||||
@@ -92,8 +94,9 @@ open class WindowsDistributionCustomizer {
|
||||
/**
|
||||
* The returned name will be used to create links on Desktop.
|
||||
*/
|
||||
open fun getFullNameIncludingEditionAndVendor(appInfo: ApplicationInfoProperties): String =
|
||||
appInfo.shortCompanyName + ' ' + getFullNameIncludingEdition(appInfo)
|
||||
open fun getFullNameIncludingEditionAndVendor(appInfo: ApplicationInfoProperties): String {
|
||||
return appInfo.shortCompanyName + ' ' + getFullNameIncludingEdition(appInfo)
|
||||
}
|
||||
|
||||
open fun getUninstallFeedbackPageUrl(appInfo: ApplicationInfoProperties): String? = null
|
||||
|
||||
|
||||
@@ -479,7 +479,7 @@ private suspend fun createBuildContext(
|
||||
BuildContextImpl(
|
||||
compilationContext = compilationContext,
|
||||
productProperties = productProperties.await(),
|
||||
windowsDistributionCustomizer = WindowsDistributionCustomizer(),
|
||||
windowsDistributionCustomizer = object : WindowsDistributionCustomizer() {},
|
||||
linuxDistributionCustomizer = LinuxDistributionCustomizer(),
|
||||
macDistributionCustomizer = MacDistributionCustomizer(),
|
||||
proprietaryBuildTools = if (request.scrambleTool == null) {
|
||||
|
||||
@@ -210,7 +210,7 @@ class BuildContextImpl internal constructor(
|
||||
return BuildContextImpl(
|
||||
compilationContext = compilationContext.asArchivedIfNeeded,
|
||||
productProperties = productProperties,
|
||||
windowsDistributionCustomizer = productProperties.createWindowsCustomizer(projectHomeAsString),
|
||||
windowsDistributionCustomizer = productProperties.createWindowsCustomizer(projectHome),
|
||||
linuxDistributionCustomizer = productProperties.createLinuxCustomizer(projectHomeAsString),
|
||||
macDistributionCustomizer = productProperties.createMacCustomizer(projectHomeAsString),
|
||||
proprietaryBuildTools = proprietaryBuildTools,
|
||||
@@ -331,23 +331,25 @@ class BuildContextImpl internal constructor(
|
||||
options.targetArch = sourceOptions.targetArch
|
||||
options.targetOs = sourceOptions.targetOs
|
||||
|
||||
val newAppInfo = ApplicationInfoPropertiesImpl(project, productProperties, options)
|
||||
val newAppInfo = ApplicationInfoPropertiesImpl(project = project, productProperties = productProperties, buildOptions = options)
|
||||
|
||||
val buildOut = options.outRootDir ?: createBuildOutputRootEvaluator(paths.projectHome, productProperties, options)(project)
|
||||
@Suppress("DEPRECATION")
|
||||
val artifactDir = if (prepareForBuild) paths.artifactDir.resolve(productProperties.productCode ?: newAppInfo.productCode) else null
|
||||
val compilationContextCopy = compilationContext.createCopy(
|
||||
messages, options, computeBuildPaths(options = options, buildOut = buildOut, projectHome = paths.projectHome, artifactDir = artifactDir)
|
||||
messages = messages,
|
||||
options = options,
|
||||
paths = computeBuildPaths(options = options, buildOut = buildOut, projectHome = paths.projectHome, artifactDir = artifactDir)
|
||||
)
|
||||
val copy = BuildContextImpl(
|
||||
compilationContext = compilationContextCopy,
|
||||
productProperties = productProperties,
|
||||
windowsDistributionCustomizer = productProperties.createWindowsCustomizer(projectHomeForCustomizersAsString),
|
||||
windowsDistributionCustomizer = productProperties.createWindowsCustomizer(projectHomeForCustomizers),
|
||||
linuxDistributionCustomizer = productProperties.createLinuxCustomizer(projectHomeForCustomizersAsString),
|
||||
macDistributionCustomizer = productProperties.createMacCustomizer(projectHomeForCustomizersAsString),
|
||||
proprietaryBuildTools = proprietaryBuildTools,
|
||||
applicationInfo = newAppInfo,
|
||||
jarCacheManager = jarCacheManager
|
||||
jarCacheManager = jarCacheManager,
|
||||
)
|
||||
if (prepareForBuild) {
|
||||
copy.compilationContext.prepareForBuild()
|
||||
|
||||
+1
-2
@@ -75,8 +75,7 @@ internal suspend fun buildNsisInstaller(
|
||||
generator.generateUninstallerFile(nsiConfDir.resolve("un_idea_win.nsh"))
|
||||
|
||||
prepareConfigurationFiles(nsiConfDir, uninstallerFileName, customizer, context, arch)
|
||||
for (it in customizer.customNsiConfigurationFiles) {
|
||||
val file = Path.of(it)
|
||||
for (file in customizer.customNsiConfigurationFiles) {
|
||||
val copy = nsiConfDir.resolve(file.fileName)
|
||||
Files.copy(file, copy, StandardCopyOption.REPLACE_EXISTING)
|
||||
copy.setLastModifiedTime(FileTime.from(context.options.buildDateInSeconds, TimeUnit.SECONDS))
|
||||
|
||||
@@ -88,14 +88,16 @@ open class PyCharmCommunityProperties(protected val communityHome: Path) : PyCha
|
||||
|
||||
override fun getBaseArtifactName(appInfo: ApplicationInfoProperties, buildNumber: String): String = "pycharmPC-$buildNumber"
|
||||
|
||||
override fun createWindowsCustomizer(projectHome: String): WindowsDistributionCustomizer = object : WindowsDistributionCustomizer() {
|
||||
override fun createWindowsCustomizer(projectHome: Path): 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 val fileAssociations: List<String>
|
||||
get() = listOf("py")
|
||||
|
||||
override fun getFullNameIncludingEdition(appInfo: ApplicationInfoProperties) = "PyCharm Community Edition"
|
||||
|
||||
override suspend fun copyAdditionalFiles(targetDir: Path, arch: JvmArchitecture, context: BuildContext) {
|
||||
|
||||
Reference in New Issue
Block a user