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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java (-20 / +25 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 74-80 Link Here
74
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
74
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
75
import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin;
75
import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin;
76
import org.eclipse.pde.internal.core.util.CoreUtility;
76
import org.eclipse.pde.internal.core.util.CoreUtility;
77
import org.osgi.framework.BundleContext;
78
import org.osgi.framework.InvalidSyntaxException;
77
import org.osgi.framework.InvalidSyntaxException;
79
import org.w3c.dom.DOMException;
78
import org.w3c.dom.DOMException;
80
import org.w3c.dom.Document;
79
import org.w3c.dom.Document;
Lines 93-99 Link Here
93
92
94
	protected HashMap fAntBuildProperties;
93
	protected HashMap fAntBuildProperties;
95
94
96
	private State fStateCopy;
95
	protected State fStateCopy;
97
96
98
	protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$
97
	protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$
99
	protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$
98
	protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$
Lines 480-488 Link Here
480
			return main;
479
			return main;
481
		} 			
480
		} 			
482
		if (fStateCopy == null) {
481
		if (fStateCopy == null) {
483
			fStateCopy = main.getFactory().createState(main);
482
			copyState(main);
484
			fStateCopy.setResolver(Platform.getPlatformAdmin().getResolver());
485
			fStateCopy.setPlatformProperties(main.getPlatformProperties());
486
		}
483
		}
487
		
484
		
488
		Dictionary[] dictionaries = fStateCopy.getPlatformProperties();
485
		Dictionary[] dictionaries = fStateCopy.getPlatformProperties();
Lines 496-501 Link Here
496
		return fStateCopy;
493
		return fStateCopy;
497
	}
494
	}
498
	
495
	
496
	protected void copyState(State state) {
497
		fStateCopy = state.getFactory().createState(state);
498
		fStateCopy.setResolver(Platform.getPlatformAdmin().getResolver());
499
		fStateCopy.setPlatformProperties(state.getPlatformProperties());
500
	}
501
	
499
	private String getDevProperties() {
502
	private String getDevProperties() {
500
		if (fDevProperties == null) {
503
		if (fDevProperties == null) {
501
			fDevProperties = ClasspathHelper.getDevEntriesProperties(fBuildTempLocation + "/dev.properties", false); //$NON-NLS-1$
504
			fDevProperties = ClasspathHelper.getDevEntriesProperties(fBuildTempLocation + "/dev.properties", false); //$NON-NLS-1$
Lines 629-636 Link Here
629
            environment.put("osgi.ws", config[1]); //$NON-NLS-1$
632
            environment.put("osgi.ws", config[1]); //$NON-NLS-1$
630
            environment.put("osgi.arch", config[2]); //$NON-NLS-1$
633
            environment.put("osgi.arch", config[2]); //$NON-NLS-1$
631
            environment.put("osgi.nl", config[3]); //$NON-NLS-1$
634
            environment.put("osgi.nl", config[3]); //$NON-NLS-1$
632
635
            
633
            BundleContext context = PDECore.getDefault().getBundleContext();
634
            for (int i = 0; i < fInfo.items.length; i++) {
636
            for (int i = 0; i < fInfo.items.length; i++) {
635
            	if (fInfo.items[i] instanceof IFeatureModel) {
637
            	if (fInfo.items[i] instanceof IFeatureModel) {
636
                    IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature();
638
                    IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature();
Lines 649-665 Link Here
649
	                }
651
	                }
650
	                if (bundle == null)
652
	                if (bundle == null)
651
	                	continue;
653
	                	continue;
652
                    try {
654
	                if (shouldAddPlugin(bundle, environment)) {
653
                        String filterSpec = bundle.getPlatformFilter();
655
	                	Element plugin = doc.createElement("plugin"); //$NON-NLS-1$
654
                        if (filterSpec == null|| context.createFilter(filterSpec).match(environment)) {
656
	                	plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$
655
                        	Element plugin = doc.createElement("plugin"); //$NON-NLS-1$
657
	                	plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ 
656
                        	plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$
658
	                	setAdditionalAttributes(plugin, bundle);
657
                            plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ 
659
	                	root.appendChild(plugin);
658
                            setAdditionalAttributes(plugin, bundle);
660
	                }
659
                            root.appendChild(plugin);
660
                         }
661
                    } catch (InvalidSyntaxException e) {
662
                    }
663
                }
661
                }
664
            }
662
            }
665
            XMLPrintHandler.writeFile(doc, new File(file, "feature.xml")); //$NON-NLS-1$
663
            XMLPrintHandler.writeFile(doc, new File(file, "feature.xml")); //$NON-NLS-1$
Lines 680-684 Link Here
680
		fHasErrors = true;
678
		fHasErrors = true;
681
	}
679
	}
