build scripts: create 32-BIT 11 JBR archive for windows which can be downloaded during installation.

IDEA-206343 [JRE 11 installers] There is suggestion to download jre for 32bit launchers, but it is jre 8

GitOrigin-RevId: b800dba3178637da1a1acea9aaee1c6630150c26
This commit is contained in:
Vladimir.Orlov
2019-12-23 11:04:38 +00:00
committed by intellij-monorepo-bot
parent 7b78dd567f
commit f77341ddf1
6 changed files with 49 additions and 26 deletions
Binary file not shown.
Binary file not shown.
+3 -2
View File
@@ -41,9 +41,10 @@ static def splitJreBuild(String jreBuild, String version) {
def createJbreTasks(String defaultBuild, int version, String targetOs, String prefix = null) {
def isModular = version >= 9
def is32bitSupported = version <= 11
if (prefix == null) prefix = isModular ? 'jbr-' : 'jbrx-'
jrePlatformsToDownload(targetOs).each { platform ->
archToDownload(platform, !isModular).each { arch ->
archToDownload(platform, is32bitSupported).each { arch ->
def jreBuild = project.ext.has("jreBuild_$platform") ? project.ext["jreBuild_$platform"] : defaultBuild
def (update, buildNumber) = splitJreBuild(jreBuild.toString(), version.toString())
def jbrxArtifactName = "$prefix$update-$platform-$arch-$buildNumber".toString()
@@ -179,5 +180,5 @@ static def jrePlatformsToDownload(targetOs) {
}
static def archToDownload(platform, is32BitArchSupported) {
is32BitArchSupported && platform == 'windows' ? ['i586', 'x64'] : ['x64']
is32BitArchSupported && platform == 'windows' ? ['x86', 'x64'] : ['x64']
}
+7 -17
View File
@@ -32,7 +32,7 @@ volatile bool terminating = false;
volatile int hookExitCode = 0;
//tools.jar doesn't exist in jdk 9 and later. So check it for jdk 1.8 only.
bool toolsArchiveExists = true;
bool toolsArchiveExists = false;
HANDLE hFileMapping;
HANDLE hEvent;
@@ -85,9 +85,11 @@ bool Is64BitJRE(const char* path)
{
std::string cfgPath(path);
std::string cfgJava9Path(path);
std::string accessbridgeVersion(path);
cfgPath += "\\lib\\amd64\\jvm.cfg";
cfgJava9Path += "\\lib\\jvm.cfg";
return FileExists(cfgPath) || FileExists(cfgJava9Path);
accessbridgeVersion += "\\bin\\windowsaccessbridge-32.dll";
return FileExists(cfgPath) || (FileExists(cfgJava9Path) && !FileExists(accessbridgeVersion));
}
bool FindValidJVM(const char* path)
@@ -231,34 +233,22 @@ bool FindJVMInRegistry()
{
#ifndef _M_X64
if (FindJVMInRegistryWithVersion("1.8", true))
toolsArchiveExists = true;
return true;
if (FindJVMInRegistryWithVersion("9", true))
toolsArchiveExists = false;
return true;
if (FindJVMInRegistryWithVersion("10", true))
toolsArchiveExists = false;
return true;
//obsolete java versions
if (FindJVMInRegistryWithVersion("1.7", true))
return true;
if (FindJVMInRegistryWithVersion("1.6", true))
return true;
#endif
if (FindJVMInRegistryWithVersion("1.8", false))
toolsArchiveExists = true;
return true;
if (FindJVMInRegistryWithVersion("9", false))
toolsArchiveExists = false;
return true;
if (FindJVMInRegistryWithVersion("10", false))
toolsArchiveExists = false;
return true;
//obsolete java versions
if (FindJVMInRegistryWithVersion("1.7", false))
return true;
if (FindJVMInRegistryWithVersion("1.6", false))
if (FindJVMInRegistryWithVersion("11", false))
return true;
return false;
}
@@ -56,13 +56,13 @@ class BundledJreManager {
return extractJre(OsFamily.ALL.find { it.jbrArchiveSuffix == osName })
}
String extractJre(OsFamily os) {
String targetDir = "$baseDirectoryForJre/secondJre.${os.jbrArchiveSuffix}_${JvmArchitecture.x64}"
String extractJre(OsFamily os, JvmArchitecture arch = JvmArchitecture.x64) {
String targetDir = "$baseDirectoryForJre/secondJre.${os.jbrArchiveSuffix}_$arch"
if (new File(targetDir).exists()) {
buildContext.messages.info("JRE is already extracted to $targetDir")
return targetDir
}
File archive = findArchive(os, getJreBuild(os), getJreVersion(), jrePrefix(), JvmArchitecture.x64)
File archive = findArchive(os, getJreBuild(os), getJreVersion(), jrePrefix(), arch)
if (archive == null) {
return null
}
@@ -72,6 +72,20 @@ class BundledJreManager {
if (destinationDir.exists()) destinationDir.deleteDir()
untar(archive, destination, isBundledJreModular())
}
if (arch == JvmArchitecture.x32) {
File archiveX32 = findArchive(os, getJreBuild(os), getJreVersion(), jrePrefix(), JvmArchitecture.x32)
if (archiveX32.exists()) {
buildContext.messages.block("Extract $archiveX32.name jre32") {
String destination = "$targetDir/jbr"
if (os == OsFamily.WINDOWS) {
destination = "$targetDir/jre32"
}
buildContext.messages.progress("Extracting JRE from '$archiveX32.name' archive to $destination")
untar(archiveX32, destination, false)
}
}
}
return targetDir
}
@@ -199,7 +213,7 @@ class BundledJreManager {
// [11, b96]
(update, build) = [version.toString(), jreBuild]
}
"${update}-${os.jbrArchiveSuffix}-${arch == JvmArchitecture.x32 ? 'i586' : 'x64'}-${build}.tar.gz"
"${update}-${os.jbrArchiveSuffix}-${arch == JvmArchitecture.x32 ? 'x86' : 'x64'}-${build}.tar.gz"
}
private File findSecondBundledJreArchive(OsFamily os, JvmArchitecture arch = JvmArchitecture.x64) {
@@ -272,6 +286,10 @@ class BundledJreManager {
return buildContext.options.bundledJreVersion >= 9
}
boolean is32JreSupported() {
return buildContext.options.bundledJreVersion <= 11
}
/**
* If {@code true} then second bundled JRE version is 9+
*/
@@ -72,6 +72,7 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder {
void buildArtifacts(String winDistPath) {
def jreSuffix = buildContext.bundledJreManager.secondJreSuffix()
String jreDirectoryPath64 = null
String jreDirectoryPath = null
//do not include win32 launcher into winzip with 9+ jbr bundled
List<String> excludeList = ["bin/${buildContext.productProperties.baseFileName}.exe", "bin/${buildContext.productProperties.baseFileName}.exe.vmoptions"]
if (buildContext.bundledJreManager.doBundleSecondJre()) {
@@ -82,7 +83,7 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder {
File archive = buildContext.bundledJreManager.findSecondBundledJreArchiveForWin(JvmArchitecture.x32)
if (archive != null && archive.exists()) {
//prepare folder with jre x86 for win archive
def jreDirectoryPath = buildContext.bundledJreManager.extractSecondBundledJreForWin(JvmArchitecture.x32)
jreDirectoryPath = buildContext.bundledJreManager.extractSecondBundledJreForWin(JvmArchitecture.x32)
buildContext.ant.tar(tarfile: "${buildContext.paths.artifacts}/${buildContext.bundledJreManager.archiveNameJre(buildContext)}", longfile: "gnu", compression: "gzip") {
tarfileset(dir: "${jreDirectoryPath}/jre32") {
include(name: "**/**")
@@ -96,7 +97,20 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder {
}
}
def jreDirectoryPath = buildContext.bundledJreManager.extractJre(OsFamily.WINDOWS)
if (customizer.getBaseDownloadUrlForJre() != null) {
File archive = buildContext.bundledJreManager.findJreArchive(OsFamily.WINDOWS,JvmArchitecture.x32)
if (archive != null && archive.exists()) {
//prepare folder with jre x86 for win archive
jreDirectoryPath = buildContext.bundledJreManager.extractJre(OsFamily.WINDOWS, JvmArchitecture.x32)
buildContext.ant.tar(tarfile: "${buildContext.paths.artifacts}/${buildContext.bundledJreManager.archiveNameJre(buildContext)}", longfile: "gnu", compression: "gzip") {
tarfileset(dir: "${jreDirectoryPath}/jre32") {
include(name: "**/**")
}
}
}
}
jreDirectoryPath = buildContext.bundledJreManager.extractJre(OsFamily.WINDOWS)
if (customizer.buildZipArchive) {
buildWinZip([jreDirectoryPath], ".win", winDistPath, excludeList)
}
@@ -114,7 +128,7 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder {
generateProductJson(productJsonDir, jreDirectoryPath != null)
new ProductInfoValidator(buildContext).validateInDirectory(productJsonDir, "", [winDistPath, jreDirectoryPath], [])
new WinExeInstallerBuilder(buildContext, customizer, jreDirectoryPath)
.buildInstaller(winDistPath, productJsonDir, '', !buildContext.bundledJreManager.bundledJreModular)
.buildInstaller(winDistPath, productJsonDir, '', buildContext.bundledJreManager.is32JreSupported())
}
}