Bug 570540 - Build eclipse for Mac M1 processor architecture

Change-Id: I1fd356c2321527b0f0c5c0eb09c1dc816bf141fd
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
diff --git a/bundles/org.eclipse.equinox.launcher.cocoa.macosx/.project b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/.project
new file mode 100644
index 0000000..5efe02e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.equinox.launcher.cocoa.macosx.arm64</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.launcher.cocoa.macosx/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..3c74f73
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.equinox.launcher.cocoa.macosx;singleton:=true
+Bundle-Version: 1.2.100.qualifier
+Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.5.0,1.7.0)"
+Eclipse-PlatformFilter: (& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=arm64) )
+Bundle-Localization: launcher.cocoa.macosx.arm64
+Eclipse-BundleShape: dir
diff --git a/bundles/org.eclipse.equinox.launcher.cocoa.macosx/about.html b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/about.html
new file mode 100644
index 0000000..164f781
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/about.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>About</title>
+</head>
+<body lang="EN-US">
+	<h2>About This Content</h2>
+
+	<p>November 30, 2017</p>
+	<h3>License</h3>
+
+	<p>
+		The Eclipse Foundation makes available all content in this plug-in
+		(&quot;Content&quot;). Unless otherwise indicated below, the Content
+		is provided to you under the terms and conditions of the Eclipse
+		Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
+		available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
+		For purposes of the EPL, &quot;Program&quot; will mean the Content.
+	</p>
+
+	<p>
+		If you did not receive this Content directly from the Eclipse
+		Foundation, the Content is being redistributed by another party
+		(&quot;Redistributor&quot;) and different terms and conditions may
+		apply to your use of any object code in the Content. Check the
+		Redistributor's license that was provided with the Content. If no such
+		license exists, contact the Redistributor. Unless otherwise indicated
+		below, the terms and conditions of the EPL still apply to any source
+		code in the Content and such source code may be obtained at <a
+			href="http://www.eclipse.org/">http://www.eclipse.org</a>.
+	</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.launcher.cocoa.macosx/build.properties b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/build.properties
new file mode 100644
index 0000000..83f921a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/build.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2011 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = META-INF/,\
+               launcher.cocoa.macosx.arm64.properties,\
+               about.html
+               
+customBuildCallbacks=customBuildCallbacks.xml
+generateSourceBundle=false
+binaryTag=v20210209-1541
diff --git a/bundles/org.eclipse.equinox.launcher.cocoa.macosx/customBuildCallbacks.xml b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/customBuildCallbacks.xml
new file mode 100644
index 0000000..3773f01
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/customBuildCallbacks.xml
@@ -0,0 +1,124 @@
+<!-- ===================================================================== -->
+<!-- Custom targets called from a project's generated build.xml            -->
+<!-- Set customBuildCallbacks=<path/to/this/file> in your build.properties.-->
+<!-- ===================================================================== -->
+<project name="Build specific targets and properties" default="noDefault">
+
+	<!-- ===================================================================== -->
+	<!-- Default target                                                        -->
+	<!-- ===================================================================== -->
+	<target name="noDefault">
+		<echo message="This file must be called with explicit targets" />
+	</target>
+	
+	<!-- ===================================================================== -->
+	<!-- Steps to do before the target build.jars                              -->
+	<!-- Available parameters :                                                -->
+	<!--   build.result.folder - folder to contain the build results           -->
+	<!-- ===================================================================== -->
+	<target name="pre.build.jars">
+	</target>
+
+	<!-- ===================================================================== -->
+	<!-- Steps to do after the target build.jars                               -->
+	<!-- Available parameters :                                                -->
+	<!--   build.result.folder - folder to contain the build results           -->
+	<!-- ===================================================================== -->
+	<target name="post.build.jars">	
+	</target>
+	
+	<!-- ===================================================================== -->
+	<!-- Steps to do before the target build.sources                           -->
+	<!-- Available parameters :                                                -->
+	<!--   build.result.folder - folder to contain the build results           -->
+	<!-- ===================================================================== -->
+	<target name="pre.build.sources">
+	</target>
+
+	<!-- ===================================================================== -->
+	<!-- Steps to do after the target build.sources                            -->
+	<!-- Available parameters :                                                -->
+	<!--   build.result.folder - folder to contain the build results           -->
+	<!-- ===================================================================== -->
+	<target name="post.build.sources">
+	</target>
+	
+	<target name="pre.gather.bin.parts">
+		<property file="${basedir}/build.properties" />
+		<basename file="${basedir}" property="fragmentName" />
+		<available file="/gitroot/equinox/rt.equinox.binaries.git" type="dir" property="gitRepo" value="/gitroot/equinox/rt.equinox.binaries.git" />
+		<property name="gitRepo" value="ssh://git.eclipse.org/gitroot/equinox/rt.equinox.binaries.git" />
+		
+		<exec dir="${basedir}" executable="git" output="${basedir}/binary.tar" errorproperty="errorResult" >
+			<arg line="archive --format=tar --remote=${gitRepo} ${binaryTag} ${fragmentName}" />
+		</exec>
+		
+		<copy todir="${basedir}">
+			<tarfileset includes="${fragmentName}/**" src="${basedir}/binary.tar" />
+			<globmapper from="${fragmentName}/*" to="*" />
+		</copy>
+		
+		<delete file="${basedir}/binary.tar" failonerror="false" quiet="true" />
+	</target>
+	
+	<!-- ===================================================================== -->
+	<!-- Steps to do after the target gather.bin.parts                         -->
+	<!-- Available parameters :                                                -->
+	<!--   base.dir - root of the project                                      -->
+	<!--   build.result.folder - folder containing the build results           -->
+	<!--   target.folder - destination folder                                  -->
+	<!-- ===================================================================== -->
+	<target name="post.gather.bin.parts">
+		<chmod perm="755" dir="${target.folder}" includes="eclipse_*" />
+	</target>
+	
+	<!-- ===================================================================== -->
+	<!-- Steps to do before the target gather.sources                          -->
+	<!-- Available parameters :                                                -->
+	<!--   destination.temp.folder - destination folder                        -->
+	<!-- ===================================================================== -->
+	<target name="pre.gather.sources">
+	</target>
+
+	<!-- ===================================================================== -->
+	<!-- Steps to do after the target gather.sources                           -->
+	<!-- Available parameters :                                                -->
+	<!--   destination.temp.folder - destination folder                        -->
+	<!-- ===================================================================== -->
+	<target name="post.gather.sources">
+	</target>
+
+	<!-- ===================================================================== -->
+	<!-- Steps to do before the target gather.logs                             -->
+	<!-- Available parameters :                                                -->
+	<!--   destination.temp.folder - destination folder                        -->
+	<!-- ===================================================================== -->
+	<target name="pre.gather.logs">        
+	</target>
+
+	<!-- ===================================================================== -->
+	<!-- Steps to do after the target gather.logs                              -->
+	<!-- Available parameters :                                                -->
+	<!--   destination.temp.folder - destination folder                        -->
+	<!-- ===================================================================== -->
+	<target name="post.gather.logs">       
+	</target>
+
+	<!-- ===================================================================== -->
+	<!-- Steps to do before the target clean                                   -->
+	<!-- Available parameters :                                                -->
+	<!--   destination.temp.folder - destination folder                        -->
+	<!-- ===================================================================== -->
+	<target name="pre.clean">              
+	</target>
+
+	<!-- ===================================================================== -->
+	<!-- Steps to do after the target clean                                    -->
+	<!-- Available parameters :                                                -->
+	<!--   plugin.destination - final destination of the build                 -->
+	<!--   build.result.folder - results of the compilation                    -->
+	<!--   temp.folder - temporary folder                                      -->
+	<!-- ===================================================================== -->
+	<target name="post.clean">             
+	</target>
+</project>
diff --git a/bundles/org.eclipse.equinox.launcher.cocoa.macosx/launcher.cocoa.macosx.arm64.properties b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/launcher.cocoa.macosx.arm64.properties
new file mode 100644
index 0000000..8db0544
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/launcher.cocoa.macosx.arm64.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2008, 2009 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+pluginName = Equinox Launcher MacOSX Cocoa ARM64 Fragment
+providerName = Eclipse.org - Equinox
diff --git a/bundles/org.eclipse.equinox.launcher.cocoa.macosx/pom.xml b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/pom.xml
new file mode 100644
index 0000000..80ecb70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher.cocoa.macosx/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (c) 2012 Eclipse Foundation.
+  All rights reserved. This program and the accompanying materials
+  are made available under the terms of the Eclipse Distribution License v1.0
+  which accompanies this distribution, and is available at
+  http://www.eclipse.org/org/documents/edl-v10.php
+ 
+  Contributors:
+     Igor Fedorenko - initial implementation
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>launcher-binary-parent</artifactId>
+    <groupId>org.eclipse.equinox.framework</groupId>
+    <version>4.20.0-SNAPSHOT</version>
+    <relativePath>../../launcher-binary-parent</relativePath>
+  </parent>
+  <groupId>org.eclipse.equinox</groupId>
+  <artifactId>org.eclipse.equinox.launcher.cocoa.macosx</artifactId>
+  <version>1.2.100-SNAPSHOT</version>
+  <packaging>eclipse-plugin</packaging>
+
+  <properties>
+    <os>macosx</os>
+    <ws>cocoa</ws>
+    <arch>arm64</arch>
+    <skipAPIAnalysis>true</skipAPIAnalysis>
+  </properties>
+
+</project>
diff --git a/features/org.eclipse.equinox.executable.feature/build.properties b/features/org.eclipse.equinox.executable.feature/build.properties
index 322d866..cee6117 100644
--- a/features/org.eclipse.equinox.executable.feature/build.properties
+++ b/features/org.eclipse.equinox.executable.feature/build.properties
@@ -33,5 +33,8 @@
 root.macosx.cocoa.x86_64=bin/cocoa/macosx/x86_64
 root.macosx.cocoa.x86_64.permissions.755=Eclipse.app/Contents/MacOS/launcher
 
