build scripts: simplification

Do not require leading dot in WindowsDistributionCustomizer::fileAssociations property to simplify code and for consistency with MacDistributionCustomizer::fileAssociations.
This commit is contained in:
nik
2018-05-23 14:54:53 +03:00
parent 04086e1fd1
commit 23b754bf2e
6 changed files with 14 additions and 7 deletions
@@ -68,7 +68,7 @@ class IdeaCommunityProperties extends BaseIdeaProperties {
{
icoPath = "$projectHome/platform/icons/src/idea_CE.ico"
installerImagesPath = "$projectHome/build/conf/ideaCE/win/images"
fileAssociations = [".java", ".groovy", ".kt"]
fileAssociations = ["java", "groovy", "kt"]
}
@Override
@@ -70,7 +70,7 @@ abstract class MacDistributionCustomizer {
String additionalDocTypes = ""
/**
* List of file extensions (without dot) which installer will associate with the product. Note that users won't be able to switch off some
* List of file extensions (without leading dot) which installer will associate with the product. Note that users won't be able to switch off some
* of these associations during installation so include only types of files which users will definitely prefer to open by the product.
*/
List<String> fileAssociations = []
@@ -68,7 +68,7 @@ abstract class WindowsDistributionCustomizer {
String installerImagesPath
/**
* List of file extensions (starting with dot) which installer will suggest to associate with the product
* List of file extensions (without leading dot) which installer will suggest to associate with the product
*/
List<String> fileAssociations = []
@@ -54,7 +54,7 @@ class WinExeInstallerBuilder {
buildContext.ant.copy(file: "$silentConfigTemplate", tofile: targetFilePath)
File silentConfigFile = new File(targetFilePath)
def extensionsList = customizer.fileAssociations
def extensionsList = getFileAssociations()
String associations = "\n\n; List of associations. To create an association change value to 1.\n"
if (!extensionsList.isEmpty()) {
associations += extensionsList.collect { "$it=0\n" }.join("")
@@ -66,6 +66,13 @@ class WinExeInstallerBuilder {
}
}
/**
* Returns list of file extensions with leading dot added
*/
private List<String> getFileAssociations() {
customizer.fileAssociations.collect { !it.startsWith(".") ? ".$it" : it}
}
void buildInstaller(String winDistPath) {
if (!SystemInfoRt.isWindows && !SystemInfoRt.isLinux) {
buildContext.messages.warning("Windows installer can be built only under Windows or Linux")
@@ -179,7 +186,7 @@ class WinExeInstallerBuilder {
!define PRODUCT_VM_OPTIONS_FILE "${toSystemDependentName("$winDistPath/bin/")}\${PRODUCT_VM_OPTIONS_NAME}"
"""
def extensionsList = customizer.fileAssociations
def extensionsList = getFileAssociations()
def fileAssociations = extensionsList.isEmpty() ? "NoAssociation" : extensionsList.join(",")
def linkToJre = customizer.getBaseDownloadUrlForJre() != null ?
"${customizer.getBaseDownloadUrlForJre()}/${buildContext.bundledJreManager.archiveNameJre(buildContext)}" :
@@ -60,7 +60,7 @@ class PyCharmCommunityProperties extends PyCharmPropertiesBase {
return new PyCharmWindowsDistributionCustomizer() {
{
installerImagesPath = "$projectHome/python/build/resources"
fileAssociations = [".py"]
fileAssociations = ["py"]
}
@Override
@@ -55,7 +55,7 @@ class PyCharmEduProperties extends PyCharmPropertiesBase {
return new PyCharmWindowsDistributionCustomizer() {
{
installerImagesPath = "$pythonCommunityPath/educational-python/build/resources"
fileAssociations = [".py"]
fileAssociations = ["py"]
silentInstallationConfig = "$pythonCommunityPath/educational-python/build/silent.config"
customNsiConfigurationFiles = [
"$pythonCommunityPath/educational-python/build/desktop.ini",