From 075a96e71c24d24a2c94302e1ab60681fc55439d Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Fri, 16 Dec 2016 14:56:02 +0300 Subject: [PATCH] IDEA-165217 Make IntelliJ IDEA and all IntelliJ-based products run in x64 mode for Windows Build scripts and installation: 1. rename bundled jre folder to jre64. 2. build new artifact jre-for-*.tar.gz with jre x86 3. not build jre64-for-*.tar.gz anymore 4. download archive with jre x86 during installation (optional) --- build/conf/nsis/idea.nsi | 34 +++++++++---------- .../build/IdeaCommunityProperties.groovy | 2 +- .../WindowsDistributionCustomizer.groovy | 10 +++--- .../build/impl/BundledJreManager.groovy | 7 ++-- .../build/impl/WinExeInstallerBuilder.groovy | 6 ++-- .../impl/WindowsDistributionBuilder.groovy | 21 +++++------- 6 files changed, 39 insertions(+), 41 deletions(-) diff --git a/build/conf/nsis/idea.nsi b/build/conf/nsis/idea.nsi index ec9ac95d255b..c8cbea88a2e6 100644 --- a/build/conf/nsis/idea.nsi +++ b/build/conf/nsis/idea.nsi @@ -335,13 +335,13 @@ Function ConfirmDesktopShortcut !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Text" $R1 ${EndIf} ${If} ${RunningX64} - ; if 64-bit Win OS and jre64 for the build is available then add checkbox to Installation Options dialog - StrCmp "${LINK_TO_JRE64}" "null" customPreActions 0 - inetc::head /SILENT /TOSTACK ${LINK_TO_JRE64} "" /END + ; if jre x86 for the build is available then add checkbox to Installation Options dialog + StrCmp "${LINK_TO_JRE}" "null" customPreActions 0 + inetc::head /SILENT /TOSTACK ${LINK_TO_JRE} "" /END Pop $0 ${If} $0 == "OK" !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 4" "Type" "checkbox" - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 4" "Text" "Download and install 64-bit JRE by JetBrains (will be used with 64-bit launcher)" + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 4" "Text" "Download and install x86 JRE by JetBrains" ${EndIf} ${EndIf} ${EndIf} @@ -366,21 +366,21 @@ done: !insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini" FunctionEnd -Function downloadJre64 +Function downloadJre !insertmacro INSTALLOPTIONS_READ $R0 "Desktop.ini" "Field 4" "State" ${If} $R0 == 1 - inetc::get ${LINK_TO_JRE64} "$TEMP\jre64.tar.gz" /END + inetc::get ${LINK_TO_JRE} "$TEMP\jre.tar.gz" /END Pop $0 ${If} $0 == "OK" - untgz::extract "-d" "$INSTDIR\jre64" "$TEMP\jre64.tar.gz" - StrCmp $R0 "success" removeTempJre64 - DetailPrint "Failed to extract jre64.tar.gz" - MessageBox MB_OK|MB_ICONEXCLAMATION|MB_DEFBUTTON1 "Failed to extract $TEMP\jre64.tar.gz" -removeTempJre64: - IfFileExists "$TEMP\jre64.tar.gz" 0 done - Delete "$TEMP\jre64.tar.gz" + untgz::extract "-d" "$INSTDIR\jre" "$TEMP\jre.tar.gz" + StrCmp $R0 "success" removeTempJre + DetailPrint "Failed to extract jre.tar.gz" + MessageBox MB_OK|MB_ICONEXCLAMATION|MB_DEFBUTTON1 "Failed to extract $TEMP\jre.tar.gz" +removeTempJre: + IfFileExists "$TEMP\jre.tar.gz" 0 done + Delete "$TEMP\jre.tar.gz" ${Else} - MessageBox MB_OK|MB_ICONEXCLAMATION "The ${LINK_TO_JRE64} download is failed: $0" + MessageBox MB_OK|MB_ICONEXCLAMATION "The ${LINK_TO_JRE} download is failed: $0" ${EndIf} ${EndIf} done: @@ -778,9 +778,9 @@ FunctionEnd ;------------------------------------------------------------------------------ Section "IDEA Files" CopyIdeaFiles - ;download and install JRE 64 - StrCmp "${LINK_TO_JRE64}" "null" shortcuts 0 - Call downloadJre64 + StrCmp "${LINK_TO_JRE}" "null" shortcuts 0 + ;download and install JRE x86 + Call downloadJre shortcuts: ;create shortcuts diff --git a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy index d24522470c5d..c041315a06bb 100644 --- a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy +++ b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy @@ -80,7 +80,7 @@ class IdeaCommunityProperties extends BaseIdeaProperties { } @Override - String getBaseDownloadUrlForJre64() { "https://download.jetbrains.com/idea" } + String getBaseDownloadUrlForJre() { "https://download.jetbrains.com/idea" } } } 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 0b38ef538821..de0969b3525a 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/WindowsDistributionCustomizer.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/WindowsDistributionCustomizer.groovy @@ -99,10 +99,10 @@ abstract class WindowsDistributionCustomizer { } /** - * The returned string is base part of a Url to tar.gz archive of JetBrains JRE 64-bit for windows. - * The URL composed from two parts. The described base part and archive name (is generated by BundledJreManager.archiveNameJre64). - * The Url is used by windows installer to download and install JRE 64-bit. - * If the option is chosen by user JRE x86 and 64-bit will be install together. + * The returned string is base part of a Url to tar.gz archive of JetBrains JRE x86 for windows. + * The URL composed from two parts. The described base part and archive name (is generated by BundledJreManager.archiveNameJre). + * The Url is used by windows installer to download and install JRE x86. + * If the option is chosen by user JRE 64-bit and x86 will be install together. */ - String getBaseDownloadUrlForJre64() { return null } + String getBaseDownloadUrlForJre() { return null } } diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BundledJreManager.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BundledJreManager.groovy index 78d894519911..1d9bac181878 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BundledJreManager.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BundledJreManager.groovy @@ -72,8 +72,8 @@ class BundledJreManager { return findJreArchive("win") } - String archiveNameJre64(BuildContext buildContext) { - return "jre64-for-${buildContext.productProperties.getBaseArtifactName(buildContext.applicationInfo, buildContext.buildNumber)}.tar.gz" + String archiveNameJre(BuildContext buildContext) { + return "jre-for-${buildContext.productProperties.getBaseArtifactName(buildContext.applicationInfo, buildContext.buildNumber)}.tar.gz" } @@ -92,6 +92,9 @@ class BundledJreManager { } buildContext.messages.block("Extract $archive.name JRE") { String destination = "$targetDir/jre" + if (osDirName == "win" && arch == JvmArchitecture.x64) { + destination += "64" + } buildContext.messages.progress("Extracting JRE from '$archive.name' archive") if (SystemInfo.isWindows) { buildContext.ant.untar(src: archive.absolutePath, dest: destination, compression: 'gzip') 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 8b46f59d07f2..7ab700cc690b 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 @@ -131,8 +131,8 @@ class WinExeInstallerBuilder { def extensionsList = customizer.fileAssociations def fileAssociations = extensionsList.isEmpty() ? "NoAssociation" : extensionsList.join(",") - def linkToJre64 = customizer.getBaseDownloadUrlForJre64() != null ? - "${customizer.getBaseDownloadUrlForJre64()}/${buildContext.bundledJreManager.archiveNameJre64(buildContext)}" : + def linkToJre = customizer.getBaseDownloadUrlForJre() != null ? + "${customizer.getBaseDownloadUrlForJre()}/${buildContext.bundledJreManager.archiveNameJre(buildContext)}" : null new File(box, "nsiconf/strings.nsi").text = """ !define MANUFACTURER "${buildContext.applicationInfo.shortCompanyName}" @@ -146,7 +146,7 @@ class WinExeInstallerBuilder { !define PRODUCT_HEADER_FILE "headerlogo.bmp" !define ASSOCIATION "$fileAssociations" !define UNINSTALL_WEB_PAGE "${customizer.getUninstallFeedbackPageUrl(buildContext.applicationInfo) ?: "feedback_web_page"}" -!define LINK_TO_JRE64 "$linkToJre64" +!define LINK_TO_JRE "$linkToJre" ; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered IDE build has been installed ; set to 1 for release build diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WindowsDistributionBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WindowsDistributionBuilder.groovy index 7a430f1828bd..3022360b240c 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WindowsDistributionBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/WindowsDistributionBuilder.groovy @@ -81,21 +81,16 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder { @Override void buildArtifacts(String winDistPath) { def arch = customizer.bundledJreArchitecture - def jreDirectoryPath = arch != null ? buildContext.bundledJreManager.extractWinJre(arch) : null - List jreDirectoryPaths = [jreDirectoryPath]; + def jreDirectoryPath64 = arch != null ? buildContext.bundledJreManager.extractWinJre(arch) : null + List jreDirectoryPaths = [jreDirectoryPath64]; - if (customizer.getBaseDownloadUrlForJre64() != null && arch != JvmArchitecture.x64) { + if (customizer.getBaseDownloadUrlForJre() != null && arch != JvmArchitecture.x32) { File archive = buildContext.bundledJreManager.findWinJreArchive() if (archive != null && archive.exists()) { - buildContext.ant.copy(file: archive, tofile: "${buildContext.paths.artifacts}/${buildContext.bundledJreManager.archiveNameJre64(buildContext)}", overwrite: "true") - //prepare JRE64 folder for win archive - def jreDirectoryPath64 = buildContext.bundledJreManager.extractWinJre(JvmArchitecture.x64) - if (! new File("${jreDirectoryPath64}/jre64").exists()) { - buildContext.ant.move(todir: "${jreDirectoryPath64}/jre64") { - fileset(dir: "${jreDirectoryPath64}/jre") - } - } - jreDirectoryPaths = [jreDirectoryPath, jreDirectoryPath64]; + buildContext.ant.copy(file: archive, tofile: "${buildContext.paths.artifacts}/${buildContext.bundledJreManager.archiveNameJre(buildContext)}", overwrite: "true") + //prepare folder with jre x86 for win archive + def jreDirectoryPath = buildContext.bundledJreManager.extractWinJre(JvmArchitecture.x32) + jreDirectoryPaths = [jreDirectoryPath64, jreDirectoryPath]; } } @@ -114,7 +109,7 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder { } buildContext.executeStep("Build Windows Exe Installer", BuildOptions.WINDOWS_EXE_INSTALLER_STEP) { - new WinExeInstallerBuilder(buildContext, customizer, jreDirectoryPath).buildInstaller(winDistPath) + new WinExeInstallerBuilder(buildContext, customizer, jreDirectoryPath64).buildInstaller(winDistPath) } }