+root.macosx.cocoa.arm64=bin/cocoa/macosx/arm64
+root.macosx.cocoa.arm64.permissions.755=Eclipse.app/Contents/MacOS/launcher
+
 root.linux.gtk.x86_64=bin/gtk/linux/x86_64,gtk_root
 root.linux.gtk.x86_64.permissions.755=libcairo-swt.so
diff --git a/features/org.eclipse.equinox.executable.feature/feature.xml b/features/org.eclipse.equinox.executable.feature/feature.xml
index 1ec21cf..3d4b3ec 100755
--- a/features/org.eclipse.equinox.executable.feature/feature.xml
+++ b/features/org.eclipse.equinox.executable.feature/feature.xml
@@ -33,6 +33,26 @@
          fragment="true"/>
 
    <plugin
+         id="org.eclipse.equinox.launcher.cocoa.macosx.arm64"
+         os="macosx"
+         ws="cocoa"
+         arch="arm64"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         fragment="true"/>
+
+   <plugin
+         id="org.eclipse.equinox.launcher.cocoa.macosx"
+         os="macosx"
+         ws="cocoa"
+         arch="arm64"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         fragment="true"/>
+
+   <plugin
          id="org.eclipse.equinox.launcher.gtk.linux.ppc64le"
          os="linux"
          ws="gtk"
