Skip to content

Commit

Permalink
[576898] Support a native installer for macosx aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Oct 26, 2021
1 parent 2bf5360 commit 5feb93d
Show file tree
Hide file tree
Showing 32 changed files with 357 additions and 115 deletions.
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.base/META-INF/MANIFEST.MF
Expand Up @@ -15,6 +15,6 @@ Export-Package: org.eclipse.oomph.base;version="1.15.0";x-internal:=true,
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.ecore.xmi;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
org.eclipse.oomph.util;bundle-version="[1.16.0,2.0.0)";visibility:=reexport
org.eclipse.oomph.util;bundle-version="[1.17.0,2.0.0)";visibility:=reexport
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: org.eclipse.oomph.base
@@ -1,13 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.oomph.extractor.lib.tests
Bundle-Version: 1.6.0.qualifier
Bundle-Version: 1.7.0.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Export-Package: org.eclipse.oomph.extractor.lib.tests;version="1.6.0"
Require-Bundle: org.eclipse.oomph.extractor.lib;bundle-version="[1.5.0,2.0.0)",
Export-Package: org.eclipse.oomph.extractor.lib.tests;version="1.7.0"
Require-Bundle: org.eclipse.oomph.extractor.lib;bundle-version="[1.9.0,2.0.0)",
org.junit;bundle-version="[4.0.0,5.0.0)"
Automatic-Module-Name: org.eclipse.oomph.extractor.lib.tests
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.extractor.lib.tests/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.extractor.lib.tests</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.7.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -24,6 +24,11 @@ public static void main(String[] args) throws Exception
System.out.println("minor: " + jre.getMinor());
System.out.println("micro: " + jre.getMicro());
System.out.println("bitness: " + jre.getBitness());
System.out.println("home: " + jre.getJavaHome());
System.out.println("arch: " + jre.getArch());

System.out.println();
System.out.println("jre: " + jre);

System.out.println();
System.out.println(new JREData().satisfies(new JREData(1, 6, 0, 32)));
Expand Down
4 changes: 2 additions & 2 deletions plugins/org.eclipse.oomph.extractor.lib/META-INF/MANIFEST.MF
@@ -1,11 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.oomph.extractor.lib
Bundle-Version: 1.8.0.qualifier
Bundle-Version: 1.9.0.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JRE-1.1
Bundle-ClassPath: .
Export-Package: org.eclipse.oomph.extractor.lib;version="1.8.0"
Export-Package: org.eclipse.oomph.extractor.lib;version="1.9.0"
Automatic-Module-Name: org.eclipse.oomph.extractor.lib
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.extractor.lib/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.extractor.lib</artifactId>
<version>1.8.0-SNAPSHOT</version>
<version>1.9.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -23,6 +23,8 @@ public final class JREData

private final int bitness;

private final String arch;

private final String javaHome;

public JREData(int major, int minor, int micro, int bitness)
Expand All @@ -32,6 +34,7 @@ public JREData(int major, int minor, int micro, int bitness)
this.micro = micro;
this.bitness = bitness;
javaHome = ""; //$NON-NLS-1$
arch = ""; //$NON-NLS-1$
}

public JREData(String args)
Expand All @@ -45,6 +48,7 @@ public JREData(String[] args)
minor = parseInt(args[1]);
micro = parseInt(args[2]);
bitness = parseInt(args[3]);

if (args.length > 4)
{
javaHome = args[4].replace("%25", "%").replace("%20", " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Expand All @@ -53,6 +57,15 @@ public JREData(String[] args)
{
javaHome = ""; //$NON-NLS-1$
}

if (args.length > 5)
{
arch = args[5];
}
else
{
arch = ""; //$NON-NLS-1$
}
}

public JREData()
Expand Down Expand Up @@ -92,6 +105,8 @@ public JREData()

bitness = determineBitness();
javaHome = System.getProperty("java.home"); //$NON-NLS-1$
String osArchProperty = System.getProperty("os.arch"); //$NON-NLS-1$
arch = "amd64".equals(osArchProperty) ? "x86_64" : osArchProperty; //$NON-NLS-1$ //$NON-NLS-2$
}

public int getMajor()
Expand Down Expand Up @@ -119,6 +134,11 @@ public String getJavaHome()
return javaHome;
}

public String getArch()
{
return arch;
}

public boolean satisfies(JREData requirement)
{
if (bitness != requirement.bitness)
Expand Down Expand Up @@ -151,6 +171,12 @@ public boolean satisfies(JREData requirement)
return false;
}

