diff options
author | Pascal Rapicault | 2015-02-16 22:19:15 +0000 |
---|---|---|
committer | Pascal Rapicault | 2015-02-16 22:19:15 +0000 |
commit | 2c73306fc02a649f2bea26ecb5f351ca3e14999a (patch) | |
tree | 63e3ec9deab989ee4fc85078a200d6da64f338ce | |
parent | 0fdb03cf79ad3493245ba7f37b6fda5775dbd836 (diff) | |
download | rt.equinox.p2-2c73306fc02a649f2bea26ecb5f351ca3e14999a.tar.gz rt.equinox.p2-2c73306fc02a649f2bea26ecb5f351ca3e14999a.tar.xz rt.equinox.p2-2c73306fc02a649f2bea26ecb5f351ca3e14999a.zip |
Revert "WIP mac"I20150217-0800
This reverts commit 0fdb03cf79ad3493245ba7f37b6fda5775dbd836.
19 files changed, 85 insertions, 134 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java index 89f486dd4..1154b6bbb 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java @@ -27,8 +27,7 @@ import org.osgi.service.log.LogService; public class EclipseLauncherParser { public static final String MAC_OS_APP_FOLDER = ".app/Contents/MacOS"; //$NON-NLS-1$ private static final String CONFIGURATION_FOLDER = "configuration"; //$NON-NLS-1$ - - // public static final String MACOSX_BUNDLED = "macosx-bundled"; //$NON-NLS-1$ + public static final String MACOSX_BUNDLED = "macosx-bundled"; //$NON-NLS-1$ //this figures out the location of the data area on partial data read from the <eclipse>.ini private URI getOSGiInstallArea(List<String> lines, URI base, LauncherData launcherData) { @@ -49,12 +48,12 @@ public class EclipseLauncherParser { return; } String launcherString = launcherFolder.getAbsolutePath().replace('\\', '/'); - // if (launcherString.endsWith(MAC_OS_APP_FOLDER)) { - // //We can do 3 calls to getParentFile without checking because - // launcherFolder = launcherFolder.getParentFile().getParentFile(); - // if (!launcherData.getOS().endsWith(MACOSX_BUNDLED)) - // launcherFolder = launcherFolder.getParentFile(); - // } + if (launcherString.endsWith(MAC_OS_APP_FOLDER)) { + //We can do 3 calls to getParentFile without checking because + launcherFolder = launcherFolder.getParentFile().getParentFile(); + if (!launcherData.getOS().endsWith(MACOSX_BUNDLED)) + launcherFolder = launcherFolder.getParentFile(); + } if (!ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).equals(launcherFolder)) { ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java index baf343caf..f516d4da7 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java @@ -93,10 +93,7 @@ public class EquinoxManipulatorImpl implements Manipulator { int dotLocation = launcherName.lastIndexOf('.'); if (dotLocation != -1) launcherName = launcherName.substring(0, dotLocation); - File launcherFolder = launcher.getParentFile(); - if (org.eclipse.osgi.service.environment.Constants.OS_MACOSX.equals(launcherData.getOS())) - launcherFolder = new File(launcherData.getFwConfigLocation(), "../"); - File result = new File(launcherFolder, launcherName + EquinoxConstants.INI_EXTENSION); + File result = new File(launcher.getParentFile(), launcherName + EquinoxConstants.INI_EXTENSION); return result; } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java index 0279d4ac5..4080ffcb6 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java @@ -48,19 +48,19 @@ public class ParserUtils { File launcherFile = launcherData.getLauncher(); if (launcherFile != null) { - if (Constants.OS_MACOSX.equals(launcherData.getOS())) { // + if (Constants.OS_MACOSX.equals(launcherData.getOS())) { //the equinox launcher will look 3 levels up on the mac when going from executable to launcher.jar //see org.eclipse.equinox.executable/library/eclipse.c : findStartupJar(); IPath launcherPath = new Path(launcherFile.getAbsolutePath()); - if (launcherPath.segmentCount() > 1) { + if (launcherPath.segmentCount() > 4) { //removing "Eclipse.app/Contents/MacOS/eclipse" - launcherPath = launcherPath.removeLastSegments(1).append("Eclipse"); //$NON-NLS-1$ + launcherPath = launcherPath.removeLastSegments(4); return launcherPath.toFile(); } } - // if (EclipseLauncherParser.MACOSX_BUNDLED.equals(launcherData.getOS())) { - // Log.log(LogService.LOG_WARNING, "Problem figuring out the osgi install area. The bundled mode of macosx requires a -startup argument to be specified."); //$NON-NLS-1$ - // } + if (EclipseLauncherParser.MACOSX_BUNDLED.equals(launcherData.getOS())) { + Log.log(LogService.LOG_WARNING, "Problem figuring out the osgi install area. The bundled mode of macosx requires a -startup argument to be specified."); //$NON-NLS-1$ + } return launcherFile.getParentFile(); } return null; diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java index 481714f1e..7eed2d207 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java @@ -15,12 +15,12 @@ import java.io.*; import java.net.*; import java.util.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxConstants; -import org.eclipse.equinox.internal.frameworkadmin.equinox.ParserUtils; +import org.eclipse.equinox.internal.frameworkadmin.equinox.*; import org.eclipse.equinox.internal.provisional.frameworkadmin.LauncherData; import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator; import org.eclipse.osgi.service.environment.Constants; import org.osgi.framework.Version; +import org.osgi.service.log.LogService; public class FileUtils { private static String FILE_SCHEME = "file"; //$NON-NLS-1$ @@ -80,8 +80,8 @@ public class FileUtils { launcherPath = launcherPath.removeLastSegments(4); launcherDir = launcherPath.toFile(); } - //} //else if (EclipseLauncherParser.MACOSX_BUNDLED.equals(launcherData.getOS())) { - // Log.log(LogService.LOG_WARNING, "Problem figuring out the osgi install area. The bundled mode of macosx requires a -startup argument to be specified."); //$NON-NLS-1$ + } else if (EclipseLauncherParser.MACOSX_BUNDLED.equals(launcherData.getOS())) { + Log.log(LogService.LOG_WARNING, "Problem figuring out the osgi install area. The bundled mode of macosx requires a -startup argument to be specified."); //$NON-NLS-1$ } else launcherDir = launcherData.getLauncher().getParentFile(); pluginsDir = new File(launcherDir, EquinoxConstants.PLUGINS_DIR); diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/configuration/config.ini b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/configuration/config.ini deleted file mode 100644 index da41313b8..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/configuration/config.ini +++ /dev/null @@ -1,13 +0,0 @@ -#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser -#Thu Sep 25 06:00:00 EDT 2014 -org.eclipse.update.reconcile=false -eclipse.p2.profile=SDKProfile -osgi.instance.area.default=@user.home/Documents/workspace -osgi.framework=file\:plugins/org.eclipse.osgi.jar -osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator.jar@1\:start -org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info -eclipse.product=org.eclipse.platform.ide -osgi.splashPath=platform\:/base/plugins/org.eclipse.platform -eclipse.application=org.eclipse.ui.ide.workbench -eclipse.p2.data.area=@config.dir/../p2 -osgi.bundles.defaultStartLevel=4 diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/eclipse.ini b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/eclipse.ini deleted file mode 100644 index 2bdaa3b24..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/eclipse.ini +++ /dev/null @@ -1,14 +0,0 @@ --startup -../Eclipse/plugins/org.eclipse.equinox.launcher.jar --showsplash -org.eclipse.platform ---launcher.XXMaxPermSize -256m ---launcher.defaultAction -openFile ---launcher.appendVmargs --vmargs --Xms40m --Xdock:icon=../Resources/Eclipse.icns --XstartOnFirstThread --Dorg.eclipse.swt.internal.carbon.smallFonts
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/org.eclipse.equinox.simpleconfigurator/.baseBundlesInfoTimestamp b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/org.eclipse.equinox.simpleconfigurator/.baseBundlesInfoTimestamp deleted file mode 100644 index 8f71a23b8..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/org.eclipse.equinox.simpleconfigurator/.baseBundlesInfoTimestamp +++ /dev/null @@ -1,4 +0,0 @@ -#Written by class org.eclipse.equinox.internal.simpleconfigurator.manipulator.SimpleConfiguratorManipulatorImpl -#Thu Sep 25 06:00:00 EDT 2014 -bundlesInfoTimestamp=1411639200000 -extTimestamp=-1 diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/org.eclipse.equinox.simpleconfigurator/bundles.info b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/org.eclipse.equinox.simpleconfigurator/bundles.info deleted file mode 100644 index 45b3c31e2..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/org.eclipse.equinox.simpleconfigurator/bundles.info +++ /dev/null @@ -1,4 +0,0 @@ -#version=1 -org.eclipse.equinox.simpleconfigurator,0.1.0.200710172125,plugins/org.eclipse.equinox.simpleconfigurator.jar,1,true -org.eclipse.osgi,3.3.1.R33x_v20070828,plugins/org.eclipse.osgi.jar,-1,true -org.eclipse.equinox.launcher,1.0.200.v20081124-1800,plugins/org.eclipse.equinox.launcher.jar,4,false diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.equinox.launcher.jar b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.equinox.launcher.jar Binary files differdeleted file mode 100644 index 5947c8dee..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.equinox.launcher.jar +++ /dev/null diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.equinox.simpleconfigurator.jar b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.equinox.simpleconfigurator.jar Binary files differdeleted file mode 100644 index 8a631d83a..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.equinox.simpleconfigurator.jar +++ /dev/null diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.osgi.jar b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.osgi.jar Binary files differdeleted file mode 100644 index 20ca2696d..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.osgi.jar +++ /dev/null diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/MacOS/eclipse b/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/MacOS/eclipse deleted file mode 100644 index e69de29bb..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/MacOS/eclipse +++ /dev/null diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/FwkAdminAndSimpleConfiguratorTest.java b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/FwkAdminAndSimpleConfiguratorTest.java index 73334fe84..a571c74cc 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/FwkAdminAndSimpleConfiguratorTest.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/FwkAdminAndSimpleConfiguratorTest.java @@ -47,7 +47,7 @@ public abstract class FwkAdminAndSimpleConfiguratorTest extends AbstractFwkAdmin configurationFolder = new File(installFolder, "configuration"); launcherName = "eclipse"; - boolean isMacOS = Constants.OS_MACOSX.equals(os); + boolean isMacOS = Constants.OS_MACOSX.equals(os) || EclipseLauncherParser.MACOSX_BUNDLED.equals(os); launcherPath = isMacOS ? new Path("Eclipse" + EclipseLauncherParser.MAC_OS_APP_FOLDER).append(launcherName) : new Path(launcherName); LauncherData launcherData = manipulator.getLauncherData(); diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/MacOSLikeSetup2.java b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/MacOSLikeSetup2.java deleted file mode 100644 index 58e6a5f58..000000000 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/MacOSLikeSetup2.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.equinox.frameworkadmin.tests; - -import java.io.File; -import java.io.IOException; -import org.eclipse.equinox.internal.provisional.frameworkadmin.*; -import org.eclipse.osgi.service.environment.Constants; -import org.osgi.framework.BundleException; - -public class MacOSLikeSetup2 extends FwkAdminAndSimpleConfiguratorTest { - - public MacOSLikeSetup2(String name) { - super(name); - } - - public void testMacOSSetup() throws FrameworkAdminRuntimeException, IOException, BundleException { - FrameworkAdmin fwkAdmin = getEquinoxFrameworkAdmin(); - Manipulator manipulator = fwkAdmin.getManipulator(); - - File installFolder = new File("/home/pascal/git/rt.equinox.p2/bundles/org.eclipse.equinox.frameworkadmin.test/dataFile/mac/Eclipse.app/Contents/Eclipse"); - File configurationFolder = new File(installFolder, "configuration"); - File launcherFolder = new File(installFolder, "../MacOS/"); - File launcherName = new File(launcherFolder, "eclipse"); - - LauncherData launcherData = manipulator.getLauncherData(); - launcherData.setFwConfigLocation(configurationFolder); - launcherData.setLauncher(launcherName); -// launcherData.setLauncherConfigLocation(new File(installFolder, "eclipse.ini")); - launcherData.setOS(Constants.OS_MACOSX); - - manipulator.load(); - - assertTrue(manipulator.getLauncherData().getJvmArgs().length > 0); - } -} diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/TestVMArg.java b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/TestVMArg.java index 536fe2924..d1a011457 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/TestVMArg.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/TestVMArg.java @@ -64,19 +64,19 @@ public class TestVMArg extends FwkAdminAndSimpleConfiguratorTest { assertContent("Relative JRE path must be present in " + launcherConfigFile, launcherConfigFile, expectedRelativePath); } -// public void testVMInsideInstall_MacOS_BundledLayout() throws Exception { -// m = createMinimalConfiguration(TestEclipseDataArea.class.getName(), EclipseLauncherParser.MACOSX_BUNDLED); -// // note the difference the traditional layout: one segment less -// final String expectedRelativePath = "../../jre"; -// -// File jreLocation = new File(m.getLauncherData().getLauncher().getParentFile(), expectedRelativePath); -// m.getLauncherData().setJvm(jreLocation); -// m.save(false); -// -// File launcherConfigFile = getLauncherConfigFile(); -// assertNotContent("No absolute JRE path must be present in " + launcherConfigFile, launcherConfigFile, jreLocation.getAbsolutePath()); -// assertContent("Relative JRE path must be present in " + launcherConfigFile, launcherConfigFile, expectedRelativePath); -// } + public void testVMInsideInstall_MacOS_BundledLayout() throws Exception { + m = createMinimalConfiguration(TestEclipseDataArea.class.getName(), EclipseLauncherParser.MACOSX_BUNDLED); + // note the difference the traditional layout: one segment less + final String expectedRelativePath = "../../jre"; + + File jreLocation = new File(m.getLauncherData().getLauncher().getParentFile(), expectedRelativePath); + m.getLauncherData().setJvm(jreLocation); + m.save(false); + + File launcherConfigFile = getLauncherConfigFile(); + assertNotContent("No absolute JRE path must be present in " + launcherConfigFile, launcherConfigFile, jreLocation.getAbsolutePath()); + assertContent("Relative JRE path must be present in " + launcherConfigFile, launcherConfigFile, expectedRelativePath); + } public void testVMOutsideInstall() throws FrameworkAdminRuntimeException, IOException { //Test VM path in the install folder diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java index a8e6ca090..423ec92e0 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java @@ -197,16 +197,16 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { private Map<String, String> computeInstallActions(ExecutablesDescriptor execDescriptor, String os) { Map<String, String> touchpointData = new HashMap<String, String>(); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ - // if (org.eclipse.equinox.p2.core.spi.Constants.MACOSX_BUNDLED.equals(os)) { - // String execName = execDescriptor.getExecutableName(); - // String appName = guessMacAppName(execName); - // configurationData = "unzip(source:@artifact, target:${installFolder}, path:" + appName + ".app);"; //$NON-NLS-1$ //$NON-NLS-2$ - // configurationData += " chmod(targetDir:${installFolder}/Contents/MacOS/, targetFile:" + execName + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ - // } else - if (Constants.OS_MACOSX.equals(os)) { + if (org.eclipse.equinox.p2.core.spi.Constants.MACOSX_BUNDLED.equals(os)) { + String execName = execDescriptor.getExecutableName(); + String appName = guessMacAppName(execName); + configurationData = "unzip(source:@artifact, target:${installFolder}, path:" + appName + ".app);"; //$NON-NLS-1$ //$NON-NLS-2$ + configurationData += " chmod(targetDir:${installFolder}/Contents/MacOS/, targetFile:" + execName + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ + } else if (Constants.OS_MACOSX.equals(os)) { String execName = execDescriptor.getExecutableName(); String appName = guessMacAppName(execName); - configurationData += " chmod(targetDir:${installFolder}/../MacOS/, targetFile:" + execName + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + configurationData += " chmod(targetDir:${installFolder}/" + appName + ".app/Contents/MacOS/, targetFile:" + execName + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + configurationData += " ln(targetDir:${installFolder}, linkTarget:" + appName + ".app/Contents/MacOS/" + execName + ", linkName:" + execName + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } else if (!Constants.OS_WIN32.equals(os)) { // We are on linux/unix. by default set all of the files to be executable. File[] fileList = execDescriptor.getFiles(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java index f2e886134..7ae4307d5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java @@ -68,6 +68,7 @@ public class AbstractSharedBundleProductTest extends AbstractReconcilerTest { "org.eclipse.equinox.p2.metadata", // "org.eclipse.equinox.p2.metadata.repository", // "org.eclipse.equinox.p2.publisher", // + "org.eclipse.equinox.p2.ql", // "org.eclipse.equinox.p2.reconciler.dropins", // "org.eclipse.equinox.p2.repository", // "org.eclipse.equinox.p2.touchpoint.eclipse", // diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java index 6a6bad74d..4e8857043 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java @@ -48,7 +48,7 @@ public class LazyManipulator implements Manipulator { launcherData.setFwConfigLocation(Util.getConfigurationFolder(profile)); launcherData.setLauncher(Util.getLauncherPath(profile)); launcherData.setLauncherConfigLocation(Util.getLauncherConfigLocation(profile)); - launcherData.setOS(Util.getOSFromProfile(profile)); + launcherData.setOS(Util.isMacOSBundled(profile) ? org.eclipse.equinox.p2.core.spi.Constants.MACOSX_BUNDLED : Util.getOSFromProfile(profile)); launcherData.setHome(Util.getInstallFolder(profile)); try { diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java index a5a6d8971..dc85fe237 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java @@ -15,6 +15,7 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse; import java.io.File; +import java.io.IOException; import java.net.*; import java.util.*; import org.eclipse.core.runtime.*; @@ -22,6 +23,7 @@ import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.p2.core.helpers.*; import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability; import org.eclipse.equinox.p2.core.*; +import org.eclipse.equinox.p2.core.spi.Constants; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.repository.IRepository; @@ -269,23 +271,23 @@ public class Util { String name = profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME); if (name == null || name.length() == 0) name = "eclipse"; //$NON-NLS-1$ - String relativePath = getLauncherRelativePath(name, getOSFromProfile(profile), getInstallFolder(profile)); - return relativePath == null ? null : new File(getInstallFolder(profile), relativePath); + String launcherName = getLauncherName(name, (isMacOSBundled(profile) ? Constants.MACOSX_BUNDLED : getOSFromProfile(profile)), getInstallFolder(profile)); + return launcherName == null ? null : new File(getInstallFolder(profile), launcherName); } - // public static boolean isMacOSBundled(IProfile profile) { - // String environments = profile.getProperty(IProfile.PROP_ENVIRONMENTS); - // if (environments == null) - // return false; - // if (environments.indexOf(Constants.MACOSX_BUNDLED + "=true") != -1) //$NON-NLS-1$ - // return true; - // return false; - // } + public static boolean isMacOSBundled(IProfile profile) { + String environments = profile.getProperty(IProfile.PROP_ENVIRONMENTS); + if (environments == null) + return false; + if (environments.indexOf(Constants.MACOSX_BUNDLED + "=true") != -1) //$NON-NLS-1$ + return true; + return false; + } /** * Returns the name of the Eclipse application launcher. */ - private static String getLauncherRelativePath(String name, String os, File installFolder) { + private static String getLauncherName(String name, String os, File installFolder) { if (os == null) { EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName()); if (info == null) @@ -299,9 +301,38 @@ public class Util { return name; return name + ".exe"; //$NON-NLS-1$ } + if (os.equals(Constants.MACOSX_BUNDLED)) { + return "/Contents/MacOS/" + name; //$NON-NLS-1$ + } if (os.equals(org.eclipse.osgi.service.environment.Constants.OS_MACOSX)) { - return "../MacOS/" + name; + IPath path = new Path(name); + if (path.segment(0).endsWith(".app")) //$NON-NLS-1$ + return name; + + String appName = null; + if (installFolder != null) { + File appFolder = new File(installFolder, name + ".app"); //$NON-NLS-1$ + if (appFolder.exists()) { + try { + appName = appFolder.getCanonicalFile().getName(); + } catch (IOException e) { + appName = appFolder.getName(); + } + } + } + + StringBuffer buffer = new StringBuffer(); + if (appName != null) { + buffer.append(appName); + } else { + buffer.append(name.substring(0, 1).toUpperCase()); + buffer.append(name.substring(1)); + buffer.append(".app"); //$NON-NLS-1$ + } + buffer.append("/Contents/MacOS/"); //$NON-NLS-1$ + buffer.append(name); + return buffer.toString(); } return name; } |