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 20253 Details for
Bug 92420
It should be possible to export cross platform
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 to do cross platform exports
pde-crossplatform.patch (text/plain), 18.60 KB, created by
Jeff McAffer
on 2005-04-22 14:20:16 EDT
(
hide
)
Description:
patch to do cross platform exports
Filename:
MIME Type:
Creator:
Jeff McAffer
Created:
2005-04-22 14:20:16 EDT
Size:
18.60 KB
patch
obsolete
>Index: src/org/eclipse/pde/internal/ui/build/ProductExportJob.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/ProductExportJob.java,v >retrieving revision 1.33 >diff -u -r1.33 ProductExportJob.java >--- src/org/eclipse/pde/internal/ui/build/ProductExportJob.java 9 Apr 2005 01:53:43 -0000 1.33 >+++ src/org/eclipse/pde/internal/ui/build/ProductExportJob.java 22 Apr 2005 18:19:33 -0000 >@@ -37,7 +37,7 @@ > > private String fRoot; > >- public ProductExportJob(IProductModel model, String productRoot, boolean toDirectory, boolean exportSource, String destination, String zipFileName) { >+ public ProductExportJob(IProductModel model, String productRoot, boolean toDirectory, boolean exportSource, String destination, String zipFileName, String[][] targets) { > super(PDEUIMessages.ProductExportJob_jobName); //$NON-NLS-1$ > fProduct = model.getProduct(); > fExportToDirectory = toDirectory; >@@ -45,6 +45,10 @@ > fDestinationDirectory = destination; > fZipFilename = zipFileName; > fRoot = productRoot; >+ ftargets = targets; >+ // TODO remove when there is UI to set ftargets >+ if (ftargets == null) >+ ftargets = new String[][] { { "linux", "gtk", "x86", ""} , {"win32", "win32", "x86", ""} }; > if (fProduct.useFeatures()) { > fItems = getFeatureModels(); > } else { >@@ -82,30 +86,36 @@ > > protected void doExports(IProgressMonitor monitor) > throws InvocationTargetException, CoreException { >- try { >- monitor.beginTask("", 10); >- // create a feature to wrap all plug-ins and features >- String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$ >- fFeatureLocation = fBuildTempLocation + File.separator + featureID; >- createFeature(featureID, fFeatureLocation); >- createBuildPropertiesFile(fFeatureLocation); >- createConfigIniFile(); >- createEclipseProductFile(); >- createLauncherIniFile(); >- doExport(featureID, >- null, >- fFeatureLocation, >- TargetPlatform.getOS(), >- TargetPlatform.getWS(), >- TargetPlatform.getOSArch(), >- new SubProgressMonitor(monitor, 7)); >- } catch (IOException e) { >- } finally { >- for (int i = 0; i < fItems.length; i++) { >- deleteBuildFiles((IModel)fItems[i]); >+ String[][] configurations = ftargets; >+ if (configurations == null) >+ configurations = new String[][] { {TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL() } }; >+ for (int i = 0; i < configurations.length; i++) { >+ try { >+ String[] config = configurations[i]; >+ monitor.beginTask("", 10); >+ // create a feature to wrap all plug-ins and features >+ String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$ >+ fFeatureLocation = fBuildTempLocation + File.separator + featureID; >+ createFeature(featureID, fFeatureLocation, config); >+ createBuildPropertiesFile(fFeatureLocation); >+ createConfigIniFile(); >+ createEclipseProductFile(); >+ createLauncherIniFile(); >+ doExport(featureID, >+ null, >+ fFeatureLocation, >+ config[0], >+ config[1], >+ config[2], >+ new SubProgressMonitor(monitor, 7)); >+ } catch (IOException e) { >+ } finally { >+ for (int j = 0; j < fItems.length; j++) { >+ deleteBuildFiles((IModel)fItems[j]); >+ } >+ cleanup(ftargets == null ? null : configurations[i], new SubProgressMonitor(monitor, 3)); >+ monitor.done(); > } >- cleanup(new SubProgressMonitor(monitor, 3)); >- monitor.done(); > } > } > >Index: src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportJob.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportJob.java,v >retrieving revision 1.56 >diff -u -r1.56 FeatureExportJob.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportJob.java 9 Apr 2005 01:53:43 -0000 1.56 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportJob.java 22 Apr 2005 18:19:33 -0000 >@@ -21,6 +21,8 @@ > import org.eclipse.core.runtime.jobs.*; > import org.eclipse.jdt.core.*; > import org.eclipse.jface.dialogs.*; >+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.*; > import org.eclipse.pde.core.build.*; >@@ -60,6 +62,7 @@ > > protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$ > protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$ >+ protected String[][] ftargets; > > class SchedulingRule implements ISchedulingRule { > >@@ -84,7 +87,7 @@ > setRule(new SchedulingRule()); > } > >- public FeatureExportJob(boolean toDirectory, boolean useJarFormat, boolean exportSource, String destination, String zipFileName, Object[] items, String[] signingInfo, String[] jnlpInfo) { >+ public FeatureExportJob(boolean toDirectory, boolean useJarFormat, boolean exportSource, String destination, String zipFileName, Object[] items, String[] signingInfo, String[] jnlpInfo, String[][] targets) { > super(PDEUIMessages.FeatureExportJob_name); //$NON-NLS-1$ > fExportToDirectory = toDirectory; > fUseJarFormat = useJarFormat; >@@ -94,12 +97,16 @@ > fItems = items; > fSigningInfo = signingInfo; > fJnlpInfo = jnlpInfo; >+ ftargets = targets; >+ // TODO remove when there is UI to set ftargets >+ if (ftargets == null) >+ ftargets = new String[][] { { "linux", "gtk", "x86", ""} , {"win32", "win32", "x86", ""} }; > fBuildTempLocation = PDEPlugin.getDefault().getStateLocation().append("temp").toString(); //$NON-NLS-1$ > setRule(new SchedulingRule()); > } > > public FeatureExportJob(boolean toDirectory, boolean useJarFormat, boolean exportSource, String destination, String zipFileName, Object[] items) { >- this(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, null, null); >+ this(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, null, null, null); > } > > /* >@@ -149,30 +156,34 @@ > protected void doExports(IProgressMonitor monitor) throws InvocationTargetException, CoreException { > createDestination(); > monitor.beginTask("", fItems.length + 1); //$NON-NLS-1$ >- try { >- for (int i = 0; i < fItems.length; i++) { >- if (monitor.isCanceled()) >- throw new OperationCanceledException(); >- IFeatureModel model = (IFeatureModel) fItems[i]; >- try { >- String location = model.getInstallLocation(); >- if (fUseJarFormat) { >- createPostProcessingFile(new File(location, FEATURE_POST_PROCESSING)); >- createPostProcessingFile(new File(location, PLUGIN_POST_PROCESSING)); >- } >- IFeature feature = model.getFeature(); >- String id = feature.getId(); >- String os = getOS(feature); >- String ws = getWS(feature); >- String arch = getOSArch(feature); >- doExport(id, model.getFeature().getVersion(), model.getInstallLocation(), os, ws, arch, new SubProgressMonitor(monitor, 1)); >- } finally { >- deleteBuildFiles(model); >+ String[][] configurations = ftargets; >+ if (configurations == null) >+ configurations = new String[][] { null }; >+ for (int i = 0; i < configurations.length; i++) { >+ try { >+ for (int j = 0; j < fItems.length; j++) { >+ if (monitor.isCanceled()) >+ throw new OperationCanceledException(); >+ doExport((IFeatureModel) fItems[j], configurations[i], monitor); > } >+ } finally { >+ cleanup(configurations[i], new SubProgressMonitor(monitor, 1)); >+ monitor.done(); >+ } >+ } >+ } >+ >+ private void doExport(IFeatureModel model, String os, String ws, String arch, IProgressMonitor monitor) throws CoreException, InvocationTargetException { >+ try { >+ String location = model.getInstallLocation(); >+ if (fUseJarFormat) { >+ createPostProcessingFile(new File(location, FEATURE_POST_PROCESSING)); >+ createPostProcessingFile(new File(location, PLUGIN_POST_PROCESSING)); > } >+ IFeature feature = model.getFeature(); >+ doExport(feature.getId(), feature.getVersion(), location, os, ws, arch, new SubProgressMonitor(monitor, 1)); > } finally { >- cleanup(new SubProgressMonitor(monitor, 1)); >- monitor.done(); >+ deleteBuildFiles(model); > } > } > >@@ -223,6 +234,27 @@ > } > } > >+ private void createDestination(String os, String ws, String arch) throws InvocationTargetException { >+ if (!fExportToDirectory) >+ return; >+ File file = new File(fDestinationDirectory, os + '.' + ws + '.' + arch); >+ if (!file.exists() || !file.isDirectory()) { >+ if (!file.mkdirs()) >+ throw new InvocationTargetException(new Exception(PDEUIMessages.ExportWizard_badDirectory)); //$NON-NLS-1$ >+ } >+ } >+ >+ protected void doExport(IFeatureModel model, String[] config, IProgressMonitor monitor) throws CoreException, InvocationTargetException { >+ // TODO progress monitoring >+ if (config == null) { >+ IFeature feature = model.getFeature(); >+ doExport(model, getOS(feature), getWS(feature), getOSArch(feature), monitor); >+ } else { >+ createDestination(config[0], config[1], config[2]); >+ doExport(model, config[0], config[1], config[2], monitor); >+ } >+ } >+ > protected void doExport(String featureID, String version, String featureLocation, String os, String ws, String arch, IProgressMonitor monitor) throws CoreException, InvocationTargetException { > monitor.beginTask("", 5); //$NON-NLS-1$ > monitor.setTaskName(PDEUIMessages.FeatureExportJob_taskName); //$NON-NLS-1$ >@@ -290,10 +322,19 @@ > fAntBuildProperties.put(IXMLConstants.PROPERTY_COLLECTING_FOLDER, "."); //$NON-NLS-1$ > String prefix = Platform.getOS().equals("macosx") ? "." : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_PREFIX, prefix); >- if (!fExportToDirectory) >- fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_FULLPATH, fDestinationDirectory + File.separator + fZipFilename); >- else >- fAntBuildProperties.put(IXMLConstants.PROPERTY_ASSEMBLY_TMP, fDestinationDirectory); >+ if (!fExportToDirectory) { >+ String filename = fZipFilename; >+ if (ftargets != null) { >+ int i = filename.lastIndexOf('.'); >+ filename = filename.substring(0, i) + '.' + os + '.' + ws + '.' + arch + filename.substring(i); >+ } >+ fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_FULLPATH, fDestinationDirectory + File.separator + filename); >+ } else { >+ String dir = fDestinationDirectory; >+ if (ftargets != null) >+ dir += File.separatorChar + os + '.' + ws + '.' + arch; >+ fAntBuildProperties.put(IXMLConstants.PROPERTY_ASSEMBLY_TMP, dir); >+ } > fAntBuildProperties.put(IXMLConstants.PROPERTY_TAR_ARGS, ""); //$NON-NLS-1$ > } > return fAntBuildProperties; >@@ -454,7 +495,12 @@ > paths.add(models[i].getInstallLocation() + IPath.SEPARATOR + "feature.xml"); //$NON-NLS-1$ > } > >- String[] plugins = TargetPlatform.createPluginPath(); >+ State state = TargetPlatform.getState(); >+ BundleDescription[] descriptions = state.getBundles(); >+ String[] plugins = new String[descriptions.length]; >+ for (int i = 0; i < descriptions.length; i++) >+ plugins[i] = descriptions[i].getLocation(); >+// String[] plugins = TargetPlatform.createPluginPath(); > String[] features = (String[]) paths.toArray(new String[paths.size()]); > String[] all = new String[plugins.length + paths.size()]; > System.arraycopy(plugins, 0, all, 0, plugins.length); >@@ -481,16 +527,19 @@ > return writer; > } > >- protected void cleanup(IProgressMonitor monitor) { >+ protected void cleanup(String[] config, IProgressMonitor monitor) { > monitor.beginTask("", 2); >+ // TODO clear out some cached values that depend on the configuration being built. >+ fDevProperties = null; >+ fAntBuildProperties = null; > File scriptFile = null; > try { > scriptFile = createScriptFile(); > writer = new PrintWriter(new FileWriter(scriptFile), true); > generateHeader(writer); >- generateDeleteZipTarget(writer); >+ generateDeleteZipTarget(writer, config); > generateCleanTarget(writer); >- boolean errors = generateZipLogsTarget(writer); >+ boolean errors = generateZipLogsTarget(writer, config); > generateClosingTag(writer); > writer.close(); > >@@ -533,16 +582,21 @@ > writer.println("</target>"); //$NON-NLS-1$ > } > >- private void generateDeleteZipTarget(PrintWriter writer) { >+ private String logName(String[] config) { >+ if (config == null) >+ return "/logs.zip"; >+ return "/logs." + config[0] + '.' + config[1] + '.' + config[2] + ".zip"; >+ } >+ private void generateDeleteZipTarget(PrintWriter writer, String[] config) { > writer.println("<target name=\"deleteZip\">"); //$NON-NLS-1$ >- writer.println("<delete file=\"" + fDestinationDirectory + "/logs.zip\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ >+ writer.println("<delete file=\"" + fDestinationDirectory + logName(config) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ > writer.println("</target>"); //$NON-NLS-1$ > } > >- private boolean generateZipLogsTarget(PrintWriter writer) { >+ private boolean generateZipLogsTarget(PrintWriter writer, String[] config) { > if (logFile != null && logFile.exists() && logFile.length() > 0) { > writer.println("<target name=\"zip.logs\">"); //$NON-NLS-1$ >- writer.println("<zip zipfile=\"" + fDestinationDirectory + "/logs.zip\" basedir=\"" + fBuildTempLocation + "/pde.logs\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ writer.println("<zip zipfile=\"" + fDestinationDirectory + logName(config) + "\" basedir=\"" + fBuildTempLocation + "/pde.logs\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > writer.println("</target>"); //$NON-NLS-1$ > return true; > } >@@ -576,7 +630,7 @@ > return NLS.bind(PDEUIMessages.ExportJob_error_message, fDestinationDirectory + File.separator + "logs.zip"); //$NON-NLS-1$ //$NON-NLS-2$ > } > >- protected void createFeature(String featureID, String featureLocation) throws IOException { >+ protected void createFeature(String featureID, String featureLocation, String[] config) throws IOException { > File file = new File(featureLocation); > if (!file.exists() || !file.isDirectory()) > file.mkdirs(); >@@ -587,7 +641,12 @@ > writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ > writer.println("<feature id=\"" + featureID + "\" version=\"1.0\">"); //$NON-NLS-1$ //$NON-NLS-2$ > >- Dictionary environment = TargetPlatform.getTargetEnvironment(); >+ Dictionary environment = new Hashtable(4); >+ environment.put("osgi.os", config[0]); >+ environment.put("osgi.ws", config[1]); >+ environment.put("osgi.arch", config[2]); >+ environment.put("osgi.nl", config[3]); >+ > BundleContext context = PDEPlugin.getDefault().getBundleContext(); > for (int i = 0; i < fItems.length; i++) { > if (fItems[i] instanceof IPluginModelBase) { >Index: src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java,v >retrieving revision 1.44 >diff -u -r1.44 FeatureExportWizard.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java 14 Mar 2005 06:22:04 -0000 1.44 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/FeatureExportWizard.java 22 Apr 2005 18:19:33 -0000 >@@ -46,7 +46,8 @@ > fPage1.getFileName(), > ((ExportWizardPageWithTable)fPage1).getSelectedItems(), > signingInfo, >- jnlpInfo); >+ jnlpInfo, >+ null); > job.setUser(true); > job.schedule(); > job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ); >Index: src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportJob.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportJob.java,v >retrieving revision 1.21 >diff -u -r1.21 PluginExportJob.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportJob.java 31 Mar 2005 06:04:53 -0000 1.21 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/PluginExportJob.java 22 Apr 2005 18:19:33 -0000 >@@ -40,7 +40,7 @@ > String zipFileName, > Object[] items, > String[] signingInfo) { >- super(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, signingInfo, null); >+ super(toDirectory, useJarFormat, exportSource, destination, zipFileName, items, signingInfo, null, null); > } > > /* (non-Javadoc) >@@ -53,7 +53,8 @@ > // create a feature to contain all plug-ins > String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$ > fFeatureLocation = fBuildTempLocation + File.separator + featureID; >- createFeature(featureID, fFeatureLocation); >+ String[] config = new String[] {TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL() }; >+ createFeature(featureID, fFeatureLocation, config); > createBuildPropertiesFile(fFeatureLocation); > if (fUseJarFormat) > createPostProcessingFile(new File(fFeatureLocation, PLUGIN_POST_PROCESSING)); >@@ -65,7 +66,7 @@ > if (fItems[i] instanceof IPluginModelBase) > deleteBuildFiles((IPluginModelBase)fItems[i]); > } >- cleanup(new SubProgressMonitor(monitor, 3)); >+ cleanup(null, new SubProgressMonitor(monitor, 3)); > monitor.done(); > } > } >Index: src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java,v >retrieving revision 1.4 >diff -u -r1.4 ProductExportWizard.java >--- src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java 9 Apr 2005 01:53:43 -0000 1.4 >+++ src/org/eclipse/pde/internal/ui/wizards/exports/ProductExportWizard.java 22 Apr 2005 18:19:33 -0000 >@@ -62,7 +62,8 @@ > page.doExportToDirectory(), > page.doExportSource(), > page.getDestination(), >- page.getFileName()); >+ page.getFileName(), >+ null); > job.setUser(true); > job.schedule(); > job.setProperty(IProgressConstants.ICON_PROPERTY, PDEPluginImages.DESC_FEATURE_OBJ);
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 92420
:
20253
|
20269
|
20389