String requirementArch = requirement.getArch();
if (!"".equals(requirementArch) && !requirementArch.equals(arch)) //$NON-NLS-1$
{
return false;
}

return true;
}

Expand Down Expand Up @@ -191,6 +217,12 @@ public String toString()
}
}
}

if (!"".equals(arch)) //$NON-NLS-1$
{
result.append(' ');
result.append(arch);
}
}

return result.toString();
Expand Down
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.gitbash/META-INF/MANIFEST.MF
Expand Up @@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.egit.ui;bundle-version="[2.0.0,10.0.0)",
org.eclipse.mylyn.tasks.core;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
org.eclipse.mylyn.tasks.ui;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
org.eclipse.oomph.util;bundle-version="[1.16.0,2.0.0)"
org.eclipse.oomph.util;bundle-version="[1.17.0,2.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.oomph.gitbash;version="1.16.0";x-internal:=true,
Expand Down
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.jreinfo.ui/META-INF/MANIFEST.MF
Expand Up @@ -10,6 +10,6 @@ Bundle-Activator: org.eclipse.oomph.jreinfo.ui.JREInfoUIPlugin$Implementation
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.oomph.ui;bundle-version="[1.15.0,2.0.0)",
org.eclipse.oomph.jreinfo;bundle-version="[1.14.0,2.0.0)";visibility:=reexport
org.eclipse.oomph.jreinfo;bundle-version="[1.15.0,2.0.0)";visibility:=reexport
Export-Package: org.eclipse.oomph.jreinfo.ui;version="1.13.0";x-internal:=true
Automatic-Module-Name: org.eclipse.oomph.jreinfo.ui
Expand Up @@ -20,6 +20,7 @@
import org.eclipse.oomph.util.OS;
import org.eclipse.oomph.util.PropertiesUtil;
import org.eclipse.oomph.util.Request;
import org.eclipse.oomph.util.StringUtil;

import org.eclipse.emf.edit.provider.IItemFontProvider;
import org.eclipse.emf.edit.ui.provider.ExtendedFontRegistry;
Expand Down Expand Up @@ -198,7 +199,7 @@ public void keyPressed(KeyEvent e)

TreeColumn bitnessColumn = new TreeColumn(tree, SWT.LEFT);
bitnessColumn.setText(Messages.JREComposite_column_bitness);
treeLayout.setColumnData(bitnessColumn, new ColumnWeightData(1, 60 + EXTRA_WIDTH));
treeLayout.setColumnData(bitnessColumn, new ColumnWeightData(1, 100 + EXTRA_WIDTH));

TreeColumn typeColumn = new TreeColumn(tree, SWT.LEFT);
typeColumn.setText(Messages.JREComposite_column_type);
Expand Down Expand Up @@ -578,7 +579,7 @@ public String getColumnText(Object element, int columnIndex)
case 1:
return jre.getMajor() + "." + jre.getMinor() + "." + jre.getMicro(); //$NON-NLS-1$ //$NON-NLS-2$
case 2:
return jre.getBitness() + " " + Messages.JREComposite_bit; //$NON-NLS-1$
return jre.getBitness() + " " + Messages.JREComposite_bit + (StringUtil.isEmpty(jre.getArch()) ? "" : " (" + jre.getArch() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
case 3:
return jre.isJDK() ? "JDK" : "JRE"; //$NON-NLS-1$ //$NON-NLS-2$
}
Expand Down
10 changes: 5 additions & 5 deletions plugins/org.eclipse.oomph.jreinfo/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.oomph.jreinfo
Bundle-Version: 1.14.0.qualifier
Bundle-Version: 1.15.0.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Expand All @@ -10,8 +10,8 @@ Bundle-ClassPath: .
Bundle-Activator: org.eclipse.oomph.internal.jreinfo.JREInfoPlugin$Implementation
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.oomph.util;bundle-version="[1.15.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.extractor.lib;bundle-version="[1.8.0,2.0.0)"
Export-Package: org.eclipse.oomph.internal.jreinfo;version="1.14.0";x-internal:=true,
org.eclipse.oomph.jreinfo;version="1.14.0";x-internal:=true
org.eclipse.oomph.util;bundle-version="[1.17.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.extractor.lib;bundle-version="[1.9.0,2.0.0)"
Export-Package: org.eclipse.oomph.internal.jreinfo;version="1.15.0";x-internal:=true,
org.eclipse.oomph.jreinfo;version="1.15.0";x-internal:=true
Automatic-Module-Name: org.eclipse.oomph.jreinfo
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.jreinfo/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.jreinfo</artifactId>
<version>1.14.0-SNAPSHOT</version>
<version>1.15.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -68,13 +68,14 @@ public synchronized JRE getInfo(File canonicalJavaHome)
int minor = result.getMinor();
int micro = result.getMicro();
int bitness = result.getBitness();
String arch = result.getArch();

