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 199317 Details for
Bug 351526
[patch] Ant task for provisioning a target definition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch which adds the ant tasks to pde.core
New+Ant+task+for+provisioning+a+target+definition.patch (text/plain), 7.71 KB, created by
Gunnar Wagenknecht
on 2011-07-08 04:51:09 EDT
(
hide
)
Description:
patch which adds the ant tasks to pde.core
Filename:
MIME Type:
Creator:
Gunnar Wagenknecht
Created:
2011-07-08 04:51:09 EDT
Size:
7.71 KB
patch
obsolete
>diff --git build.properties build.properties >index 11f43fc..873f4e9 100644 >--- build.properties >+++ build.properties >@@ -28,4 +28,8 @@ > output.ant_tasks/pde-ant.jar = binary/ > jars.compile.order = .,\ > ant_tasks/pde-ant.jar >-jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar >+jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar,\ >+ platform:/plugin/org.eclipse.equinox.p2.repository.tools/lib/repository-tools-ant.jar,\ >+ platform:/plugin/org.eclipse.pde.build/lib/pdebuild-ant.jar >+extra.lib/pde-ant.jar = ../org.apache.ant/ant.jar,\ >+ ../org.eclipse.pde.build/lib/pdebuild-ant.jar >diff --git plugin.xml plugin.xml >index d68941c..da9c84b 100644 >--- plugin.xml >+++ plugin.xml >@@ -189,6 +189,11 @@ > name="pde.exportFeatures" > class="org.eclipse.pde.internal.core.ant.FeatureExportTask"> > </antTask> >+ <antTask >+ class="org.eclipse.pde.internal.core.ant.TargetPlatformProvisionTask" >+ library="ant_tasks/pde-ant.jar" >+ name="pde.provisionTargetDefinition"> >+ </antTask> > </extension> > > <extension >diff --git src/org/eclipse/pde/internal/core/PDECoreMessages.java src/org/eclipse/pde/internal/core/PDECoreMessages.java >index acee29b..26c924c 100644 >--- src/org/eclipse/pde/internal/core/PDECoreMessages.java >+++ src/org/eclipse/pde/internal/core/PDECoreMessages.java >@@ -71,6 +71,12 @@ > > public static String TargetPlatform_exceptionThrown; > >+ public static String TargetPlatformProvisionTask_ErrorDefinitionNotFoundAtSpecifiedLocation; >+ >+ public static String TargetPlatformProvisionTask_ErrorDefinitionNotSet; >+ >+ public static String TargetPlatformProvisionTask_ErrorDestinationNotSet; >+ > public static String FeatureBasedExportOperation_ProblemDuringExport; > > public static String FeatureConsistencyChecker_0; >diff --git src/org/eclipse/pde/internal/core/pderesources.properties src/org/eclipse/pde/internal/core/pderesources.properties >index 400721d..c786143 100644 >--- src/org/eclipse/pde/internal/core/pderesources.properties >+++ src/org/eclipse/pde/internal/core/pderesources.properties >@@ -20,6 +20,9 @@ > ExecutionEnvironmentProfileManager_0=Failed to generate custom profile: {0} > ExternalJavaSearchClasspathContainer_description= External Plug-ins > TargetPlatform_exceptionThrown=Exception caught while creating platform configuration. >+TargetPlatformProvisionTask_ErrorDefinitionNotFoundAtSpecifiedLocation=No target definition file found at location "{0}"\! >+TargetPlatformProvisionTask_ErrorDefinitionNotSet=Target definition file not set\! >+TargetPlatformProvisionTask_ErrorDestinationNotSet=Destination directory not set\! > TargetPlatformResetJob_resetTarget=Resetting Target Platform > > FeatureBasedExportOperation_ProblemDuringExport=Problem during export >diff --git src_ant/org/eclipse/pde/internal/core/ant/TargetPlatformProvisionTask.java src_ant/org/eclipse/pde/internal/core/ant/TargetPlatformProvisionTask.java >new file mode 0 >index 0000000..74fc9bc 0 >--- /dev/null >+++ src_ant/org/eclipse/pde/internal/core/ant/TargetPlatformProvisionTask.java >@@ -0,0 +1,127 @@ >+/** >+ * Copyright (c) 2011 Gunnar Wagenknecht 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: >+ * Gunnar Wagenknecht - initial API and implementation >+ */ >+package org.eclipse.pde.internal.core.ant; >+ >+import java.io.File; >+import org.apache.tools.ant.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.internal.build.BundleHelper; >+import org.eclipse.pde.internal.build.tasks.TaskHelper; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.PDECoreMessages; >+import org.eclipse.pde.internal.core.target.ExportTargetJob; >+import org.eclipse.pde.internal.core.target.TargetPlatformService; >+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition; >+ >+/** >+ * >+ */ >+public class TargetPlatformProvisionTask extends Task { >+ >+ private File targetFile; >+ private File destinationDirectory; >+ private boolean clearDestination; >+ >+ public void execute() throws BuildException { >+ >+ try { >+ BundleHelper.getDefault().setLog(this); >+ run(); >+ } catch (CoreException e) { >+ throw new BuildException(TaskHelper.statusToString(e.getStatus(), null).toString()); >+ } finally { >+ BundleHelper.getDefault().setLog(null); >+ } >+ >+ } >+ >+ private void export(final ITargetDefinition targetDefinition) throws CoreException { >+ // export using Job to allow progress reporting when run inside IDE >+ ExportTargetJob exportTargetJob = new ExportTargetJob(targetDefinition, destinationDirectory.toURI(), clearDestination); >+ exportTargetJob.schedule(); >+ try { >+ exportTargetJob.join(); >+ } catch (InterruptedException e) { >+ Thread.currentThread().interrupt(); >+ throw new CoreException(Status.CANCEL_STATUS); >+ } >+ } >+ >+ private IStatus resolve(final ITargetDefinition targetDefinition) throws CoreException { >+ // resolve using Job to allow progress reporting when run inside IDE >+ final IStatus[] status = new IStatus[1]; >+ Job resolveJob = new Job(NLS.bind("Resolving {0}", null != targetDefinition.getName() && targetDefinition.getName().length() > 0 ? targetDefinition.getName() : targetFile.getName())) { >+ protected IStatus run(IProgressMonitor monitor) { >+ status[0] = targetDefinition.resolve(monitor); >+ return Status.OK_STATUS; >+ } >+ }; >+ resolveJob.setPriority(Job.LONG); >+ resolveJob.schedule(); >+ try { >+ resolveJob.join(); >+ } catch (InterruptedException e) { >+ Thread.currentThread().interrupt(); >+ throw new CoreException(Status.CANCEL_STATUS); >+ } >+ return status[0]; >+ } >+ >+ private void run() throws CoreException { >+ if (null == targetFile) >+ throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.TargetPlatformProvisionTask_ErrorDefinitionNotSet)); >+ if (!targetFile.isFile() || !targetFile.canRead()) >+ throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.TargetPlatformProvisionTask_ErrorDefinitionNotFoundAtSpecifiedLocation, targetFile))); >+ if (null == destinationDirectory) >+ throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.TargetPlatformProvisionTask_ErrorDestinationNotSet)); >+ >+ final ITargetDefinition targetDefinition = TargetPlatformService.getDefault().getTarget(targetFile.toURI()).getTargetDefinition(); >+ >+ log("Resolving target definition..."); >+ IStatus status = resolve(targetDefinition); >+ if (status.matches(IStatus.ERROR | IStatus.CANCEL)) >+ throw new CoreException(status); >+ else if (!status.isOK()) { >+ log(TaskHelper.statusToString(status, null).toString(), Project.MSG_WARN); >+ } >+ >+ log("Exporting target definition..."); >+ export(targetDefinition); >+ } >+ >+ /** >+ * Set whether the destination should be cleared prior to provisioning. >+ * @param clearDestination >+ */ >+ public void setClearDestination(boolean clearDestination) { >+ this.clearDestination = clearDestination; >+ } >+ >+ /** >+ * Set the folder in which the target will be provisioned. >+ * @param destinationDirectory >+ */ >+ public void setDestinationDirectory(File destinationDirectory) { >+ this.destinationDirectory = destinationDirectory; >+ } >+ >+ /** >+ * Set the target file to provision >+ * @param targetFile >+ */ >+ public void setTargetFile(File targetFile) { >+ this.targetFile = targetFile; >+ } >+ >+}
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 351526
:
199316
| 199317