diff --git a/build/conf/nsis/customInstallActions.nsi b/build/conf/nsis/customInstallActions.nsi index 9f6948e6abd1..72db97d6db3c 100644 --- a/build/conf/nsis/customInstallActions.nsi +++ b/build/conf/nsis/customInstallActions.nsi @@ -1,72 +1,9 @@ -!include x64.nsh !define INSTALL_OPTION_ELEMENTS 5 -!define JAVA_REQUIREMENT 1.8 + +Function customPreInstallActions + DetailPrint "There are no custom pre-install actions." +FunctionEnd Function customInstallActions DetailPrint "There are no custom install actions." -FunctionEnd - -Function searchJava64 - StrCpy $0 "HKLM" - StrCpy $1 "Software\JavaSoft\Java Development Kit\${JAVA_REQUIREMENT}" - StrCpy $2 "JavaHome" - SetRegView 64 - call OMReadRegStr - SetRegView 32 - StrCpy $3 "$3\bin\java.exe" - IfFileExists $3 done no_java_64 -no_java_64: - StrCpy $3 "" -done: -FunctionEnd - -Function ConfirmDesktopShortcut - !insertmacro MUI_HEADER_TEXT "$(installation_options)" "$(installation_options_prompt)" - ${StrRep} $0 ${PRODUCT_EXE_FILE} "64.exe" ".exe" - ${If} $0 == ${PRODUCT_EXE_FILE} - StrCpy $R0 "32-bit launcher" - StrCpy $R1 "64-bit launcher" - ${Else} - ;there is only one launcher and it is 64-bit. - StrCpy $R0 "64-bit launcher" - StrCpy $R1 "" - ${EndIf} - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" $R0 - - ${If} $R1 != "" - ${StrRep} $R0 ${PRODUCT_EXE_FILE_64} "64.exe" ".exe" - ${If} $R0 == ${PRODUCT_EXE_FILE} - call searchJava64 - ${If} $3 != "" - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Type" "checkbox" - !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" association 0 - inetc::head /SILENT /TOSTACK ${LINK_TO_JRE64} "" /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)" - ${EndIf} - ${EndIf} - ${EndIf} - ${EndIf} -association: - StrCmp "${ASSOCIATION}" "NoAssociation" skip_association - StrCpy $R0 ${INSTALL_OPTION_ELEMENTS} - push "${ASSOCIATION}" -loop: - call SplitStr - Pop $0 - StrCmp $0 "" done - IntOp $R0 $R0 + 1 - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $R0" "Text" "$0" - goto loop -skip_association: - IntOp $R0 ${INSTALL_OPTION_ELEMENTS} - 1 -done: - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "$R0" - !insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini" FunctionEnd \ No newline at end of file diff --git a/build/conf/nsis/idea.nsi b/build/conf/nsis/idea.nsi index ce78f3050ca0..efc105a95837 100644 --- a/build/conf/nsis/idea.nsi +++ b/build/conf/nsis/idea.nsi @@ -4,6 +4,8 @@ !include "strings.nsi" !include "Registry.nsi" !include "version.nsi" +!include x64.nsh +!define JAVA_REQUIREMENT 1.8 ; Product with version (IntelliJ IDEA #xxxx). @@ -297,6 +299,73 @@ done: Pop $0 FunctionEnd +Function searchJava64 + StrCpy $0 "HKLM" + StrCpy $1 "Software\JavaSoft\Java Development Kit\${JAVA_REQUIREMENT}" + StrCpy $2 "JavaHome" + SetRegView 64 + call OMReadRegStr + SetRegView 32 + StrCpy $3 "$3\bin\java.exe" + IfFileExists $3 done no_java_64 +no_java_64: + StrCpy $3 "" +done: +FunctionEnd + +Function ConfirmDesktopShortcut + !insertmacro MUI_HEADER_TEXT "$(installation_options)" "$(installation_options_prompt)" + ${StrRep} $0 ${PRODUCT_EXE_FILE} "64.exe" ".exe" + ${If} $0 == ${PRODUCT_EXE_FILE} + StrCpy $R0 "32-bit launcher" + StrCpy $R1 "64-bit launcher" + ${Else} + ;there is only one launcher and it is 64-bit. + StrCpy $R0 "64-bit launcher" + StrCpy $R1 "" + ${EndIf} + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" $R0 + + ${If} $R1 != "" + ${StrRep} $R0 ${PRODUCT_EXE_FILE_64} "64.exe" ".exe" + ${If} $R0 == ${PRODUCT_EXE_FILE} + call searchJava64 + ${If} $3 != "" + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Type" "checkbox" + !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 + 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)" + ${EndIf} + ${EndIf} + ${EndIf} + ${EndIf} +customPreActions: + Call customPreInstallActions +association: + StrCmp "${ASSOCIATION}" "NoAssociation" skip_association + StrCpy $R0 ${INSTALL_OPTION_ELEMENTS} + push "${ASSOCIATION}" +loop: + call SplitStr + Pop $0 + StrCmp $0 "" done + IntOp $R0 $R0 + 1 + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $R0" "Text" "$0" + goto loop +skip_association: + IntOp $R0 ${INSTALL_OPTION_ELEMENTS} - 1 +done: + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "$R0" + !insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini" +FunctionEnd + Function downloadJre64 !insertmacro INSTALLOPTIONS_READ $R0 "Desktop.ini" "Field 4" "State" ${If} $R0 == 1 diff --git a/python/educational-python/build/customInstallActions.nsi b/python/educational-python/build/customInstallActions.nsi index dc990cd82c42..f2b596c2b5d0 100644 --- a/python/educational-python/build/customInstallActions.nsi +++ b/python/educational-python/build/customInstallActions.nsi @@ -1,11 +1,48 @@ !include "TextFunc.nsh" -!include x64.nsh - !define INSTALL_OPTION_ELEMENTS 7 !define PYTHON_VERSIONS 4 ${StrTok} +Function customPreInstallActions + IfFileExists "$TEMP\python.txt" deletePythonFileInfo getPythonFileInfo +deletePythonFileInfo: + Delete "$TEMP\python.txt" +getPythonFileInfo: + inetc::get "https://www.jetbrains.com/updates/python.txt" "$TEMP\python.txt" + ${LineSum} "$TEMP\python.txt" $R0 + IfErrors cantOpenFile + StrCmp $R0 ${PYTHON_VERSIONS} getPythonInfo +cantOpenFile: + MessageBox MB_OK|MB_ICONEXCLAMATION "python.txt is not exist. Python will not be downloaded." +removePythonChoice: + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 5" "Flags" "DISABLED" + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 6" "Flags" "DISABLED" + goto done +getPythonInfo: + Call getPythonInfo + StrCmp $0 "Error" removePythonChoice + ;check if pythons are already installed + StrCpy $R2 $0 + Call searchPython + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 5" "Text" "Python $0" + StrCmp $R2 "Absent" checkPython3 + StrCpy $R2 $0 + StrCpy $R4 "Field 5" + StrCpy $R5 "Field 6" + Call updatePythonControls +checkPython3: + StrCpy $R2 $R0 + Call searchPython + !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 6" "Text" "Python $R0" + StrCmp $R2 "Absent" done + StrCpy $R2 $R0 + StrCpy $R4 "Field 6" + StrCpy $R5 "Field 5" + Call updatePythonControls +done: +FunctionEnd + Function customInstallActions ${LineSum} "$TEMP\python.txt" $R0 IfErrors cantOpenFile @@ -52,20 +89,6 @@ python_exists: skip_python_download: FunctionEnd -Function searchJava64 - StrCpy $0 "HKLM" - StrCpy $1 "Software\JavaSoft\Java Development Kit\${JAVA_REQUIREMENT}" - StrCpy $2 "JavaHome" - SetRegView 64 - call OMReadRegStr - SetRegView 32 - StrCpy $3 "$3\bin\java.exe" - IfFileExists $3 done no_java_64 -no_java_64: - StrCpy $3 "" -done: -FunctionEnd - Function updatePythonControls !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" $R4 "Text" "Python $R2 (installed)" !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" $R4 "Flags" "DISABLED" @@ -75,84 +98,6 @@ Function updatePythonControls !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" $R5 "State" "0" FunctionEnd - -Function ConfirmDesktopShortcut - !insertmacro MUI_HEADER_TEXT "$(installation_options)" "$(installation_options_prompt)" - ${StrRep} $0 ${PRODUCT_EXE_FILE} "64.exe" ".exe" - ${If} $0 == ${PRODUCT_EXE_FILE} - StrCpy $R0 "32-bit launcher" - StrCpy $R1 "64-bit launcher" - ${Else} - ;there is only one launcher and it is 64-bit. - StrCpy $R0 "64-bit launcher" - StrCpy $R1 "" - ${EndIf} - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" $R0 - - ${If} $R1 != "" - ${StrRep} $R0 ${PRODUCT_EXE_FILE_64} "64.exe" ".exe" - ${If} $R0 == ${PRODUCT_EXE_FILE} - call searchJava64 - ${If} $3 != "" - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Type" "checkbox" - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Text" $R1 - ${EndIf} - ${EndIf} - ${EndIf} - IfFileExists "$TEMP\python.txt" deletePythonFileInfo getPythonFileInfo -deletePythonFileInfo: - Delete "$TEMP\python.txt" -getPythonFileInfo: - inetc::get "https://www.jetbrains.com/updates/python.txt" "$TEMP\python.txt" - ${LineSum} "$TEMP\python.txt" $R0 - IfErrors cantOpenFile - StrCmp $R0 ${PYTHON_VERSIONS} getPythonInfo -cantOpenFile: - MessageBox MB_OK|MB_ICONEXCLAMATION "python.txt is not exist. Python will not be downloaded." -removePythonChoice: - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 5" "Flags" "DISABLED" - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 6" "Flags" "DISABLED" - goto association -getPythonInfo: - Call getPythonInfo - StrCmp $0 "Error" removePythonChoice - ;check if pythons are already installed - StrCpy $R2 $0 - Call searchPython - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 5" "Text" "Python $0" - StrCmp $R2 "Absent" checkPython3 - StrCpy $R2 $0 - StrCpy $R4 "Field 5" - StrCpy $R5 "Field 6" - Call updatePythonControls -checkPython3: - StrCpy $R2 $R0 - Call searchPython - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 6" "Text" "Python $R0" - StrCmp $R2 "Absent" association - StrCpy $R2 $R0 - StrCpy $R4 "Field 6" - StrCpy $R5 "Field 5" - Call updatePythonControls -association: - StrCmp "${ASSOCIATION}" "NoAssociation" skip_association - StrCpy $R0 ${INSTALL_OPTION_ELEMENTS} - push "${ASSOCIATION}" -loop: - call SplitStr - Pop $0 - StrCmp $0 "" done - IntOp $R0 $R0 + 1 - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $R0" "Text" "$0" - goto loop -skip_association: - IntOp $R0 ${INSTALL_OPTION_ELEMENTS} - 1 -done: - !insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Settings" "NumFields" "$R0" - !insertmacro INSTALLOPTIONS_DISPLAY "Desktop.ini" -FunctionEnd - - Function getPythonInfo ClearErrors FileOpen $3 $Temp\python.txt r @@ -179,7 +124,6 @@ cantOpenFile: done: FunctionEnd - Function searchPython ;$R2 - version of python ReadRegStr $1 "HKCU" "Software\Python\PythonCore\$R2\InstallPath" ""