boolean jdk = JREInfo.isJDK(canonicalJavaHome) == 1;

File executable = JRE.getExecutable(canonicalJavaHome);
long lastModified = executable.lastModified();

jre = new JRE(canonicalJavaHome, major, minor, micro, bitness, jdk, lastModified);
jre = new JRE(canonicalJavaHome, major, minor, micro, bitness, arch, jdk, lastModified);
infos.put(canonicalJavaHome, jre);

try
Expand Down Expand Up @@ -116,10 +117,15 @@ private void loadInfos()
{
try
{
JRE jre = new JRE(line);
if (jre.isValid())
// Ignore if the arch is missing.
String[] tokens = line.split(JRE.SEPARATOR);
if (tokens.length > 7)
{
infos.put(jre.getJavaHome(), jre);
JRE jre = new JRE(line);
if (jre.isValid())
{
infos.put(jre.getJavaHome(), jre);
}
}
}
catch (RuntimeException ex)
Expand Down
Expand Up @@ -10,14 +10,16 @@
*/
package org.eclipse.oomph.jreinfo;

import org.eclipse.oomph.util.StringUtil;

import java.io.File;

/**
* @author Eike Stepper
*/
public final class JRE implements Comparable<JRE>
{
private static final String SEPARATOR = File.pathSeparator;
static final String SEPARATOR = File.pathSeparator;

private final File javaHome;

Expand All @@ -31,18 +33,26 @@ public final class JRE implements Comparable<JRE>

private final int bitness;

private final String arch;

private final boolean jdk;

private final long lastModified;

public JRE(File javaHome, int major, int minor, int micro, int bitness, boolean jdk, long lastModified)
{
this(javaHome, major, minor, micro, bitness, "", jdk, lastModified); //$NON-NLS-1$
}

public JRE(File javaHome, int major, int minor, int micro, int bitness, String arch, boolean jdk, long lastModified)
{
this.javaHome = javaHome;
descriptor = null;
this.major = major;
this.minor = minor;
this.micro = micro;
this.bitness = bitness;
this.arch = arch;
this.jdk = jdk;
this.lastModified = lastModified;
}
Expand All @@ -55,6 +65,7 @@ public JRE(File javaHome, int major, int minor, int micro, int bitness, boolean
minor = descriptor.getMinor();
micro = descriptor.getMicro();
bitness = descriptor.getBitness();
arch = ""; //$NON-NLS-1$
jdk = descriptor.isJDK();
lastModified = -1;
}
Expand All @@ -67,6 +78,7 @@ public JRE(File javaHome, int major, int minor, int micro, int bitness, boolean
minor = info.minor;
micro = info.micro;
bitness = info.bitness;
arch = info.arch;
jdk = info.jdk;
lastModified = info.lastModified;
}
Expand All @@ -82,6 +94,7 @@ public JRE(File javaHome, int major, int minor, int micro, int bitness, boolean
bitness = Integer.parseInt(tokens[4]);
jdk = Boolean.parseBoolean(tokens[5]);
lastModified = Long.parseLong(tokens[6]);
arch = tokens.length > 7 ? tokens[7] : ""; //$NON-NLS-1$
}

public File getJavaHome()
Expand Down Expand Up @@ -119,6 +132,11 @@ public int getBitness()
return bitness;
}

public String getArch()
{
return arch;
}

public boolean isJDK()
{
return jdk;
Expand Down Expand Up @@ -219,6 +237,12 @@ public boolean isMatch(JREFilter filter)
return false;
}

String filterArch = filter.getArch();
if (!StringUtil.isEmpty(filterArch) && !StringUtil.isEmpty(arch) && !filterArch.equals(arch))
{
return false;
}

return true;
}

Expand Down Expand Up @@ -315,7 +339,7 @@ public String toString()
String toLine()
{
return javaHome.getAbsolutePath() + SEPARATOR + major + SEPARATOR + minor + SEPARATOR + micro + SEPARATOR + bitness + SEPARATOR + jdk + SEPARATOR
+ lastModified;
+ lastModified + SEPARATOR + arch;
}

static File getExecutable(File javaHome)
Expand Down

0 comments on commit 5feb93d

Please sign in to comment.