mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-14908IDEA-149511 Add jre64 to IDEA bundle
This commit is contained in:
@@ -1,8 +1,73 @@
|
||||
!define INSTALL_OPTION_ELEMENTS 4
|
||||
!include x64.nsh
|
||||
!define INSTALL_OPTION_ELEMENTS 5
|
||||
!define JAVA_REQUIREMENT 1.8
|
||||
!define BINTRAY "https://bintray.com/jetbrains/intellij-jdk"
|
||||
!define JETBRAINS "https://download.jetbrains.com"
|
||||
Var linkToJre64
|
||||
|
||||
; This function does a case sensitive searches for an occurrence of a substring in a string.
|
||||
; It returns the substring if it is found.
|
||||
; Otherwise it returns null("").
|
||||
; http://nsis.sourceforge.net/StrContains
|
||||
!macro _StrContainsConstructor OUT NEEDLE HAYSTACK
|
||||
Push `${HAYSTACK}`
|
||||
Push `${NEEDLE}`
|
||||
Call StrContains
|
||||
Pop `${OUT}`
|
||||
!macroend
|
||||
!define StrContains '!insertmacro "_StrContainsConstructor"'
|
||||
|
||||
Var STR_HAYSTACK
|
||||
Var STR_NEEDLE
|
||||
Var STR_CONTAINS_VAR_1
|
||||
Var STR_CONTAINS_VAR_2
|
||||
Var STR_CONTAINS_VAR_3
|
||||
Var STR_CONTAINS_VAR_4
|
||||
Var STR_RETURN_VAR
|
||||
|
||||
Function StrContains
|
||||
Exch $STR_NEEDLE
|
||||
Exch 1
|
||||
Exch $STR_HAYSTACK
|
||||
; Uncomment to debug
|
||||
; MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
|
||||
StrCpy $STR_RETURN_VAR ""
|
||||
StrCpy $STR_CONTAINS_VAR_1 -1
|
||||
StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
|
||||
StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
|
||||
loop:
|
||||
IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
|
||||
StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
|
||||
StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
|
||||
StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $STR_RETURN_VAR $STR_NEEDLE
|
||||
Goto done
|
||||
done:
|
||||
Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
|
||||
Exch $STR_RETURN_VAR
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function customInstallActions
|
||||
DetailPrint "There are no custom install actions."
|
||||
!insertmacro INSTALLOPTIONS_READ $R0 "Desktop.ini" "Field 4" "State"
|
||||
${If} $R0 == 1
|
||||
inetc::get $linkToJre64 "$TEMP\jre64.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"
|
||||
${Else}
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "The $linkToJre64 download is failed: $0"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
done:
|
||||
FunctionEnd
|
||||
|
||||
Function searchJava64
|
||||
@@ -39,9 +104,28 @@ Function ConfirmDesktopShortcut
|
||||
${If} $3 != ""
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Type" "checkbox"
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Text" $R1
|
||||
; if 64-bit Win OS and jre64 for the build is available then add checkbox to Installation Options dialog
|
||||
${If} ${RunningX64}
|
||||
${GetParameters} $R0
|
||||
ClearErrors
|
||||
${GetOptions} $R0 "jre64=" $R1
|
||||
${IfNot} ${Errors}
|
||||
call ValidateLinkToJre64
|
||||
StrCmp $0 "OK" addCheckBoxToDialog
|
||||
${EndIf}
|
||||
StrCmp "${LINK_TO_JRE64}" "null" association 0
|
||||
StrCpy $R1 ${LINK_TO_JRE64}
|
||||
call ValidateLinkToJre64
|
||||
${If} $0 == "OK"
|
||||
addCheckBoxToDialog:
|
||||
!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)"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
association:
|
||||
StrCmp "${ASSOCIATION}" "NoAssociation" skip_association
|
||||
StrCpy $R0 ${INSTALL_OPTION_ELEMENTS}
|
||||
push "${ASSOCIATION}"
|
||||
@@ -58,3 +142,17 @@ done:
|
||||
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "$R0"
|
||||
!insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini"
|
||||
FunctionEnd
|
||||
|
||||
Function ValidateLinkToJre64
|
||||
${StrContains} $R0 ${JETBRAINS} $R1
|
||||
StrCmp $R0 "" 0 checkIfFileExists
|
||||
${StrContains} $R0 ${BINTRAY} $R1
|
||||
${If} $R0 != ""
|
||||
checkIfFileExists:
|
||||
StrCpy $linkToJre64 $R1
|
||||
inetc::head /SILENT /TOSTACK $linkToJRE64 "" /END
|
||||
Pop $0
|
||||
${Else}
|
||||
StrCpy $linkToJre64 ""
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
@@ -27,6 +27,15 @@ Text=""
|
||||
State=0
|
||||
|
||||
[Field 4]
|
||||
Type=Label
|
||||
Text=""
|
||||
Left=5
|
||||
Right=-1
|
||||
Top=123
|
||||
Bottom=133
|
||||
State=0
|
||||
|
||||
[Field 5]
|
||||
Type=GroupBox
|
||||
Left=1
|
||||
Right=-1
|
||||
@@ -34,7 +43,7 @@ Top=45
|
||||
Bottom=75
|
||||
Text=Create associations
|
||||
|
||||
[Field 5]
|
||||
[Field 6]
|
||||
Type=checkbox
|
||||
Left=5
|
||||
Right=45
|
||||
@@ -42,7 +51,7 @@ Top=60
|
||||
Bottom=70
|
||||
State=0
|
||||
|
||||
[Field 6]
|
||||
[Field 7]
|
||||
Type=checkbox
|
||||
Left=50
|
||||
Right=90
|
||||
@@ -50,7 +59,7 @@ Top=60
|
||||
Bottom=70
|
||||
State=0
|
||||
|
||||
[Field 7]
|
||||
[Field 8]
|
||||
Type=checkbox
|
||||
Left=95
|
||||
Right=135
|
||||
@@ -58,7 +67,7 @@ Top=60
|
||||
Bottom=70
|
||||
State=0
|
||||
|
||||
[Field 8]
|
||||
[Field 9]
|
||||
Type=checkbox
|
||||
Left=140
|
||||
Right=180
|
||||
@@ -66,7 +75,7 @@ Top=60
|
||||
Bottom=70
|
||||
State=0
|
||||
|
||||
[Field 9]
|
||||
[Field 10]
|
||||
Type=checkbox
|
||||
Left=185
|
||||
Right=225
|
||||
@@ -74,7 +83,7 @@ Top=60
|
||||
Bottom=70
|
||||
State=0
|
||||
|
||||
[Field 10]
|
||||
[Field 11]
|
||||
Type=checkbox
|
||||
Left=230
|
||||
Right=270
|
||||
|
||||
@@ -80,10 +80,7 @@ class IdeaCommunityProperties extends BaseIdeaProperties {
|
||||
}
|
||||
|
||||
@Override
|
||||
String linkToJRE64(BuildContext buildContext) {
|
||||
def versionString = buildContext.productProperties.baseArtifactName(buildContext.applicationInfo, buildContext.buildNumber)
|
||||
return "https://download.jetbrains.com/idea/jre64-for-${versionString}.tar.gz"
|
||||
}
|
||||
String getLinkToJre64() { "https://download.jetbrains.com/idea" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -99,10 +99,9 @@ abstract class WindowsDistributionCustomizer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to a JetBrains JRE64 which is used by windows installation.
|
||||
* JRE64 will be install (optional) together with JRE x86 (not replace).
|
||||
* Link to tar.gz archive of JetBrains JRE 64-bit for windows.
|
||||
* The archive 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.
|
||||
*/
|
||||
String linkToJRE64(BuildContext buildContext) {
|
||||
return null
|
||||
}
|
||||
String getLinkToJre64() { return null }
|
||||
}
|
||||
|
||||
+13
-1
@@ -65,6 +65,18 @@ class BundledJreManager {
|
||||
return findJreArchive("mac")?.absolutePath
|
||||
}
|
||||
|
||||
/**
|
||||
* Return path to a .tar.gz archive containing distribution of JRE for Win OS which will be bundled with the product
|
||||
*/
|
||||
String findWinJreArchive() {
|
||||
return findJreArchive("win")?.absolutePath
|
||||
}
|
||||
|
||||
String archiveNameJre64(BuildContext buildContext) {
|
||||
return "jre64-for-${buildContext.productProperties.baseArtifactName(buildContext.applicationInfo, buildContext.buildNumber)}.tar.gz"
|
||||
}
|
||||
|
||||
|
||||
@CompileDynamic
|
||||
private String extractJre(String osDirName, JvmArchitecture arch = JvmArchitecture.x64, JreVendor vendor = JreVendor.JetBrains) {
|
||||
String vendorSuffix = vendor == JreVendor.Oracle ? ".oracle" : ""
|
||||
@@ -98,7 +110,7 @@ class BundledJreManager {
|
||||
return targetDir
|
||||
}
|
||||
|
||||
File findJreArchive(String osDirName, JvmArchitecture arch = JvmArchitecture.x64, JreVendor vendor = JreVendor.JetBrains) {
|
||||
private File findJreArchive(String osDirName, JvmArchitecture arch = JvmArchitecture.x64, JreVendor vendor = JreVendor.JetBrains) {
|
||||
def jdkDir = new File(buildContext.paths.projectHome, "build/jdk/$osDirName")
|
||||
String suffix = arch == JvmArchitecture.x32 ? "_x86" : "_x64"
|
||||
String prefix = buildContext.productProperties.toolsJarRequired ? vendor.jreWithToolsJarNamePrefix : vendor.jreNamePrefix
|
||||
|
||||
+4
-1
@@ -131,6 +131,9 @@ class WinExeInstallerBuilder {
|
||||
|
||||
def extensionsList = customizer.fileAssociations
|
||||
def fileAssociations = extensionsList.isEmpty() ? "NoAssociation" : extensionsList.join(",")
|
||||
def linkToJre64 = customizer.getLinkToJre64() != null ?
|
||||
"${customizer.getLinkToJre64()}/${buildContext.bundledJreManager.archiveNameJre64(buildContext)}" :
|
||||
null
|
||||
new File(box, "nsiconf/strings.nsi").text = """
|
||||
!define MANUFACTURER "${buildContext.applicationInfo.shortCompanyName}"
|
||||
!define MUI_PRODUCT "${customizer.fullNameIncludingEdition(buildContext.applicationInfo)}"
|
||||
@@ -143,7 +146,7 @@ class WinExeInstallerBuilder {
|
||||
!define PRODUCT_HEADER_FILE "headerlogo.bmp"
|
||||
!define ASSOCIATION "$fileAssociations"
|
||||
!define UNINSTALL_WEB_PAGE "${customizer.uninstallFeedbackPageUrl(buildContext.applicationInfo) ?: "feedback_web_page"}"
|
||||
!define LINK_TO_JRE64 "${customizer.linkToJRE64(buildContext)}"
|
||||
!define LINK_TO_JRE64 "$linkToJre64"
|
||||
|
||||
; 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
|
||||
|
||||
+2
-4
@@ -85,12 +85,10 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder {
|
||||
List<String> jreDirectoryPaths = [jreDirectoryPath];
|
||||
|
||||
if (customizer.buildZipArchive) {
|
||||
if (customizer.linkToJRE64(buildContext) != null && arch != JvmArchitecture.x64) {
|
||||
if (customizer.getLinkToJre64() != null && arch != JvmArchitecture.x64) {
|
||||
File archive = buildContext.bundledJreManager.findJreArchive("win")
|
||||
if (archive != null) {
|
||||
//do copy of JRE64 archive
|
||||
def versionString = buildContext.productProperties.baseArtifactName(buildContext.applicationInfo, buildContext.buildNumber)
|
||||
buildContext.ant.copy(file: archive, tofile: "${buildContext.paths.artifacts}/jre64-for-${versionString}.tar.gz", overwrite: "true")
|
||||
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()) {
|
||||
|
||||
Reference in New Issue
Block a user