Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 67310 Details for
Bug 114779
PDE UI doesnt allow plug-in exporting unless target platform environment matches the plug-in platform filter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for the first problem
bug114779.txt (text/plain), 9.49 KB, created by
Brian Bauman
on 2007-05-15 16:19:27 EDT
(
hide
)
Description:
patch for the first problem
Filename:
MIME Type:
Creator:
Brian Bauman
Created:
2007-05-15 16:19:27 EDT
Size:
9.49 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java,v >retrieving revision 1.6 >diff -u -r1.6 FeatureExportOperation.java >--- src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 6 Feb 2007 03:11:48 -0000 1.6 >+++ src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 15 May 2007 20:13:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 2007 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 >@@ -93,7 +93,7 @@ > > protected HashMap fAntBuildProperties; > >- private State fStateCopy; >+ protected State fStateCopy; > > protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$ > protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$ >@@ -480,9 +480,7 @@ > return main; > } > if (fStateCopy == null) { >- fStateCopy = main.getFactory().createState(main); >- fStateCopy.setResolver(Platform.getPlatformAdmin().getResolver()); >- fStateCopy.setPlatformProperties(main.getPlatformProperties()); >+ copyState(main); > } > > Dictionary[] dictionaries = fStateCopy.getPlatformProperties(); >@@ -496,6 +494,12 @@ > return fStateCopy; > } > >+ protected void copyState(State state) { >+ fStateCopy = state.getFactory().createState(state); >+ fStateCopy.setResolver(Platform.getPlatformAdmin().getResolver()); >+ fStateCopy.setPlatformProperties(state.getPlatformProperties()); >+ } >+ > private String getDevProperties() { > if (fDevProperties == null) { > fDevProperties = ClasspathHelper.getDevEntriesProperties(fBuildTempLocation + "/dev.properties", false); //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java,v >retrieving revision 1.1 >diff -u -r1.1 PluginExportOperation.java >--- src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java 29 Mar 2006 07:49:44 -0000 1.1 >+++ src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java 15 May 2007 20:13:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 2007 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 >@@ -11,7 +11,28 @@ > package org.eclipse.pde.internal.core.exports; > > import java.io.File; >+import java.io.IOException; >+import java.util.Dictionary; >+import java.util.Hashtable; > >+import javax.xml.parsers.DocumentBuilderFactory; >+import javax.xml.parsers.FactoryConfigurationError; >+import javax.xml.parsers.ParserConfigurationException; >+ >+import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.eclipse.osgi.service.resolver.State; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.core.plugin.TargetPlatform; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.TargetPlatformHelper; >+import org.eclipse.pde.internal.core.XMLPrintHandler; >+import org.eclipse.pde.internal.core.ifeature.IFeature; >+import org.eclipse.pde.internal.core.ifeature.IFeatureModel; >+import org.osgi.framework.BundleContext; >+import org.osgi.framework.InvalidSyntaxException; >+import org.w3c.dom.DOMException; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; > > public class PluginExportOperation extends FeatureBasedExportOperation { > >@@ -22,5 +43,104 @@ > protected void createPostProcessingFiles() { > createPostProcessingFile(new File(fFeatureLocation, PLUGIN_POST_PROCESSING)); > } >+ >+ // extend createFeature since the super's implementation does not include plug-ins with conflicting platform filters >+ protected void createFeature(String featureID, String featureLocation, String[] config, boolean includeLauncher) throws IOException { >+ File file = new File(featureLocation); >+ if (!file.exists() || !file.isDirectory()) >+ file.mkdirs(); >+ >+ try { >+ Dictionary environment = new Hashtable(4); >+ environment.put("osgi.os", config[0]); //$NON-NLS-1$ >+ environment.put("osgi.ws", config[1]); //$NON-NLS-1$ >+ environment.put("osgi.arch", config[2]); //$NON-NLS-1$ >+ environment.put("osgi.nl", config[3]); //$NON-NLS-1$ > >+ BundleDescription[] plugins = getBundles(environment); >+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); >+ Document doc = factory.newDocumentBuilder().newDocument(); >+ Element root = doc.createElement("feature"); //$NON-NLS-1$ >+ root.setAttribute("id", featureID); //$NON-NLS-1$ >+ root.setAttribute("version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ >+ doc.appendChild(root); >+ >+ if (includeLauncher) { >+ IFeatureModel model = PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature(); >+ if (model != null) { >+ IFeature feature = model.getFeature(); >+ Element includes = doc.createElement("includes"); //$NON-NLS-1$ >+ includes.setAttribute("id", feature.getId()); //$NON-NLS-1$ >+ includes.setAttribute("version", feature.getVersion()); //$NON-NLS-1$ >+ root.appendChild(includes); >+ } >+ } >+ >+ for (int i = 0; i < plugins.length; i++) { >+ BundleDescription bundle = plugins[i]; >+ if (bundle == null) >+ continue; >+ Element plugin = doc.createElement("plugin"); //$NON-NLS-1$ >+ plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$ >+ plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ >+ setAdditionalAttributes(plugin, bundle); >+ root.appendChild(plugin); >+ } >+ XMLPrintHandler.writeFile(doc, new File(file, "feature.xml")); //$NON-NLS-1$ >+ } catch (DOMException e1) { >+ } catch (FactoryConfigurationError e1) { >+ } catch (ParserConfigurationException e1) { >+ } >+ } >+ >+ // Returns an array of BundleDescriptions which represent bundles to export. >+ // If a bundle has a conflicting platform filter, we copy the state and remove the filter. This way it is still included in the export >+ private BundleDescription[] getBundles(Dictionary environment) { >+ BundleContext context = PDECore.getDefault().getBundleContext(); >+ BundleDescription[] plugins = new BundleDescription[fInfo.items.length]; >+ for (int i = 0; i < plugins.length; i++) { >+ if (!(fInfo.items[i] instanceof IFeatureModel)) { >+ BundleDescription bundle = null; >+ if (fInfo.items[i] instanceof IPluginModelBase) { >+ bundle = ((IPluginModelBase)fInfo.items[i]).getBundleDescription(); >+ } >+ if (bundle == null) { >+ if (fInfo.items[i] instanceof BundleDescription) >+ bundle = (BundleDescription)fInfo.items[i]; >+ } >+ if (bundle == null) >+ continue; >+ try { >+ plugins[i] = bundle; >+ String filterSpec = bundle.getPlatformFilter(); >+ // if there is a confliciting platform filter, copy the state and reload it with a copy of the BundleDescription without the platform filter >+ if (!(filterSpec == null|| context.createFilter(filterSpec).match(environment))) { >+ if (fStateCopy == null) >+ copyState(TargetPlatformHelper.getState()); >+ BundleDescription desc = fStateCopy.removeBundle(bundle.getBundleId()); >+ BundleDescription newDesc = fStateCopy.getFactory().createBundleDescription(desc.getBundleId(), desc.getSymbolicName(), >+ desc.getVersion(), desc.getLocation(), desc.getRequiredBundles(), desc.getHost(), desc.getImportPackages(), >+ desc.getExportPackages(), desc.isSingleton(), desc.attachFragments(), desc.dynamicFragments(), null, >+ desc.getExecutionEnvironments(), desc.getGenericRequires(), desc.getGenericCapabilities()); >+ fStateCopy.addBundle(newDesc); >+ } >+ } catch (InvalidSyntaxException e) { >+ } >+ } >+ } >+ if (fStateCopy != null) >+ fStateCopy.resolve(false); >+ return plugins; >+ } >+ >+ protected State getState(String os, String ws, String arch) { >+ // the way plug-in export works, the os, ws and arch should ALWAYS equal the target settings. >+ if (os.equals(TargetPlatform.getOS()) >+ && ws.equals(TargetPlatform.getWS()) >+ && arch.equals(TargetPlatform.getOSArch()) >+ && fStateCopy != null) >+ return fStateCopy; >+ return super.getState(os, ws, arch); >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 114779
:
30330
|
67310
|
67325