Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 219866 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java (-2 / +20 lines)
Lines 750-755 Link Here
750
		cu.setTouchpointType(MetadataGeneratorHelper.TOUCHPOINT_NATIVE);
750
		cu.setTouchpointType(MetadataGeneratorHelper.TOUCHPOINT_NATIVE);
751
		Map touchpointData = new HashMap();
751
		Map touchpointData = new HashMap();
752
		String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
752
		String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
753
754
		IInstallableUnit launcherNameIU = null;
753
		if (Constants.OS_MACOSX.equals(os)) {
755
		if (Constants.OS_MACOSX.equals(os)) {
754
			File[] appFolders = root.listFiles(new FilenameFilter() {
756
			File[] appFolders = root.listFiles(new FilenameFilter() {
755
				public boolean accept(File dir, String name) {
757
				public boolean accept(File dir, String name) {
Lines 763-769 Link Here
763
					for (int j = 0; j < launcherFiles.length; j++) {
765
					for (int j = 0; j < launcherFiles.length; j++) {
764
						configurationData += " chmod(targetDir:${installFolder}/" + appFolders[i].getName() + "/Contents/MacOS/, targetFile:" + launcherFiles[j].getName() + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
766
						configurationData += " chmod(targetDir:${installFolder}/" + appFolders[i].getName() + "/Contents/MacOS/, targetFile:" + launcherFiles[j].getName() + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
765
						if (new Path(launcherFiles[j].getName()).getFileExtension() == null)
767
						if (new Path(launcherFiles[j].getName()).getFileExtension() == null)
766
							MetadataGeneratorHelper.generateLauncherSetter(launcherFiles[j].getName(), launcherId, launcherVersion, os, ws, arch, result.rootIUs);
768
							launcherNameIU = MetadataGeneratorHelper.generateLauncherSetter(launcherFiles[j].getName(), launcherId, launcherVersion, os, ws, arch, result.rootIUs);
767
					}
769
					}
768
				}
770
				}
769
			}
771
			}
Lines 773-781 Link Here
773
			for (int i = 0; i < launcherFiles.length; i++) {
775
			for (int i = 0; i < launcherFiles.length; i++) {
774
				configurationData += " chmod(targetDir:${installFolder}, targetFile:" + launcherFiles[i].getName() + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$
776
				configurationData += " chmod(targetDir:${installFolder}, targetFile:" + launcherFiles[i].getName() + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$
775
				if (new Path(launcherFiles[i].getName()).getFileExtension() == null)
777
				if (new Path(launcherFiles[i].getName()).getFileExtension() == null)
776
					MetadataGeneratorHelper.generateLauncherSetter(launcherFiles[i].getName(), launcherId, launcherVersion, os, ws, arch, result.rootIUs);
778
					launcherNameIU = MetadataGeneratorHelper.generateLauncherSetter(launcherFiles[i].getName(), launcherId, launcherVersion, os, ws, arch, result.rootIUs);
779
			}
780
		}
781
782
		if (launcherNameIU == null) {
783
			File executableLocation = info.getExecutableLocation();
784
			if (executableLocation != null) {
785
				if (!executableLocation.exists() && Constants.OS_WIN32.equals(os) && !executableLocation.getName().endsWith(".exe")) //$NON-NLS-1$
786
					executableLocation = new File(executableLocation.getParentFile(), executableLocation.getName() + ".exe"); //$NON-NLS-1$
787
788
				if (executableLocation.exists())
789
					launcherNameIU = MetadataGeneratorHelper.generateLauncherSetter(executableLocation.getName(), launcherId, launcherVersion, os, ws, arch, result.rootIUs);
777
			}
790
			}
778
		}
791
		}
792
779
		touchpointData.put("install", configurationData); //$NON-NLS-1$
793
		touchpointData.put("install", configurationData); //$NON-NLS-1$
780
		String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
794
		String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
781
		touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$
795
		touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$
Lines 785-793 Link Here
785
		//The Product Query will need to include the launcher CU fragments as a workaround to bug 218890
799
		//The Product Query will need to include the launcher CU fragments as a workaround to bug 218890
786
		if (result.configurationIUs.containsKey(launcherIdPrefix)) {
800
		if (result.configurationIUs.containsKey(launcherIdPrefix)) {
787
			((Set) result.configurationIUs.get(launcherIdPrefix)).add(unit);
801
			((Set) result.configurationIUs.get(launcherIdPrefix)).add(unit);
802
			if (launcherNameIU != null)
803
				((Set) result.configurationIUs.get(launcherIdPrefix)).add(launcherNameIU);
788
		} else {
804
		} else {
789
			Set set = new HashSet();
805
			Set set = new HashSet();
790
			set.add(unit);
806
			set.add(unit);
807
			if (launcherNameIU != null)
808
				set.add(launcherNameIU);
791
			result.configurationIUs.put(launcherIdPrefix, set);
809
			result.configurationIUs.put(launcherIdPrefix, set);
792
		}
810
		}
793
811
(-)src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java (-6 / +10 lines)
Lines 772-778 Link Here
772
		// TODO: shouldn't the filter for the group be constructed from os, ws, arch, nl
772
		// TODO: shouldn't the filter for the group be constructed from os, ws, arch, nl
773
		// 		 of the feature?
773
		// 		 of the feature?
774
		// iu.setFilter(filter);
774
		// iu.setFilter(filter);
775
		
775
776
		// Create set of provided capabilities
776
		// Create set of provided capabilities
777
		ArrayList providedCapabilities = new ArrayList();
777
		ArrayList providedCapabilities = new ArrayList();
778
		providedCapabilities.add(createSelfCapability(id, version));
778
		providedCapabilities.add(createSelfCapability(id, version));
Lines 923-945 Link Here
923
		return createArtifactDescriptor(key, launcher, false, true);
923
		return createArtifactDescriptor(key, launcher, false, true);
924
	}
924
	}
