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 119551 Details for
Bug 101241
[workspace] Plugin exporter should support exporting plugins from their output folder
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
PDE UI Patch
clipboard.txt (text/plain), 30.18 KB, created by
Curtis Windatt
on 2008-12-04 15:49:28 EST
(
hide
)
Description:
PDE UI Patch
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2008-12-04 15:49:28 EST
Size:
30.18 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java,v >retrieving revision 1.55 >diff -u -r1.55 PluginExportWizard.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java 24 Nov 2008 16:52:13 -0000 1.55 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportWizard.java 4 Dec 2008 20:38:58 -0000 >@@ -46,6 +46,7 @@ > info.useJarFormat = fPage.useJARFormat(); > info.exportSource = fPage.doExportSource(); > info.allowBinaryCycles = fPage.allowBinaryCycles(); >+ info.useWorkspaceCompiledClasses = fPage.useWorkspaceCompiledClasses(); > info.destinationDirectory = fPage.getDestination(); > info.zipFileName = fPage.getFileName(); > info.items = fPage.getSelectedItems(); >Index: src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java,v >retrieving revision 1.77 >diff -u -r1.77 BaseExportWizardPage.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java 3 Dec 2008 18:33:32 -0000 1.77 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/BaseExportWizardPage.java 4 Dec 2008 20:38:58 -0000 >@@ -287,6 +287,10 @@ > return fOptionsTab.doBinaryCycles(); > } > >+ protected boolean useWorkspaceCompiledClasses() { >+ return fOptionsTab.useWorkspaceCompiledClasses(); >+ } >+ > protected boolean doGenerateAntFile() { > return fOptionsTab.doGenerateAntFile(); > } >Index: src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java,v >retrieving revision 1.12 >diff -u -r1.12 ExportOptionsTab.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java 26 Oct 2008 18:24:02 -0000 1.12 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/ExportOptionsTab.java 4 Dec 2008 20:38:58 -0000 >@@ -31,6 +31,7 @@ > private static final String S_QUALIFIER = "qualifier"; //$NON-NLS-1$ > private static final String S_QUALIFIER_NAME = "qualifierName"; //$NON-NLS-1$ > private static final String S_ALLOW_BINARY_CYCLES = "allowBinaryCycles"; //$NON-NLS-1$ >+ private static final String S_USE_WORKSPACE_COMPILED_CLASSES = "useWorkspaceCompiledClasses"; //$NON-NLS-1$ > > private Button fIncludeSource; > protected Button fJarButton; >@@ -40,6 +41,7 @@ > private Button fQualifierButton; > private Text fQualifierText; > private Button fAllowBinaryCycles; >+ private Button fUseWSCompiledClasses; > > public ExportOptionsTab(BaseExportWizardPage page) { > super(page); >@@ -56,6 +58,7 @@ > addQualifierOption(container); > addAntSection(container); > addAllowBinaryCyclesSection(container); >+ addUseWorkspaceCompiledClassesSection(container); > > return container; > } >@@ -79,6 +82,11 @@ > fAllowBinaryCycles.setText(PDEUIMessages.ExportOptionsTab_allowBinaryCycles); > } > >+ protected void addUseWorkspaceCompiledClassesSection(Composite comp) { >+ fUseWSCompiledClasses = new Button(comp, SWT.CHECK); >+ fUseWSCompiledClasses.setText("Use class files compiled in the workspace"); >+ } >+ > protected String getJarButtonText() { > return PDEUIMessages.BaseExportWizardPage_packageJARs; > } >@@ -143,6 +151,7 @@ > fQualifierText.setText(getInitialQualifierText(settings)); > fQualifierText.setEnabled(fQualifierButton.getSelection()); > fAllowBinaryCycles.setSelection(getInitialAllowBinaryCyclesSelection(settings)); >+ fUseWSCompiledClasses.setSelection(getInitialUseWorkspaceCompiledClassesSelection(settings)); > hookListeners(); > } > >@@ -153,6 +162,7 @@ > settings.put(S_QUALIFIER, fQualifierButton.getSelection()); > settings.put(S_QUALIFIER_NAME, fQualifierText.getText()); > settings.put(S_ALLOW_BINARY_CYCLES, fAllowBinaryCycles.getSelection()); >+ settings.put(S_USE_WORKSPACE_COMPILED_CLASSES, fUseWSCompiledClasses.getSelection()); > saveCombo(settings, S_ANT_FILENAME, fAntCombo); > } > >@@ -165,12 +175,17 @@ > > protected boolean getInitialJarButtonSelection(IDialogSettings settings) { > String selected = settings.get(S_JAR_FORMAT); >- return selected == null ? TargetPlatformHelper.getTargetVersion() >= 3.1 : "true".equals(selected); //$NON-NLS-1$ >+ return selected == null ? TargetPlatformHelper.getTargetVersion() >= 3.1 : Boolean.valueOf(selected).booleanValue(); > } > > protected boolean getInitialAllowBinaryCyclesSelection(IDialogSettings settings) { > String selected = settings.get(S_ALLOW_BINARY_CYCLES); >- return selected == null ? true : "true".equals(selected); //$NON-NLS-1$ >+ return selected == null ? true : Boolean.valueOf(selected).booleanValue(); >+ } >+ >+ protected boolean getInitialUseWorkspaceCompiledClassesSelection(IDialogSettings settings) { >+ String selected = settings.get(S_USE_WORKSPACE_COMPILED_CLASSES); >+ return selected == null ? false : Boolean.valueOf(selected).booleanValue(); > } > > protected void hookListeners() { >@@ -233,6 +248,10 @@ > return fAllowBinaryCycles.getSelection(); > } > >+ protected boolean useWorkspaceCompiledClasses() { >+ return fUseWSCompiledClasses.getSelection(); >+ } >+ > protected boolean useJARFormat() { > return fJarButton.getSelection(); > } >Index: src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java,v >retrieving revision 1.62 >diff -u -r1.62 FeatureExportWizard.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java 24 Nov 2008 16:52:13 -0000 1.62 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java 4 Dec 2008 20:38:58 -0000 >@@ -63,6 +63,7 @@ > info.useJarFormat = fPage.useJARFormat(); > info.exportSource = fPage.doExportSource(); > info.allowBinaryCycles = fPage.allowBinaryCycles(); >+ info.useWorkspaceCompiledClasses = fPage.useWorkspaceCompiledClasses(); > info.destinationDirectory = fPage.getDestination(); > info.zipFileName = fPage.getFileName(); > if (fPage2 != null && ((FeatureExportWizardPage) fPage).doMultiPlatform()) >#P org.eclipse.pde.ui.tests >Index: src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java,v >retrieving revision 1.3 >diff -u -r1.3 ExportBundleTests.java >--- src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java 24 Nov 2008 16:52:10 -0000 1.3 >+++ src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java 4 Dec 2008 20:39:00 -0000 >@@ -80,6 +80,7 @@ > info.useJarFormat = true; > info.exportSource = false; > info.allowBinaryCycles = false; >+ info.useWorkspaceCompiledClasses = false; > info.destinationDirectory = EXPORT_PATH.toOSString(); > info.zipFileName = null; > info.items = new Object[]{PluginRegistry.findModel(project.getProject())}; >@@ -121,6 +122,7 @@ > info.useJarFormat = true; > info.exportSource = false; > info.allowBinaryCycles = false; >+ info.useWorkspaceCompiledClasses = false; > info.destinationDirectory = EXPORT_PATH.toOSString(); > info.zipFileName = null; > info.items = new Object[]{PluginRegistry.findModel(project.getProject())}; >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java,v >retrieving revision 1.19 >diff -u -r1.19 FeatureExportOperation.java >--- src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 24 Nov 2008 16:52:09 -0000 1.19 >+++ src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 4 Dec 2008 20:39:01 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.core.exports; > >+import org.eclipse.pde.internal.core.PDECoreMessages; >+ > import java.io.*; > import java.lang.reflect.InvocationTargetException; > import java.net.MalformedURLException; >@@ -26,6 +28,7 @@ > import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager; > import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.osgi.service.resolver.State; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.pde.core.IModel; > import org.eclipse.pde.core.build.*; > import org.eclipse.pde.core.plugin.*; >@@ -47,6 +50,7 @@ > private String fDevProperties; > private static boolean fHasErrors; > protected HashMap fAntBuildProperties; >+ protected WorkspaceExportHelper fWorkspaceExportHelper; > > protected State fStateCopy; > >@@ -76,29 +80,32 @@ > if (configurations == null) > configurations = new String[][] {null}; > >- monitor.beginTask("", configurations.length * fInfo.items.length * 11); //$NON-NLS-1$ >+ monitor.beginTask("Exporting...", (configurations.length * fInfo.items.length * 23) + (configurations.length * 5) + 10); //$NON-NLS-1$ >+ IStatus status = testBuildWorkspaceBeforeExport(new SubProgressMonitor(monitor, 10)); > for (int i = 0; i < configurations.length; i++) { > for (int j = 0; j < fInfo.items.length; j++) { > if (monitor.isCanceled()) > return Status.CANCEL_STATUS; > try { >- doExport((IFeatureModel) fInfo.items[j], configurations[i], new SubProgressMonitor(monitor, 9)); >+ doExport((IFeatureModel) fInfo.items[j], configurations[i], new SubProgressMonitor(monitor, 20)); > } catch (CoreException e) { > return e.getStatus(); > } finally { >- cleanup(configurations[i], new SubProgressMonitor(monitor, 1)); >+ cleanup(configurations[i], new SubProgressMonitor(monitor, 3)); > } > } > if (fInfo.exportMetadata && !fInfo.toDirectory) { >- appendMetadataToArchive(configurations[i], new SubProgressMonitor(monitor, 1)); >+ appendMetadataToArchive(configurations[i], new SubProgressMonitor(monitor, 5)); > } > } >+ return status; > } catch (InvocationTargetException e) { > return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getCause() != null ? e.getCause() : e); >+ } catch (CoreException e) { >+ return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getCause() != null ? e.getCause() : e); > } finally { > monitor.done(); > } >- return Status.OK_STATUS; > } > > /** >@@ -205,17 +212,21 @@ > > protected void doExport(String featureID, String version, String featureLocation, String os, String ws, String arch, IProgressMonitor monitor) throws CoreException, InvocationTargetException { > fHasErrors = false; >- monitor.beginTask("", 9); //$NON-NLS-1$ >- monitor.setTaskName(PDECoreMessages.FeatureExportJob_taskName); >+ > try { >+ monitor.beginTask("", 10); //$NON-NLS-1$ >+ monitor.setTaskName(PDECoreMessages.FeatureExportJob_taskName); > HashMap properties = createAntBuildProperties(os, ws, arch); > BuildScriptGenerator generator = new BuildScriptGenerator(); > setupGenerator(generator, featureID, version, os, ws, arch, featureLocation); > generator.generate(); > monitor.worked(1); >+ monitor.setTaskName(PDECoreMessages.FeatureExportOperation_runningBuildScript); > runScript(getBuildScriptName(featureLocation), getBuildExecutionTargets(), properties, new SubProgressMonitor(monitor, 2)); >+ monitor.setTaskName(PDECoreMessages.FeatureExportOperation_runningAssemblyScript); > runScript(getAssemblyScriptName(featureID, os, ws, arch, featureLocation), new String[] {"main"}, //$NON-NLS-1$ > properties, new SubProgressMonitor(monitor, 2)); >+ monitor.setTaskName(PDECoreMessages.FeatureExportOperation_runningPackagerScript); > runScript(getPackagerScriptName(featureID, os, ws, arch, featureLocation), null, properties, new SubProgressMonitor(monitor, 2)); > properties.put("destination.temp.folder", fBuildTempLocation + "/pde.logs"); //$NON-NLS-1$ //$NON-NLS-2$ > runScript(getBuildScriptName(featureLocation), new String[] {"gather.logs"}, properties, new SubProgressMonitor(monitor, 2)); //$NON-NLS-1$ >@@ -505,7 +516,14 @@ > generator.setArchivesFormat(format); > generator.setPDEState(getState(os, ws, arch)); > generator.setNextId(TargetPlatformHelper.getPDEState().getNextId()); >- generator.setStateExtraData(TargetPlatformHelper.getBundleClasspaths(TargetPlatformHelper.getPDEState()), TargetPlatformHelper.getPatchMap(TargetPlatformHelper.getPDEState())); >+ >+ if (fInfo.useWorkspaceCompiledClasses) { >+ generator.setUseWorkspaceBinaries(true); >+ generator.setStateExtraData(TargetPlatformHelper.getBundleClasspaths(TargetPlatformHelper.getPDEState()), TargetPlatformHelper.getPatchMap(TargetPlatformHelper.getPDEState()), getWorkspaceExportHelper().getWorkspaceOutputFolders(fInfo.items)); >+ } else { >+ generator.setStateExtraData(TargetPlatformHelper.getBundleClasspaths(TargetPlatformHelper.getPDEState()), TargetPlatformHelper.getPatchMap(TargetPlatformHelper.getPDEState())); >+ } >+ > AbstractScriptGenerator.setForceUpdateJar(false); > AbstractScriptGenerator.setEmbeddedSource(fInfo.exportSource); > >@@ -732,4 +750,41 @@ > } > return false; > } >+ >+ /** >+ * If we are exporting using the compiled classes from the workspace, this method will >+ * start an incremental build and test for build errors. Returns a status explaining >+ * any errors found or Status.OK_STATUS. >+ * @param monitor progress monitor >+ * @return status explaining build errors or an OK status. >+ * @throws CoreException >+ */ >+ protected IStatus testBuildWorkspaceBeforeExport(IProgressMonitor monitor) throws CoreException { >+ try { >+ monitor.beginTask("", 50); //$NON-NLS-1$ >+ if (fInfo.useWorkspaceCompiledClasses) { >+ getWorkspaceExportHelper().buildBeforeExport(fInfo.items, new SubProgressMonitor(monitor, 45)); >+ Set errors = getWorkspaceExportHelper().checkForErrors(fInfo.items); >+ if (!errors.isEmpty()) { >+ monitor.worked(5); >+ return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_workspaceBuildErrorsFoundDuringExport, errors.toString())); >+ } >+ monitor.worked(5); >+ } >+ return Status.OK_STATUS; >+ } finally { >+ monitor.done(); >+ } >+ } >+ >+ /** >+ * @return an instance of the WorkspaceExportHelper used to set up exports using class files built in the workspace >+ */ >+ protected WorkspaceExportHelper getWorkspaceExportHelper() { >+ if (fWorkspaceExportHelper == null) { >+ fWorkspaceExportHelper = new WorkspaceExportHelper(); >+ } >+ return fWorkspaceExportHelper; >+ } >+ > } >Index: src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java,v >retrieving revision 1.7 >diff -u -r1.7 FeatureBasedExportOperation.java >--- src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java 24 Nov 2008 16:52:09 -0000 1.7 >+++ src/org/eclipse/pde/internal/core/exports/FeatureBasedExportOperation.java 4 Dec 2008 20:39:01 -0000 >@@ -33,7 +33,7 @@ > protected IStatus run(IProgressMonitor monitor) { > try { > createDestination(); >- monitor.beginTask("", 10); //$NON-NLS-1$ >+ monitor.beginTask("Exporting...", 33); //$NON-NLS-1$ > // create a feature to contain all plug-ins > String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$ > fFeatureLocation = fBuildTempLocation + File.separator + featureID; >@@ -42,12 +42,14 @@ > createBuildPropertiesFile(fFeatureLocation); > if (fInfo.useJarFormat) > createPostProcessingFiles(); >- doExport(featureID, null, fFeatureLocation, TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), new SubProgressMonitor(monitor, 7)); >+ IStatus status = testBuildWorkspaceBeforeExport(new SubProgressMonitor(monitor, 10)); >+ doExport(featureID, null, fFeatureLocation, TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), new SubProgressMonitor(monitor, 20)); > if (monitor.isCanceled()) { > return Status.CANCEL_STATUS; > } >+ return status; > } catch (IOException e) { >- PDECore.log(e); >+ return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e); > } catch (CoreException e) { > return e.getStatus(); > } catch (InvocationTargetException e) { >@@ -64,7 +66,6 @@ > cleanup(null, new SubProgressMonitor(monitor, 3)); > monitor.done(); > } >- return Status.OK_STATUS; > } > > protected abstract void createPostProcessingFiles(); >Index: src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java,v >retrieving revision 1.6 >diff -u -r1.6 FeatureExportInfo.java >--- src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java 26 Oct 2008 18:20:32 -0000 1.6 >+++ src/org/eclipse/pde/internal/core/exports/FeatureExportInfo.java 4 Dec 2008 20:39:01 -0000 >@@ -17,6 +17,7 @@ > public boolean exportSource; > public boolean exportMetadata; > public boolean allowBinaryCycles; >+ public boolean useWorkspaceCompiledClasses; > public String destinationDirectory; > public String zipFileName; > public String qualifier; >Index: src/org/eclipse/pde/internal/core/pderesources.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties,v >retrieving revision 1.102 >diff -u -r1.102 pderesources.properties >--- src/org/eclipse/pde/internal/core/pderesources.properties 7 Nov 2008 21:21:45 -0000 1.102 >+++ src/org/eclipse/pde/internal/core/pderesources.properties 4 Dec 2008 20:39:01 -0000 >@@ -188,8 +188,12 @@ > SchemaElementReference_refElementMissing=No DTD available > > ExportWizard_badDirectory = Specified directory could not be created. >-FeatureExportJob_taskName=Building Plug-ins... >+FeatureExportJob_taskName=Generating ant scripts > FeatureExportOperation_CompilationErrors=Compilation errors occurred during the operation. A zip file containing the build logs has been generated and placed at {0} >+FeatureExportOperation_runningAssemblyScript=Running assembly script >+FeatureExportOperation_runningBuildScript=Running build script >+FeatureExportOperation_runningPackagerScript=Running packager script >+FeatureExportOperation_workspaceBuildErrorsFoundDuringExport=Export completed successfully, but build problems were detected in the following required projects: {0} > BaseExportTask_pdeExport=PDE Export > > XMLErrorReporter_ExternalEntityResolution=External entity resolution is not supported by PDE. >Index: src/org/eclipse/pde/internal/core/PDECoreMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java,v >retrieving revision 1.60 >diff -u -r1.60 PDECoreMessages.java >--- src/org/eclipse/pde/internal/core/PDECoreMessages.java 7 Nov 2008 21:21:45 -0000 1.60 >+++ src/org/eclipse/pde/internal/core/PDECoreMessages.java 4 Dec 2008 20:39:01 -0000 >@@ -259,6 +259,14 @@ > > public static String FeatureExportOperation_CompilationErrors; > >+ public static String FeatureExportOperation_runningAssemblyScript; >+ >+ public static String FeatureExportOperation_runningBuildScript; >+ >+ public static String FeatureExportOperation_runningPackagerScript; >+ >+ public static String FeatureExportOperation_workspaceBuildErrorsFoundDuringExport; >+ > public static String TargetPlatformResetJob_resetTarget; > > public static String XMLErrorReporter_ExternalEntityResolution; >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF,v >retrieving revision 1.40 >diff -u -r1.40 MANIFEST.MF >--- META-INF/MANIFEST.MF 30 Nov 2008 21:18:48 -0000 1.40 >+++ META-INF/MANIFEST.MF 4 Dec 2008 20:39:01 -0000 >@@ -56,7 +56,8 @@ > org.eclipse.pde.build;bundle-version="[3.2.0,4.1.0)", > org.eclipse.ant.core;bundle-version="[3.1.0,4.0.0)", > org.eclipse.equinox.simpleconfigurator.manipulator;bundle-version="[1.0.100,2.0.0)", >- org.eclipse.equinox.frameworkadmin;bundle-version="[1.0.100,2.0.0)" >+ org.eclipse.equinox.frameworkadmin;bundle-version="[1.0.100,2.0.0)", >+ org.eclipse.debug.core;bundle-version="[3.5.0,4.0.0)" > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4 > Import-Package: com.ibm.icu.util >Index: src/org/eclipse/pde/internal/core/exports/WorkspaceExportHelper.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/exports/WorkspaceExportHelper.java >diff -N src/org/eclipse/pde/internal/core/exports/WorkspaceExportHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/exports/WorkspaceExportHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,192 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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.pde.internal.core.exports; >+ >+import java.util.*; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.model.LaunchConfigurationDelegate; >+import org.eclipse.jdt.core.*; >+import org.eclipse.pde.core.build.IBuildEntry; >+import org.eclipse.pde.core.build.IBuildModel; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.internal.build.IBuildPropertiesConstants; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.build.WorkspaceBuildModel; >+import org.eclipse.pde.internal.core.builders.PDEMarkerFactory; >+import org.eclipse.pde.internal.core.ifeature.IFeatureModel; >+import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; >+ >+/** >+ * Helper class for the various export operation classes, making it easier to export using workspace >+ * compiled files rather than having PDE Build compile everything on its own. Provides access to >+ * methods in debug that determine what projects need to be built before the operation as well as >+ * checking for errors. >+ * >+ * @see FeatureExportOperation >+ * @see PluginExportOperation >+ */ >+public class WorkspaceExportHelper extends LaunchConfigurationDelegate { >+ >+ private IProject[] fWorkspaceProjects; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { >+ // This class is not intended to be launched. >+ } >+ >+ /** >+ * Builds the workspace projects that are being exported or are required plug-ins >+ * of the exported items. Uses the incremental builder. >+ * >+ * @param exportedItems The plugins or features being exported >+ * @param monitor a progress monitor or <code>null</code> if progress reporting is not desired >+ * @throws CoreException >+ */ >+ public void buildBeforeExport(Object[] exportedItems, IProgressMonitor monitor) throws CoreException { >+ IProject[] projects = getExportedWorkspaceProjects(exportedItems); >+ for (int i = 0; i < projects.length; i++) { >+ projects[i].build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); >+ } >+ } >+ >+ /** >+ * Checks the workspace projects that are being exported or are required plug-ins >+ * of the exported items for build errors. A project will be reported as having an >+ * error if it has a marker with a severity of error and is of Java model or PDE type. >+ * >+ * @param exportedItems the plugins or features being exported >+ * @return set of IProjects containing errors >+ * @throws CoreException >+ */ >+ public Set checkForErrors(Object[] exportedItems) throws CoreException { >+ IProject[] projects = getExportedWorkspaceProjects(exportedItems); >+ Set projectsWithErrors = new HashSet(projects.length); >+ for (int i = 0; i < projects.length; i++) { >+ IMarker[] markers = projects[i].findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); >+ if (markers.length > 0) { >+ for (int j = 0; j < markers.length; j++) { >+ Integer severity = (Integer) (markers[j].getAttribute(IMarker.SEVERITY)); >+ if (severity != null && severity.intValue() >= IMarker.SEVERITY_ERROR) { >+ if (markers[j].getType().equals(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER) || markers[j].getType().equals(PDEMarkerFactory.MARKER_ID)) { >+ projectsWithErrors.add(projects[i]); >+ break; >+ } >+ } >+ } >+ } >+ } >+ return projectsWithErrors; >+ } >+ >+ /** >+ * Returns a map containing information associating libraries to the output locations the >+ * workspace compiles them to. Uses information in the build.properties and the classpath. >+ * The map will be of the following form: >+ * String symbolic name > lib output map >+ * The lib output map will be of the following form: >+ * String lib name > Set of IPath output folders >+ * >+ * @param exportedItems the plugins or features being exported >+ * @return a map of library output folders for each plugin in the workspace >+ */ >+ public Map getWorkspaceOutputFolders(Object[] exportedItems) throws CoreException { >+ IProject[] projects = getExportedWorkspaceProjects(exportedItems); >+ Map result = new HashMap(projects.length); >+ for (int i = 0; i < projects.length; i++) { >+ IFile buildFile = projects[i].getFile("build.properties"); //$NON-NLS-1$ >+ if (buildFile.exists()) { >+ IBuildModel buildModel = new WorkspaceBuildModel(buildFile); >+ buildModel.load(); >+ IJavaProject javaProject = JavaCore.create(projects[i]); >+ if (javaProject.exists()) { >+ Map modelOutput = getPluginOutputFolders(buildModel, javaProject); >+ if (!modelOutput.isEmpty()) { >+ IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(projects[i]); >+ if (model != null) { >+ result.put(model.getBundleDescription().getSymbolicName(), modelOutput); >+ } >+ } >+ } >+ } >+ } >+ return result; >+ } >+ >+ private Map getPluginOutputFolders(IBuildModel buildModel, IJavaProject javaProject) throws JavaModelException { >+ Map outputEntries = new HashMap(); >+ >+ IBuildEntry[] buildEntries = buildModel.getBuild().getBuildEntries(); >+ for (int i = 0; i < buildEntries.length; i++) { >+ String name = buildEntries[i].getName(); >+ if (name.startsWith(IBuildPropertiesConstants.PROPERTY_SOURCE_PREFIX)) { >+ Set outputPaths = new HashSet(); >+ >+ String[] sourceFolders = buildEntries[i].getTokens(); >+ for (int j = 0; j < sourceFolders.length; j++) { >+ >+ IClasspathEntry[] classpathEntries = javaProject.getRawClasspath(); >+ for (int k = 0; k < classpathEntries.length; k++) { >+ if (classpathEntries[k].getEntryKind() == IClasspathEntry.CPE_SOURCE) { >+ IPath sourcePath = classpathEntries[k].getPath().removeFirstSegments(1); // Entries include project as first segment >+ if (sourcePath.equals(new Path(sourceFolders[j]))) { >+ IPath outputPath = classpathEntries[k].getOutputLocation(); >+ if (outputPath == null) { >+ outputPath = javaProject.getOutputLocation(); >+ } >+ outputPaths.add(outputPath.removeFirstSegments(1)); // Entries include project as first segment >+ } >+ } >+ } >+ } >+ if (!outputPaths.isEmpty()) { >+ outputEntries.put(name.substring(IBuildPropertiesConstants.PROPERTY_SOURCE_PREFIX.length()), outputPaths); >+ } >+ } >+ } >+ return outputEntries; >+ } >+ >+ private IProject[] getExportedWorkspaceProjects(Object[] exportedItems) throws CoreException { >+ if (fWorkspaceProjects == null) { >+ // TODO This won't work for nested features either >+ Set projects = new HashSet(); >+ for (int i = 0; i < exportedItems.length; i++) { >+ if (exportedItems[i] instanceof IPluginModelBase) { >+ IPath installLocation = new Path(((IPluginModelBase) exportedItems[i]).getInstallLocation()); >+ IProject project = PDECore.getWorkspace().getRoot().getProject(installLocation.lastSegment()); >+ if (project.exists()) { >+ projects.add(project); >+ } >+ } else if (exportedItems[i] instanceof IFeatureModel) { >+ IFeatureModel feature = (IFeatureModel) exportedItems[i]; >+ IFeaturePlugin[] plugins = feature.getFeature().getPlugins(); >+ for (int j = 0; j < plugins.length; j++) { >+ IPluginModelBase plugin = PDECore.getDefault().getModelManager().findModel(plugins[i].getId()); >+ IPath installLocation = new Path(plugin.getInstallLocation()); >+ IProject project = PDECore.getWorkspace().getRoot().getProject(installLocation.lastSegment()); >+ if (project.exists()) { >+ projects.add(project); >+ } >+ } >+ >+ } >+ } >+ fWorkspaceProjects = computeReferencedBuildOrder((IProject[]) projects.toArray(new IProject[projects.size()])); >+ } >+ return fWorkspaceProjects; >+ } >+ >+}
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 101241
:
118687
|
118688
|
118729
|
119441
|
119442
| 119551