682
680
683
681
	protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary environment) {
682
		String filterSpec = bundle.getPlatformFilter();
683
		try {
684
			return (filterSpec == null|| PDECore.getDefault().getBundleContext().createFilter(filterSpec).match(environment));
685
		} catch (InvalidSyntaxException e) {
686
		}
687
		return false;
688
	}
684
}
689
}
(-)src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java (-1 / +36 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-17 Link Here
11
package org.eclipse.pde.internal.core.exports;
11
package org.eclipse.pde.internal.core.exports;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.util.Dictionary;
14
15
16
import org.eclipse.osgi.service.resolver.BundleDescription;
17
import org.eclipse.osgi.service.resolver.State;
18
import org.eclipse.pde.core.plugin.TargetPlatform;
19
import org.eclipse.pde.internal.core.TargetPlatformHelper;
15
20
16
public class PluginExportOperation extends FeatureBasedExportOperation {
21
public class PluginExportOperation extends FeatureBasedExportOperation {
17
22
Lines 23-26 Link Here
23
		createPostProcessingFile(new File(fFeatureLocation, PLUGIN_POST_PROCESSING));		
28
		createPostProcessingFile(new File(fFeatureLocation, PLUGIN_POST_PROCESSING));		
24
	}
29
	}
25
30
31
	protected State getState(String os, String ws, String arch) {
32
		// the way plug-in export works, the os, ws and arch should ALWAYS equal the target settings.
33
		if (os.equals(TargetPlatform.getOS()) 
34
				&& ws.equals(TargetPlatform.getWS())
35
				&& arch.equals(TargetPlatform.getOSArch())
36
				&& fStateCopy != null)
37
			return fStateCopy;
38
		return super.getState(os, ws, arch);
39
	}
40
41
	protected boolean shouldAddPlugin(BundleDescription bundle,
42
			Dictionary environment) {
43
		// if there is an environment conflict
44
		boolean conflict = !super.shouldAddPlugin(bundle, environment);
45
		if (conflict) {
46
			// make a copy of the state if we haven't already
47
			if (fStateCopy == null)
48
				copyState(TargetPlatformHelper.getState());
49
			// replace the current BundleDescription with a copy who does not have the platform filter.  This will allow the plug-in to be resolved
50
			BundleDescription desc = fStateCopy.removeBundle(bundle.getBundleId());
51
        	BundleDescription newDesc = fStateCopy.getFactory().createBundleDescription(desc.getBundleId(), desc.getSymbolicName(), 
52
        			desc.getVersion(), desc.getLocation(), desc.getRequiredBundles(), desc.getHost(), desc.getImportPackages(), 
53
        			desc.getExportPackages(), desc.isSingleton(), desc.attachFragments(), desc.dynamicFragments(), null, 
54
        			desc.getExecutionEnvironments(), desc.getGenericRequires(), desc.getGenericCapabilities());
55
        	fStateCopy.addBundle(newDesc);
56
		}
57
		// always include plug-ins, even ones with environment conflicts
58
		return true;
59
	}
60
	
26
}
61
}

Return to bug 114779