925
925
926
	public static void generateLauncherSetter(String launcherName, String iuId, Version version, String os, String ws, String arch, Set result) {
926
	public static IInstallableUnit generateLauncherSetter(String launcherName, String iuId, Version version, String os, String ws, String arch, Set result) {
927
		InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
927
		InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
928
		iud.setId(iuId + '.' + launcherName);
928
		iud.setId(iuId + '.' + launcherName);
929
		iud.setVersion(version);
929
		iud.setVersion(version);
930
		iud.setTouchpointType(MetadataGeneratorHelper.TOUCHPOINT_OSGI);
930
		iud.setTouchpointType(MetadataGeneratorHelper.TOUCHPOINT_OSGI);
931
		iud.setCapabilities(new ProvidedCapability[] {createSelfCapability(iuId + '.' + launcherName, version)});
931
932
932
		if (os != null || ws != null || arch != null) {
933
		if (os != null || ws != null || arch != null) {
933
			String filterOs = os != null ? "(os=" + os + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
934
			String filterOs = os != null ? "(osgi.os=" + os + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
934
			String filterWs = ws != null ? "(ws=" + ws + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
935
			String filterWs = ws != null ? "(osgi.ws=" + ws + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
935
			String filterArch = arch != null ? "(arch=" + arch + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
936
			String filterArch = arch != null ? "(osgi.arch=" + arch + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
936
			iud.setFilter("(& " + filterOs + filterWs + filterArch + ")"); //$NON-NLS-1$ //$NON-NLS-2$
937
			iud.setFilter("(& " + filterOs + filterWs + filterArch + ")"); //$NON-NLS-1$ //$NON-NLS-2$
937
		}
938
		}
938
		Map touchpointData = new HashMap();
939
		Map touchpointData = new HashMap();
939
		touchpointData.put("configure", "setLauncherName(name:" + launcherName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
940
		touchpointData.put("configure", "setLauncherName(name:" + launcherName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
940
		touchpointData.put("unconfigure", "setLauncherName()"); //$NON-NLS-1$ //$NON-NLS-2$
941
		touchpointData.put("unconfigure", "setLauncherName()"); //$NON-NLS-1$ //$NON-NLS-2$
941
		iud.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
942
		iud.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
942
		result.add(MetadataFactory.createInstallableUnit(iud));
943
944
		IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
945
		result.add(iu);
946
		return iu;
943
	}
947
	}
944
948
945
	public static ProvidedCapability createSelfCapability(String installableUnitId, Version installableUnitVersion) {
949
	public static ProvidedCapability createSelfCapability(String installableUnitId, Version installableUnitVersion) {

Return to bug 219866