diff --git a/features/org.eclipse.equinox.executable.feature/pom.xml b/features/org.eclipse.equinox.executable.feature/pom.xml
index 48e468e..e416275 100644
--- a/features/org.eclipse.equinox.executable.feature/pom.xml
+++ b/features/org.eclipse.equinox.executable.feature/pom.xml
@@ -123,6 +123,7 @@
                     <copy todir="bin" verbose="true" includeEmptyDirs="false" failonerror="true">
                       <fileset dir="${rt.equinox.binaries.loc}/org.eclipse.equinox.executable/bin/">
                         <include name="cocoa/macosx/x86_64/**/*"/>
+                        <include name="cocoa/macosx/arm64/**/*"/>
                         <include name="gtk/linux/ppc64le/**/*"/>
                         <include name="gtk/linux/aarch64/**/*"/>
                         <include name="gtk/linux/x86_64/**/*"/>
diff --git a/features/org.eclipse.equinox.executable.feature/resources/build.properties b/features/org.eclipse.equinox.executable.feature/resources/build.properties
index 741e9b3..aa8ac04 100644
--- a/features/org.eclipse.equinox.executable.feature/resources/build.properties
+++ b/features/org.eclipse.equinox.executable.feature/resources/build.properties
@@ -26,6 +26,9 @@
 root.macosx.cocoa.x86_64=bin/cocoa/macosx/x86_64
 root.macosx.cocoa.x86_64.permissions.755=Contents/MacOS/${launcherName}
 
