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 92420 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/build/BuildFeatureAction.java (-1 lines)
Lines 49-55 Link Here
49
		generator.setBuildingOSGi(PDECore.getDefault().getModelManager().isOSGiRuntime());
49
		generator.setBuildingOSGi(PDECore.getDefault().getModelManager().isOSGiRuntime());
50
		generator.setChildren(true);
50
		generator.setChildren(true);
51
		AbstractScriptGenerator.setEmbeddedSource(AbstractScriptGenerator.getDefaultEmbeddedSource());
51
		AbstractScriptGenerator.setEmbeddedSource(AbstractScriptGenerator.getDefaultEmbeddedSource());
52
		AbstractBuildScriptGenerator.setBrandExecutable(false);
53
52
54
		String url = ClasspathHelper.getDevEntriesProperties(fManifestFile.getProject().getLocation().addTrailingSeparator().toString() + "dev.properties", false); //$NON-NLS-1$
53
		String url = ClasspathHelper.getDevEntriesProperties(fManifestFile.getProject().getLocation().addTrailingSeparator().toString() + "dev.properties", false); //$NON-NLS-1$
55
		generator.setDevEntries(url);
54
		generator.setDevEntries(url);
(-)src/org/eclipse/pde/internal/ui/build/BuildPluginAction.java (-1 lines)
Lines 29-35 Link Here
29
		ModelBuildScriptGenerator.setEmbeddedSource(AbstractScriptGenerator.getDefaultEmbeddedSource());
29
		ModelBuildScriptGenerator.setEmbeddedSource(AbstractScriptGenerator.getDefaultEmbeddedSource());
30
		ModelBuildScriptGenerator.setForceUpdateJar(AbstractScriptGenerator.getForceUpdateJarFormat());
30
		ModelBuildScriptGenerator.setForceUpdateJar(AbstractScriptGenerator.getForceUpdateJarFormat());
31
		ModelBuildScriptGenerator.setConfigInfo(AbstractScriptGenerator.getDefaultConfigInfos());
31
		ModelBuildScriptGenerator.setConfigInfo(AbstractScriptGenerator.getDefaultConfigInfos());
32
		AbstractBuildScriptGenerator.setBrandExecutable(false);
33
		
32
		
34
		IProject project = fManifestFile.getProject();
33
		IProject project = fManifestFile.getProject();
35
		generator.setWorkingDirectory(project.getLocation().toOSString());
34
		generator.setWorkingDirectory(project.getLocation().toOSString());
