From ca7a4cff3a7c397429ea62fb53dc414c18a0295e Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Tue, 19 Nov 2019 10:07:34 +0300 Subject: [PATCH] build scripts: provide ability to build artifacts without product version in root installation folder (Rider needs). IDEA-160860 install directory should be named after major or minor version only IDEA-CR-55018 GitOrigin-RevId: 13d6222e04470641fdd495b00a4019d67fc592ba --- build/conf/nsis/idea.nsi | 40 +++++++++---------- .../intellij/build/ProductProperties.groovy | 5 --- .../WindowsDistributionCustomizer.groovy | 8 +++- .../impl/LinuxDistributionBuilder.groovy | 4 +- .../build/impl/MacDistributionBuilder.groovy | 2 - .../build/impl/WinExeInstallerBuilder.groovy | 6 +-- 6 files changed, 31 insertions(+), 34 deletions(-) diff --git a/build/conf/nsis/idea.nsi b/build/conf/nsis/idea.nsi index bb0b2caefb05..2b9aeb95b3ea 100644 --- a/build/conf/nsis/idea.nsi +++ b/build/conf/nsis/idea.nsi @@ -552,7 +552,7 @@ UninstPage custom un.ConfirmDeleteSettings OutFile "${OUT_DIR}\${OUT_FILE}.exe" -InstallDir "$PROGRAMFILES\${MANUFACTURER}\${PRODUCT_WITH_VER}" +InstallDir "$PROGRAMFILES\${MANUFACTURER}\${INSTALL_DIR_AND_SHORTCUT_NAME}" !define MUI_BRANDINGTEXT " " BrandingText " " @@ -1012,9 +1012,9 @@ continue_enum_versions_hklm: end_enum_versions_hklm: StrCmp $INSTDIR "" 0 skip_default_instdir ${If} ${RunningX64} - StrCpy $INSTDIR "$PROGRAMFILES64\${MANUFACTURER}\${MUI_PRODUCT} ${MUI_VERSION_MAJOR}.${MUI_VERSION_MINOR}" + StrCpy $INSTDIR "$PROGRAMFILES64\${MANUFACTURER}\${INSTALL_DIR_AND_SHORTCUT_NAME}" ${Else} - StrCpy $INSTDIR "$PROGRAMFILES\${MANUFACTURER}\${MUI_PRODUCT} ${MUI_VERSION_MAJOR}.${MUI_VERSION_MINOR}" + StrCpy $INSTDIR "$PROGRAMFILES\${MANUFACTURER}\${INSTALL_DIR_AND_SHORTCUT_NAME}" ${EndIf} skip_default_instdir: @@ -1231,16 +1231,16 @@ shortcuts: !insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field $launcherShortcut" "State" StrCmp ${JRE_32BIT_VERSION_SUPPORTED} "0" shortcut_for_exe_64 0 StrCmp $R2 1 "" exe_64 - CreateShortCut "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk" \ + CreateShortCut "$DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk" \ "$INSTDIR\bin\${PRODUCT_EXE_FILE}" "" "" "" SW_SHOWNORMAL - ${LogText} "Create shortcut: $DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk $INSTDIR\bin\${PRODUCT_EXE_FILE}" + ${LogText} "Create shortcut: $DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk $INSTDIR\bin\${PRODUCT_EXE_FILE}" exe_64: !insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field $secondLauncherShortcut" "State" shortcut_for_exe_64: StrCmp $R2 1 "" add_to_path - CreateShortCut "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER} x64.lnk" \ + CreateShortCut "$DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME} x64.lnk" \ "$INSTDIR\bin\${PRODUCT_EXE_FILE_64}" "" "" "" SW_SHOWNORMAL - ${LogText} "Create shortcut: $DESKTOP\${PRODUCT_FULL_NAME_WITH_VER} x64.lnk $INSTDIR\bin\${PRODUCT_EXE_FILE_64}" + ${LogText} "Create shortcut: $DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME} x64.lnk $INSTDIR\bin\${PRODUCT_EXE_FILE_64}" add_to_path: !insertmacro INSTALLOPTIONS_READ $R0 "Desktop.ini" "Field $addToPath" "State" @@ -1310,10 +1310,10 @@ skip_ipr: ; $STARTMENU_FOLDER stores name of IDEA folder in Start Menu, ; save it name in the "MenuFolder" RegValue CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${PRODUCT_FULL_NAME_WITH_VER}.lnk" \ + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk" \ "$productLauncher" "" "" "" SW_SHOWNORMAL - StrCpy $7 "$SMPROGRAMS\$STARTMENU_FOLDER\${PRODUCT_FULL_NAME_WITH_VER}.lnk" + StrCpy $7 "$SMPROGRAMS\$STARTMENU_FOLDER\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk" ShellLink::GetShortCutWorkingDirectory $7 Pop $0 DetailPrint "ShortCutWorkingDirectory: $0" @@ -1341,7 +1341,7 @@ skip_ipr: ; write uninstaller & add it to add/remove programs in control panel WriteUninstaller "$INSTDIR\bin\Uninstall.exe" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" \ - "DisplayName" "${PRODUCT_FULL_NAME_WITH_VER}" + "DisplayName" "${INSTALL_DIR_AND_SHORTCUT_NAME}" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" \ "UninstallString" "$INSTDIR\bin\Uninstall.exe" WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" \ @@ -1443,7 +1443,7 @@ uac_elevation_aborted: ${LogText} "" ${LogText} " NOTE: UAC elevation has been aborted. Installation dir will be changed." ${LogText} "" - StrCpy $INSTDIR "$LOCALAPPDATA\${MANUFACTURER}\${PRODUCT_WITH_VER}" + StrCpy $INSTDIR "$LOCALAPPDATA\${MANUFACTURER}\${INSTALL_DIR_AND_SHORTCUT_NAME}" goto installdir_is_empty uac_success: StrCmp 1 $3 uac_admin ;Admin? @@ -1453,9 +1453,9 @@ uac_admin: IfSilent uac_all_users set_install_dir_admin_mode set_install_dir_admin_mode: ${If} ${RunningX64} - StrCpy $INSTDIR "$PROGRAMFILES64\${MANUFACTURER}\${PRODUCT_WITH_VER}" + StrCpy $INSTDIR "$PROGRAMFILES64\${MANUFACTURER}\${INSTALL_DIR_AND_SHORTCUT_NAME}" ${Else} - StrCpy $INSTDIR "$PROGRAMFILES\${MANUFACTURER}\${PRODUCT_WITH_VER}" + StrCpy $INSTDIR "$PROGRAMFILES\${MANUFACTURER}\${INSTALL_DIR_AND_SHORTCUT_NAME}" ${EndIf} uac_all_users: SetShellVarContext all @@ -1847,7 +1847,7 @@ Section "Uninstall" StrCmp $3 "" delete_caches shortcuts shortcuts: - StrCpy $7 "$SMPROGRAMS\$3\${PRODUCT_FULL_NAME_WITH_VER}.lnk" + StrCpy $7 "$SMPROGRAMS\$3\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk" Call un.validateStartMenuLinkToLauncher StrCmp $8 "" 0 remove_link DetailPrint "StartMenu: $7 is not point to valid launcher." @@ -1931,13 +1931,13 @@ no_jre32: ; remove desktop shortcuts desktop_shortcut_launcher32: - IfFileExists "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk" 0 desktop_shortcut_launcher64 - DetailPrint "remove desktop shortcut to launcher32: $DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk" - Delete "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk" + IfFileExists "$DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk" 0 desktop_shortcut_launcher64 + DetailPrint "remove desktop shortcut to launcher32: $DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk" + Delete "$DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME}.lnk" desktop_shortcut_launcher64: - IfFileExists "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER} x64.lnk" 0 registry - DetailPrint "remove desktop shortcut to launcher64: $DESKTOP\${PRODUCT_FULL_NAME_WITH_VER} x64.lnk" - Delete "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER} x64.lnk" + IfFileExists "$DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME} x64.lnk" 0 registry + DetailPrint "remove desktop shortcut to launcher64: $DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME} x64.lnk" + Delete "$DESKTOP\${INSTALL_DIR_AND_SHORTCUT_NAME} x64.lnk" registry: StrCpy $0 "SHCTX" diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductProperties.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductProperties.groovy index c7a7bec95ea6..bbbd2ebee386 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductProperties.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductProperties.groovy @@ -162,11 +162,6 @@ abstract class ProductProperties { */ boolean buildSourcesArchive = false - /** - * add product version to root installation folder - */ - boolean includeVersionToInstallDir = true - /** * Specifies how Maven artifacts for IDE modules should be generated, by default no artifacts are generated. */ diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/WindowsDistributionCustomizer.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/WindowsDistributionCustomizer.groovy index 83972139f621..ca068fb228e5 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/WindowsDistributionCustomizer.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/WindowsDistributionCustomizer.groovy @@ -78,6 +78,13 @@ abstract class WindowsDistributionCustomizer { */ String getRootDirectoryName(ApplicationInfoProperties applicationInfo, String buildNumber) { "" } + /** + * Name of the root product windows installation directory and Desktop ShortCut + */ + String getNameForInstallDirAndDesktopShortcut(ApplicationInfoProperties applicationInfo, String buildNumber) { + "${applicationInfo.productName} ${applicationInfo.isEAP ? buildNumber : applicationInfo.fullVersion}" + } + /** * Override this method to copy additional files to Windows distribution of the product. * @param targetDirectory contents of this directory will be packed into zip archive and exe installer, so when the product is installed @@ -89,7 +96,6 @@ abstract class WindowsDistributionCustomizer { * The returned name will be shown in Windows Installer and used in Registry keys */ String getFullNameIncludingEdition(ApplicationInfoProperties applicationInfo) { applicationInfo.productName } - /** * The returned name will be used to create links on Desktop */ diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy index 4ccb7d2764a7..82999aaf37a8 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy @@ -150,9 +150,7 @@ class LinuxDistributionBuilder extends OsSpecificDistributionBuilder { } private void buildTarGz(String jreDirectoryPath, String unixDistPath, String suffix) { - def tarRoot = !buildContext.productProperties.includeVersionToInstallDir ? - buildContext.applicationInfo.productName : - customizer.getRootDirectoryName(buildContext.applicationInfo, buildContext.buildNumber) + def tarRoot = customizer.getRootDirectoryName(buildContext.applicationInfo, buildContext.buildNumber) def baseName = buildContext.productProperties.getBaseArtifactName(buildContext.applicationInfo, buildContext.buildNumber) def tarPath = "${buildContext.paths.artifacts}/${baseName}${suffix}.tar.gz" def paths = [buildContext.paths.distAll, unixDistPath] diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MacDistributionBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MacDistributionBuilder.groovy index c391c71fe6c7..468fd58a30ea 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MacDistributionBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MacDistributionBuilder.groovy @@ -305,8 +305,6 @@ class MacDistributionBuilder extends OsSpecificDistributionBuilder { } static String getZipRoot(BuildContext buildContext, MacDistributionCustomizer customizer) { - !buildContext.productProperties.includeVersionToInstallDir ? - "${buildContext.applicationInfo.productName}.app/Contents" : "${customizer.getRootDirectoryName(buildContext.applicationInfo, buildContext.buildNumber)}/Contents" } diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WinExeInstallerBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WinExeInstallerBuilder.groovy index 4c678a130d15..c358b74616fa 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WinExeInstallerBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WinExeInstallerBuilder.groovy @@ -203,15 +203,15 @@ class WinExeInstallerBuilder { !define SHOULD_SET_DEFAULT_INSTDIR "0" """ - def versionString = !productProperties.includeVersionToInstallDir ? "" : buildContext.applicationInfo.isEAP ? "\${VER_BUILD}" : "\${MUI_VERSION_MAJOR}.\${MUI_VERSION_MINOR}" + def versionString = buildContext.applicationInfo.isEAP ? "\${VER_BUILD}" : "\${MUI_VERSION_MAJOR}.\${MUI_VERSION_MINOR}" + def installDirAndShortcutName = customizer.getNameForInstallDirAndDesktopShortcut(buildContext.applicationInfo, buildContext.buildNumber) new File(box, "nsiconf/version.nsi").text = """ !define MUI_VERSION_MAJOR "${buildContext.applicationInfo.majorVersion}" !define MUI_VERSION_MINOR "${buildContext.applicationInfo.minorVersion}" !define VER_BUILD ${buildContext.buildNumber} - +!define INSTALL_DIR_AND_SHORTCUT_NAME "${installDirAndShortcutName}" !define PRODUCT_WITH_VER "\${MUI_PRODUCT} $versionString" -!define PRODUCT_FULL_NAME_WITH_VER "\${PRODUCT_FULL_NAME} $versionString" !define PRODUCT_PATHS_SELECTOR "${buildContext.systemSelector}" !define PRODUCT_SETTINGS_DIR ".\${PRODUCT_PATHS_SELECTOR}" """