+root.macosx.cocoa.arm64=bin/cocoa/macosx/arm64
+root.macosx.cocoa.arm64.permissions.755=Contents/MacOS/${launcherName}
+
 root.linux.gtk.x86_64=bin/gtk/linux/x86_64,gtk_root
 root.linux.gtk.x86_64.permissions.755=libcairo-swt.so
 
diff --git a/features/org.eclipse.equinox.executable.feature/resources/build.xml b/features/org.eclipse.equinox.executable.feature/resources/build.xml
index e37dbd7..5c7055d 100644
--- a/features/org.eclipse.equinox.executable.feature/resources/build.xml
+++ b/features/org.eclipse.equinox.executable.feature/resources/build.xml
@@ -76,6 +76,14 @@
 		<chmod perm="755" dir="${feature.base}/macosx.cocoa.x86_64/${collectingFolder}" includes="${launcherName}" />
 		<chmod perm="755" dir="${feature.base}/macosx.cocoa.x86_64/${collectingFolder}" includes="Eclipse.app/Contents/MacOS/launcher" />
 	</target>
+	<target name="rootFilesmacosx_cocoa_arm64">
+		<mkdir dir="${feature.base}/macosx.cocoa.arm64/${collectingFolder}"/>
+		<copy todir="${feature.base}/macosx.cocoa.arm64/${collectingFolder}" failonerror="true" overwrite="true">
+			<fileset dir="${basedir}/bin/cocoa/macosx/arm64" includes="**"			/>
+		</copy>
+		<chmod perm="755" dir="${feature.base}/macosx.cocoa.arm64/${collectingFolder}" includes="${launcherName}" />
+		<chmod perm="755" dir="${feature.base}/macosx.cocoa.arm64/${collectingFolder}" includes="Eclipse.app/Contents/MacOS/launcher" />
+	</target>
 	<target name="rootFileslinux_gtk_ppc64le">
 		<mkdir dir="${feature.base}/linux.gtk.ppc64le/${collectingFolder}"/>
 		<copy todir="${feature.base}/linux.gtk.ppc64le/${collectingFolder}" failonerror="true" overwrite="true">
diff --git a/pom.xml b/pom.xml
index 6e69635..169feb8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,9 @@
     <module>bundles/org.eclipse.osgi/supplement</module>
     
     <module>bundles/org.eclipse.equinox.launcher</module>
+    <module>bundles/org.eclipse.equinox.launcher.cocoa.macosx</module>
     <module>bundles/org.eclipse.equinox.launcher.cocoa.macosx.x86_64</module>
+    <module>bundles/org.eclipse.equinox.launcher.cocoa.macosx.arm64</module>
     <module>bundles/org.eclipse.equinox.launcher.gtk.linux.aarch64</module>
     <module>bundles/org.eclipse.equinox.launcher.gtk.linux.ppc64le</module>
     <module>bundles/org.eclipse.equinox.launcher.gtk.linux.x86_64</module>
diff --git a/releng/org.eclipse.equinox.launcher.releng/build.xml b/releng/org.eclipse.equinox.launcher.releng/build.xml
index d3f764b..071ebd1 100644
--- a/releng/org.eclipse.equinox.launcher.releng/build.xml
+++ b/releng/org.eclipse.equinox.launcher.releng/build.xml
@@ -60,15 +60,7 @@
 	
 	<target name="init_fragment" >
 		<!-- mac only has arch in fragment name for x86_64 -->
-		<condition property="fragmentFolder" value="org.eclipse.equinox.launcher.${ws}.${os}.${arch}" 
-											 else="org.eclipse.equinox.launcher.${ws}.${os}" >
-			<not>
-				<and>
-					<equals arg1="macosx" arg2="${os}"/>
-					<not> <equals arg1="x86_64" arg2="${arch}"/> </not>
-				</and>
-			</not>
-		</condition>
+		<property name="fragmentFolder" value="org.eclipse.equinox.launcher.${ws}.${os}.${arch}" />
 	</target>
 
 	<target name="copyMacPPC" if="copyMacPPC" >