(-)src/org/eclipse/pde/internal/ui/build/ProductExportJob.java (-53 / +60 lines)
Lines 32-44 Link Here
32
32
33
public class ProductExportJob extends FeatureExportJob {
33
public class ProductExportJob extends FeatureExportJob {
34
	
34
	
35
	private IProduct fProduct;
36
37
	private String fFeatureLocation;
35
	private String fFeatureLocation;
38
36
39
	private String fRoot;
37
	private String fRoot;
40
38
41
	public ProductExportJob(IProductModel model, String productRoot, boolean toDirectory, boolean exportSource, String destination, String zipFileName) {
39
	public ProductExportJob(IProductModel model, String productRoot, boolean toDirectory, boolean exportSource, String destination, String zipFileName, String[][] targets) {
42
		super(PDEUIMessages.ProductExportJob_jobName); //$NON-NLS-1$
40
		super(PDEUIMessages.ProductExportJob_jobName); //$NON-NLS-1$
43
		fProduct = model.getProduct();
41
		fProduct = model.getProduct();
44
		fExportToDirectory = toDirectory;
42
		fExportToDirectory = toDirectory;
Lines 46-51 Link Here
46
		fDestinationDirectory = destination;
44
		fDestinationDirectory = destination;
47
		fZipFilename = zipFileName;
45
		fZipFilename = zipFileName;
48
		fRoot = productRoot;
46
		fRoot = productRoot;
47
		ftargets = targets;
48
		// TODO remove when there is UI to set ftargets
49
		if (ftargets == null)
50
			ftargets = new String[][] { { "linux", "gtk", "x86", ""} , {"win32", "win32", "x86", ""} };
49
		if (fProduct.useFeatures()) {
51
		if (fProduct.useFeatures()) {
50
			fItems = getFeatureModels();
52
			fItems = getFeatureModels();
51
		} else {
53
		} else {
Lines 83-112 Link Here
83
85
84
	protected void doExports(IProgressMonitor monitor)
86
	protected void doExports(IProgressMonitor monitor)
85
			throws InvocationTargetException, CoreException {
87
			throws InvocationTargetException, CoreException {
86
		try {
88
		String[][] configurations = ftargets;
87
            monitor.beginTask("", 10);
89
		if (configurations == null)
88
			// create a feature to wrap all plug-ins and features
90
			configurations = new String[][] { {TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL() } };
89
			String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
91
		for (int i = 0; i < configurations.length; i++) {
90
			fFeatureLocation = fBuildTempLocation + File.separator + featureID;
92
			try {
91
			createFeature(featureID, fFeatureLocation);
93
				String[] config = configurations[i];
92
			createBuildPropertiesFile(fFeatureLocation);
94
	            monitor.beginTask("", 10);
93
			createConfigIniFile();
95
				// create a feature to wrap all plug-ins and features
94
			createEclipseProductFile();
96
				String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
95
			createLauncherIniFile();
97
				fFeatureLocation = fBuildTempLocation + File.separator + featureID;
96
			doExport(featureID, 
98
				createFeature(featureID, fFeatureLocation, config, true);
97
                        null, 
99
				createBuildPropertiesFile(fFeatureLocation);
98
                        fFeatureLocation, 
100
				createConfigIniFile();
99
                        TargetPlatform.getOS(),
101
				createEclipseProductFile();
100
                        TargetPlatform.getWS(), 
102
				createLauncherIniFile();
101
                        TargetPlatform.getOSArch(), 
103
				doExport(featureID, 
102
                        new SubProgressMonitor(monitor, 7));
104
	                        null, 
103
		} catch (IOException e) {
105
	                        fFeatureLocation, 
104
		} finally {
106
	                        config[0], 
105
			for (int i = 0; i < fItems.length; i++) {
107
	                        config[1], 
106
				deleteBuildFiles((IModel)fItems[i]);
108
	                        config[2], 
109
	                        new SubProgressMonitor(monitor, 7));
110
			} catch (IOException e) {
111
			} finally {
112
				for (int j = 0; j < fItems.length; j++) {
113
					deleteBuildFiles((IModel)fItems[j]);
114
				}
115
				cleanup(ftargets == null ? null : configurations[i], new SubProgressMonitor(monitor, 3));
116
				monitor.done();
107
			}
117
			}
108
			cleanup(new SubProgressMonitor(monitor, 3));
109
			monitor.done();
110
		}
118
		}
111
	}
119
	}
112
	
120
	
Lines 140-178 Link Here
140
		File file = new File(featureLocation);
148
		File file = new File(featureLocation);
141
		if (!file.exists() || !file.isDirectory())
149
		if (!file.exists() || !file.isDirectory())
142
			file.mkdirs();
150
			file.mkdirs();
151
		boolean hasLaunchers = false;
152
		IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().getModels();
153
		for (int i = 0; i < models.length; i++) {
154
			if ("org.eclipse.platform.launchers".equals(models[i].getFeature().getId()))
155
				hasLaunchers = true;
156
		}
143
157
144
		Properties properties = new Properties();
158
		Properties properties = new Properties();
145
		properties.put(IBuildPropertiesConstants.ROOT, getRootFileLocations()); //To copy a folder
159
		properties.put(IBuildPropertiesConstants.ROOT, getRootFileLocations(hasLaunchers)); //To copy a folder
146
		properties.put("root.permissions.755", getLauncherName()); //$NON-NLS-1$
160
		if (!hasLaunchers) {
147
		if (TargetPlatform.getOS().equals("linux")) { //$NON-NLS-1$
161
			properties.put("root.permissions.755", getLauncherName()); //$NON-NLS-1$
148
			properties.put("root.linux.motif.x86.link", "libXm.so.2.1,libXm.so.2,libXm.so.2.1,libXm.so"); //$NON-NLS-1$ //$NON-NLS-2$
162
			if (TargetPlatform.getOS().equals("linux")) { //$NON-NLS-1$
149
			properties.put("root.linux.motif.x86.permissions.755", "*.so*"); //$NON-NLS-1$ //$NON-NLS-2$
163
				properties.put("root.linux.motif.x86.link", "libXm.so.2.1,libXm.so.2,libXm.so.2.1,libXm.so"); //$NON-NLS-1$ //$NON-NLS-2$
164
				properties.put("root.linux.motif.x86.permissions.755", "*.so*"); //$NON-NLS-1$ //$NON-NLS-2$
165
			}
150
		}
166
		}
151
		save(new File(file, "build.properties"), properties, "Build Configuration"); //$NON-NLS-1$ //$NON-NLS-2$
167
		save(new File(file, "build.properties"), properties, "Build Configuration"); //$NON-NLS-1$ //$NON-NLS-2$
152
	}
168
	}
153
	
169
	
154
	private String getRootFileLocations() {
170
	private String getRootFileLocations(boolean hasLaunchers) {
155
		StringBuffer buffer = new StringBuffer();
171
		StringBuffer buffer = new StringBuffer();
156
		
172
157
		File homeDir = ExternalModelManager.getEclipseHome().toFile();
173
		if (!hasLaunchers) {
158
		if (homeDir.exists() && homeDir.isDirectory()) {
174
			File homeDir = ExternalModelManager.getEclipseHome().toFile();
159
			File[] files = homeDir.listFiles();
175
			if (homeDir.exists() && homeDir.isDirectory()) {
160
			for (int i = 0; i < files.length; i++) {
176
				buffer.append("absolute:file:"); //$NON-NLS-1$
161
				// TODO for now copy everything except .eclipseproduct
177
				buffer.append(new File(homeDir, "eclipse").getAbsolutePath());
162
				// Once the branded executable is generated, we should not copy
178
				buffer.append(","); //$NON-NLS-1$
163
				// eclipse.exe nor icon.xpm
179
				buffer.append(new File(homeDir, "eclipse.exe").getAbsolutePath());
164
				if (files[i].isFile() && !files[i].getName().startsWith(".")  //$NON-NLS-1$
180
				buffer.append(","); //$NON-NLS-1$
165
						&& !files[i].getName().endsWith(".html")) { //$NON-NLS-1$
181
				buffer.append(new File(homeDir, "startup.jar").getAbsolutePath());
166
					buffer.append("absolute:file:"); //$NON-NLS-1$
182
				buffer.append(","); //$NON-NLS-1$
167
					buffer.append(files[i].getAbsolutePath());
183
			}	
168
					buffer.append(","); //$NON-NLS-1$
169
				}	
170
			}		
171
		}
184
		}
172
		// add content of temp folder (.eclipseproduct, configuration/config.ini)
185
		// add content of temp folder (.eclipseproduct, configuration/config.ini)
173
		buffer.append("/temp/"); //$NON-NLS-1$
186
		buffer.append("/temp/"); //$NON-NLS-1$
174
		buffer.append(","); //$NON-NLS-1$
175
176
		return buffer.toString();
187
		return buffer.toString();
177
	}
188
	}
178
	
189
	
Lines 319-328 Link Here
319
		return buffer.toString();
330
		return buffer.toString();
320
	}
331
	}
321
	
332
	
322
	protected boolean needBranding() {
323
		return true;
324
	}
325
	
326
	protected HashMap createAntBuildProperties(String os, String ws, String arch) {
333
	protected HashMap createAntBuildProperties(String os, String ws, String arch) {
327
		HashMap properties = super.createAntBuildProperties(os, ws, arch);
334
		HashMap properties = super.createAntBuildProperties(os, ws, arch);
328
		properties.put(IXMLConstants.PROPERTY_LAUNCHER_NAME, getLauncherName());
335
		properties.put(IXMLConstants.PROPERTY_LAUNCHER_NAME, getLauncherName());
(-)src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportJob.java (-44 / +116 lines)
Lines 21-26 Link Here
21
import org.eclipse.core.runtime.jobs.*;
21
import org.eclipse.core.runtime.jobs.*;
22
import org.eclipse.jdt.core.*;
22
import org.eclipse.jdt.core.*;
23
import org.eclipse.jface.dialogs.*;
23
import org.eclipse.jface.dialogs.*;
24
import org.eclipse.osgi.service.resolver.BundleDescription;
25
import org.eclipse.osgi.service.resolver.State;
24
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.pde.core.*;
27
import org.eclipse.pde.core.*;
26
import org.eclipse.pde.core.build.*;
28
import org.eclipse.pde.core.build.*;
Lines 30-35 Link Here
30
import org.eclipse.pde.internal.core.build.*;
32
import org.eclipse.pde.internal.core.build.*;
31
import org.eclipse.pde.internal.core.feature.FeatureChild;
33
import org.eclipse.pde.internal.core.feature.FeatureChild;
32
import org.eclipse.pde.internal.core.ifeature.*;
34
import org.eclipse.pde.internal.core.ifeature.*;
35
import org.eclipse.pde.internal.core.iproduct.IProduct;
33
import org.eclipse.pde.internal.core.util.CoreUtility;
36
import org.eclipse.pde.internal.core.util.CoreUtility;
34
import org.eclipse.pde.internal.ui.*;
37
import org.eclipse.pde.internal.ui.*;
35
import org.eclipse.pde.internal.ui.build.*;
38
import org.eclipse.pde.internal.ui.build.*;
Lines 58-66 Link Here
58
	protected HashMap fAntBuildProperties;
61
	protected HashMap fAntBuildProperties;
59
	private String[] fSigningInfo = null;
62
	private String[] fSigningInfo = null;
60
	private String[] fJnlpInfo = null;
63
	private String[] fJnlpInfo = null;
61
	
64
	protected IProduct fProduct = null;
65
62
	protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$
66
	protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$
63
	protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$
67
	protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$
68
	protected String[][] ftargets;
64
69
65
	class SchedulingRule implements ISchedulingRule {
70
	class SchedulingRule implements ISchedulingRule {
66
71
Lines 85-91 Link Here
85
		setRule(new SchedulingRule());
90
		setRule(new SchedulingRule());
86
	}
91
	}
87
	
92
	
88
	public FeatureExportJob(boolean toDirectory, boolean useJarFormat, boolean exportSource, String destination, String zipFileName, Object[] items, String[] signingInfo, String[] jnlpInfo) {
93
	public FeatureExportJob(boolean toDirectory, boolean useJarFormat, boolean exportSource, String destination, String zipFileName, Object[] items, String[] signingInfo, String[] jnlpInfo, String[][] targets) {
89
		super(PDEUIMessages.FeatureExportJob_name); //$NON-NLS-1$
94
		super(PDEUIMessages.FeatureExportJob_name); //$NON-NLS-1$
90
		fExportToDirectory = toDirectory;
95
		fExportToDirectory = toDirectory;
91
		fUseJarFormat = useJarFormat;
96
		fUseJarFormat = useJarFormat;
Lines 95-106 Link Here
95
		fItems = items;
100
		fItems = items;
96
		fSigningInfo = signingInfo;
101
		fSigningInfo = signingInfo;
97
		fJnlpInfo = jnlpInfo;
102
		fJnlpInfo = jnlpInfo;
103
		ftargets = targets;
104
		// TODO remove when there is UI to set ftargets
105
//		if (ftargets == null)
106
//			ftargets = new String[][] { { "linux", "gtk", "x86", ""} , {"win32", "win32", "x86", ""} };
98
		fBuildTempLocation = PDEPlugin.getDefault().getStateLocation().append("temp").toString(); //$NON-NLS-1$
107
		fBuildTempLocation = PDEPlugin.getDefault().getStateLocation().append("temp").toString(); //$NON-NLS-1$
99
		setRule(new SchedulingRule());
108
		setRule(new SchedulingRule());
100
	}
109
	}
101
110
102
	public FeatureExportJob(boolean toDirectory, boolean useJarFormat, boolean exportSource, String destination, String zipFileName, Object[] items) {
111
	public FeatureExportJob(boolean toDirectory, boolean useJarFormat, boolean exportSource, String destination, String zipFileName, Object[] items) {
103
		this(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, null, null);
112
		this(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, null, null, null);
104
	}
113
	}
105
114
106
	/*
115
	/*
Lines 150-179 Link Here
150
	protected void doExports(IProgressMonitor monitor) throws InvocationTargetException, CoreException {
159
	protected void doExports(IProgressMonitor monitor) throws InvocationTargetException, CoreException {
151
		createDestination();
160
		createDestination();
152
		monitor.beginTask("", fItems.length + 1); //$NON-NLS-1$
161
		monitor.beginTask("", fItems.length + 1); //$NON-NLS-1$
153
		try {
162
		String[][] configurations = ftargets;
154
			for (int i = 0; i < fItems.length; i++) {
163
		if (configurations == null)
155
				if (monitor.isCanceled())
164
			configurations = new String[][] { null };
156
					throw new OperationCanceledException();
165
		
157
				IFeatureModel model = (IFeatureModel) fItems[i];
166
		for (int i = 0; i < configurations.length; i++) {
158
				try {
167
			try {
159
					String location = model.getInstallLocation();
168
				for (int j = 0; j < fItems.length; j++) {
160
					if (fUseJarFormat) {
169
					if (monitor.isCanceled())
161
						createPostProcessingFile(new File(location, FEATURE_POST_PROCESSING));
170
						throw new OperationCanceledException();
162
						createPostProcessingFile(new File(location, PLUGIN_POST_PROCESSING));
171
					doExport((IFeatureModel) fItems[j], configurations[i], monitor);
163
					}
164
					IFeature feature = model.getFeature();
165
					String id = feature.getId();
166
					String os = getOS(feature);
167
					String ws = getWS(feature);
168
					String arch = getOSArch(feature);
169
					doExport(id, model.getFeature().getVersion(), model.getInstallLocation(), os, ws, arch, new SubProgressMonitor(monitor, 1));
170
				} finally {
171
					deleteBuildFiles(model);
172
				}
172
				}
173
			} finally {
174
				cleanup(configurations[i], new SubProgressMonitor(monitor, 1));
175
				monitor.done();
176
			}
177
		}
178
	}
179
180
	private void doExport(IFeatureModel model, String os, String ws, String arch, IProgressMonitor monitor) throws CoreException, InvocationTargetException {
181
		try {
182
			String location = model.getInstallLocation();
183
			if (fUseJarFormat) {
184
				createPostProcessingFile(new File(location, FEATURE_POST_PROCESSING));
185
				createPostProcessingFile(new File(location, PLUGIN_POST_PROCESSING));
173
			}
186
			}
187
			IFeature feature = model.getFeature();
188
			doExport(feature.getId(), feature.getVersion(), location, os, ws, arch, new SubProgressMonitor(monitor, 1));
174
		} finally {
189
		} finally {
175
			cleanup(new SubProgressMonitor(monitor, 1));
190
			deleteBuildFiles(model);
176
			monitor.done();
177
		}
191
		}
178
	}
192
	}
179
	
193
	
Lines 224-229 Link Here
224
		}
238
		}
225
	}
239
	}
226
240
241
	private void createDestination(String os, String ws, String arch) throws InvocationTargetException {
242
		if (!fExportToDirectory)
243
			return;
244
		File file = new File(fDestinationDirectory, os + '.' + ws + '.' + arch);
245
		if (!file.exists() || !file.isDirectory()) {
246
			if (!file.mkdirs())
247
				throw new InvocationTargetException(new Exception(PDEUIMessages.ExportWizard_badDirectory)); //$NON-NLS-1$
248
		}
249
	}
250
251
	protected void doExport(IFeatureModel model, String[] config, IProgressMonitor monitor) throws CoreException, InvocationTargetException {
252
		// TODO progress monitoring
253
		if (config == null) {
254
			IFeature feature = model.getFeature();
255
			doExport(model, getOS(feature), getWS(feature), getOSArch(feature), monitor);
256
		} else {
257
			createDestination(config[0], config[1], config[2]);
258
			doExport(model, config[0], config[1], config[2], monitor);
259
		}
260
	}
261
		
227
	protected void doExport(String featureID, String version, String featureLocation, String os, String ws, String arch, IProgressMonitor monitor) throws CoreException, InvocationTargetException {
262
	protected void doExport(String featureID, String version, String featureLocation, String os, String ws, String arch, IProgressMonitor monitor) throws CoreException, InvocationTargetException {
228
		monitor.beginTask("", 5); //$NON-NLS-1$
263
		monitor.beginTask("", 5); //$NON-NLS-1$
229
		monitor.setTaskName(PDEUIMessages.FeatureExportJob_taskName); //$NON-NLS-1$
264
		monitor.setTaskName(PDEUIMessages.FeatureExportJob_taskName); //$NON-NLS-1$
Lines 249-261 Link Here
249
				+ ".xml"; //$NON-NLS-1$
284
				+ ".xml"; //$NON-NLS-1$
250
	}
285
	}
251
286
252
	protected boolean needBranding() {
253
		return false;
254
	}
255
256
	protected HashMap createAntBuildProperties(String os, String ws, String arch) {
287
	protected HashMap createAntBuildProperties(String os, String ws, String arch) {
257
		AbstractScriptGenerator.setBrandExecutable(needBranding());
258
259
		if (fAntBuildProperties == null) {
288
		if (fAntBuildProperties == null) {
260
			fAntBuildProperties = new HashMap(15);
289
			fAntBuildProperties = new HashMap(15);
261
			if (fSigningInfo != null) {
290
			if (fSigningInfo != null) {
Lines 291-300 Link Here
291
			fAntBuildProperties.put(IXMLConstants.PROPERTY_COLLECTING_FOLDER, "."); //$NON-NLS-1$
320
			fAntBuildProperties.put(IXMLConstants.PROPERTY_COLLECTING_FOLDER, "."); //$NON-NLS-1$
292
			String prefix = Platform.getOS().equals("macosx") ? "." : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
321
			String prefix = Platform.getOS().equals("macosx") ? "." : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
293
			fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_PREFIX, prefix);
322
			fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_PREFIX, prefix);
294
			if (!fExportToDirectory)
323
295
				fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_FULLPATH, fDestinationDirectory + File.separator + fZipFilename);
324
			if (!fExportToDirectory) {
296
			else
325
				String filename = fZipFilename;
297
				fAntBuildProperties.put(IXMLConstants.PROPERTY_ASSEMBLY_TMP, fDestinationDirectory);
326
				if (ftargets != null) {
327
					int i = filename.lastIndexOf('.');
328
					filename = filename.substring(0, i) + '.' + os + '.' + ws + '.' + arch + filename.substring(i);
329
				}
330
				fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_FULLPATH, fDestinationDirectory + File.separator + filename);
331
			} else {
332
				String dir = fDestinationDirectory;
333
				if (ftargets != null)
334
					dir += File.separatorChar + os + '.' + ws + '.' + arch;
335
				fAntBuildProperties.put(IXMLConstants.PROPERTY_ASSEMBLY_TMP, dir);
336
			}
298
			fAntBuildProperties.put(IXMLConstants.PROPERTY_TAR_ARGS, ""); //$NON-NLS-1$
337
			fAntBuildProperties.put(IXMLConstants.PROPERTY_TAR_ARGS, ""); //$NON-NLS-1$
299
		}
338
		}
300
		return fAntBuildProperties;
339
		return fAntBuildProperties;
Lines 312-317 Link Here
312
		generator.setIgnoreMissingPropertiesFile(true);
351
		generator.setIgnoreMissingPropertiesFile(true);
313
		generator.setSignJars(fSigningInfo != null);
352
		generator.setSignJars(fSigningInfo != null);
314
		generator.setGenerateJnlp(fJnlpInfo != null);
353
		generator.setGenerateJnlp(fJnlpInfo != null);
354
		if (fProduct != null)
355
			generator.setProduct(fProduct.getModel().getInstallLocation());
315
		String config = os + ',' + ws + ',' + arch;
356
		String config = os + ',' + ws + ',' + arch;
316
		AbstractScriptGenerator.setConfigInfo(config);  //This needs to be set before we set the format
357
		AbstractScriptGenerator.setConfigInfo(config);  //This needs to be set before we set the format
317
		String format;
358
		String format;
Lines 455-461 Link Here
455
			paths.add(models[i].getInstallLocation() + IPath.SEPARATOR + "feature.xml"); //$NON-NLS-1$
496
			paths.add(models[i].getInstallLocation() + IPath.SEPARATOR + "feature.xml"); //$NON-NLS-1$
456
		}
497
		}
457
498
458
		String[] plugins = TargetPlatform.createPluginPath();
499
		// Old code was:
500
//		String[] plugins = TargetPlatform.createPluginPath();
501
		// But here we need to find ALL plugins, not just the resolved ones
502
		State state = TargetPlatform.getState();
503
		BundleDescription[] descriptions = state.getBundles();
504
		String[] plugins = new String[descriptions.length];
505
		for (int i = 0; i < descriptions.length; i++) 
506
			plugins[i] = descriptions[i].getLocation();
507
459
		String[] features = (String[]) paths.toArray(new String[paths.size()]);
508
		String[] features = (String[]) paths.toArray(new String[paths.size()]);
460
		String[] all = new String[plugins.length + paths.size()];
509
		String[] all = new String[plugins.length + paths.size()];
461
		System.arraycopy(plugins, 0, all, 0, plugins.length);
510
		System.arraycopy(plugins, 0, all, 0, plugins.length);
Lines 482-497 Link Here
482
		return writer;
531
		return writer;
483
	}
532
	}
484
533
485
	protected void cleanup(IProgressMonitor monitor) {
534
	protected void cleanup(String[] config, IProgressMonitor monitor) {
486
        monitor.beginTask("", 2);
535
        monitor.beginTask("", 2);
536
        // clear out some cached values that depend on the configuration being built.
537
        fDevProperties = null;
538
        fAntBuildProperties = null;
539
487
		File scriptFile = null;
540
		File scriptFile = null;
488
		try {
541
		try {
489
			scriptFile = createScriptFile();
542
			scriptFile = createScriptFile();
490
			writer = new PrintWriter(new FileWriter(scriptFile), true);
543
			writer = new PrintWriter(new FileWriter(scriptFile), true);
491
			generateHeader(writer);
544
			generateHeader(writer);
492
			generateDeleteZipTarget(writer);
545
			generateDeleteZipTarget(writer, config);
493
			generateCleanTarget(writer);
546
			generateCleanTarget(writer);
494
			boolean errors = generateZipLogsTarget(writer);
547
			boolean errors = generateZipLogsTarget(writer, config);
495
			generateClosingTag(writer);
548
			generateClosingTag(writer);
496
			writer.close();
549
			writer.close();
497
550
Lines 534-549 Link Here
534
		writer.println("</target>"); //$NON-NLS-1$
587
		writer.println("</target>"); //$NON-NLS-1$
535
	}
588
	}
536
589
537
	private void generateDeleteZipTarget(PrintWriter writer) {
590
	private String logName(String[] config) {
591
		if (config == null)
592
			return "/logs.zip";
593
		return "/logs." + config[0] + '.' + config[1] + '.' + config[2] + ".zip"; 
594
	}
595
	private void generateDeleteZipTarget(PrintWriter writer, String[] config) {
538
		writer.println("<target name=\"deleteZip\">"); //$NON-NLS-1$
596
		writer.println("<target name=\"deleteZip\">"); //$NON-NLS-1$
539
		writer.println("<delete file=\"" + fDestinationDirectory + "/logs.zip\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
597
		writer.println("<delete file=\"" + fDestinationDirectory + logName(config) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
540
		writer.println("</target>"); //$NON-NLS-1$
598
		writer.println("</target>"); //$NON-NLS-1$
541
	}
599
	}
542
600
543
	private boolean generateZipLogsTarget(PrintWriter writer) {
601
	private boolean generateZipLogsTarget(PrintWriter writer, String[] config) {
544
		if (logFile != null && logFile.exists() && logFile.length() > 0) {
602
		if (logFile != null && logFile.exists() && logFile.length() > 0) {
545
			writer.println("<target name=\"zip.logs\">"); //$NON-NLS-1$
603
			writer.println("<target name=\"zip.logs\">"); //$NON-NLS-1$
546
			writer.println("<zip zipfile=\"" + fDestinationDirectory + "/logs.zip\" basedir=\"" + fBuildTempLocation + "/pde.logs\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
604
			writer.println("<zip zipfile=\"" + fDestinationDirectory + logName(config) + "\" basedir=\"" + fBuildTempLocation + "/pde.logs\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
547
			writer.println("</target>"); //$NON-NLS-1$
605
			writer.println("</target>"); //$NON-NLS-1$
548
			return true;
606
			return true;
549
		}
607
		}
Lines 577-583 Link Here
577
		return NLS.bind(PDEUIMessages.ExportJob_error_message, fDestinationDirectory + File.separator + "logs.zip"); //$NON-NLS-1$ //$NON-NLS-2$
635
		return NLS.bind(PDEUIMessages.ExportJob_error_message, fDestinationDirectory + File.separator + "logs.zip"); //$NON-NLS-1$ //$NON-NLS-2$
578
	}
636
	}
579
    
637
    
580
    protected void createFeature(String featureID, String featureLocation) throws IOException {
638
    protected void createFeature(String featureID, String featureLocation, String[] config, boolean includeLauncher) throws IOException {
581
        File file = new File(featureLocation);
639
        File file = new File(featureLocation);
582
        if (!file.exists() || !file.isDirectory())
640
        if (!file.exists() || !file.isDirectory())
583
            file.mkdirs();
641
            file.mkdirs();
Lines 588-594 Link Here
588
        writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
646
        writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
589
        writer.println("<feature id=\"" + featureID + "\" version=\"1.0\">"); //$NON-NLS-1$ //$NON-NLS-2$
647
        writer.println("<feature id=\"" + featureID + "\" version=\"1.0\">"); //$NON-NLS-1$ //$NON-NLS-2$
590
648
591
        Dictionary environment = TargetPlatform.getTargetEnvironment();
649
		if (includeLauncher) {
650
			IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().getModels();
651
			for (int i = 0; i < models.length; i++) {
652
				IFeature feature = models[i].getFeature();
653
				if ("org.eclipse.platform.launchers".equals(feature.getId()))
654
			        writer.println("<includes id=\"" + feature.getId() + "\" version=\"" + feature.getVersion() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
655
			}
656
		}
657
658
        Dictionary environment = new Hashtable(4);
659
        environment.put("osgi.os", config[0]);
660
        environment.put("osgi.ws", config[1]);
661
        environment.put("osgi.arch", config[2]);
662
        environment.put("osgi.nl", config[3]);
663
        	
592
        BundleContext context = PDEPlugin.getDefault().getBundleContext();
664
        BundleContext context = PDEPlugin.getDefault().getBundleContext();
593
        for (int i = 0; i < fItems.length; i++) {
665
        for (int i = 0; i < fItems.length; i++) {
594
            if (fItems[i] instanceof IPluginModelBase) {
666
            if (fItems[i] instanceof IPluginModelBase) {
(-)src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java (-1 / +2 lines)
Lines 46-52 Link Here
46
				fPage1.getFileName(),
46
				fPage1.getFileName(),
47
				((ExportWizardPageWithTable)fPage1).getSelectedItems(),
47
				((ExportWizardPageWithTable)fPage1).getSelectedItems(),
48
				signingInfo,
48
				signingInfo,
49
				jnlpInfo);
49
				jnlpInfo,
50
				null);
50
		job.setUser(true);
51
		job.setUser(true);
51
		job.schedule();
52
		job.schedule();
52
		job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ);
53
		job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ);
(-)src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportJob.java (-3 / +4 lines)
Lines 40-46 Link Here
40
			String zipFileName,
40
			String zipFileName,
41
			Object[] items,
41
			Object[] items,
42
			String[] signingInfo) {
42
			String[] signingInfo) {
43
			super(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, signingInfo, null);
43
			super(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, signingInfo, null, null);
44
		}
44
		}
45
45
46
	/* (non-Javadoc)
46
	/* (non-Javadoc)
Lines 53-59 Link Here
53
			// create a feature to contain all plug-ins
53
			// create a feature to contain all plug-ins
54
			String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
54
			String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$
55
			fFeatureLocation = fBuildTempLocation + File.separator + featureID;
55
			fFeatureLocation = fBuildTempLocation + File.separator + featureID;
56
			createFeature(featureID, fFeatureLocation);
56
			String[] config = new String[] {TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL() };
57
			createFeature(featureID, fFeatureLocation, config, false);
57
			createBuildPropertiesFile(fFeatureLocation);
58
			createBuildPropertiesFile(fFeatureLocation);
58
			if (fUseJarFormat)
59
			if (fUseJarFormat)
59
				createPostProcessingFile(new File(fFeatureLocation, PLUGIN_POST_PROCESSING));
60
				createPostProcessingFile(new File(fFeatureLocation, PLUGIN_POST_PROCESSING));
Lines 65-71 Link Here
65
				if (fItems[i] instanceof IPluginModelBase)
66
				if (fItems[i] instanceof IPluginModelBase)
66
					deleteBuildFiles((IPluginModelBase)fItems[i]);
67
					deleteBuildFiles((IPluginModelBase)fItems[i]);
67
			}
68
			}
68
			cleanup(new SubProgressMonitor(monitor, 3));
69
			cleanup(null, new SubProgressMonitor(monitor, 3));
69
			monitor.done();
70
			monitor.done();
70
		}
71
		}
71
	}
72
	}
(-)src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java (-1 / +2 lines)
Lines 62-68 Link Here
62
										page.doExportToDirectory(),
62
										page.doExportToDirectory(),
63
										page.doExportSource(), 
63
										page.doExportSource(), 
64
										page.getDestination(), 
64
										page.getDestination(), 
65
										page.getFileName());
65
										page.getFileName(),
66
										null);
66
		job.setUser(true);
67
		job.setUser(true);
67
		job.schedule();
68
		job.schedule();
68
		job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ);
69
		job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ);

Return to bug 92420