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 34651 Details for
Bug 34757
Support for other repository
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]
34757_copy_extension.patch.txt
34757_copy_extension.patch.txt (text/plain), 11.57 KB, created by
Gunnar Wagenknecht
on 2006-02-14 03:12:54 EST
(
hide
)
Description:
34757_copy_extension.patch.txt
Filename:
MIME Type:
Creator:
Gunnar Wagenknecht
Created:
2006-02-14 03:12:54 EST
Size:
11.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.build >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/plugin.properties,v >retrieving revision 1.13 >diff -u -r1.13 plugin.properties >--- plugin.properties 13 Feb 2006 20:03:00 -0000 1.13 >+++ plugin.properties 14 Feb 2006 08:11:35 -0000 >@@ -11,4 +11,4 @@ > pluginName = Plug-in Development Environment Build Support > providerName = Eclipse.org > >-fetchTaskFactories.name = Fetch Script Factories >+fetchFactories.name = Fetch Script Factories >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/plugin.xml,v >retrieving revision 1.56 >diff -u -r1.56 plugin.xml >--- plugin.xml 13 Feb 2006 22:10:04 -0000 1.56 >+++ plugin.xml 14 Feb 2006 08:11:35 -0000 >@@ -1,7 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> > <plugin> >- <extension-point id="fetchFactories" name="%fetchTaskFactories.name" schema="schema/fetchTaskFactories.exsd"/> >+ <extension-point id="fetchFactories" name="%fetchFactories.name" schema="schema/fetchFactories.exsd"/> > <!-- Tasks --> > <extension > point="org.eclipse.ant.core.antTasks"> >@@ -96,6 +96,9 @@ > <factory > class="org.eclipse.pde.internal.build.fetch.CVSFetchTaskFactory" > id="CVS"/> >+ <factory >+ class="org.eclipse.pde.internal.build.fetch.COPYFetchTasksFactory" >+ id="COPY"/> > </extension> > > <extension >Index: schema/fetchFactories.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/schema/fetchFactories.exsd,v >retrieving revision 1.1 >diff -u -r1.1 fetchFactories.exsd >--- schema/fetchFactories.exsd 13 Feb 2006 20:03:00 -0000 1.1 >+++ schema/fetchFactories.exsd 14 Feb 2006 08:11:35 -0000 >@@ -84,13 +84,13 @@ > </appInfo> > <documentation> > <pre> >-<extension point="org.eclipse.pde.build.fetchTaskFactories"> >+<extension point="org.eclipse.pde.build.fetchFactories"> >+ <factory >+ class="org.eclipse.pde.internal.build.fetch.CVSFetchTaskFactory" >+ id="CVS"/> > <factory > class="org.eclipse.pde.internal.build.fetch.COPYFetchTasksFactory" > id="COPY"/> >- <factory >- class="org.eclipse.pde.internal.build.fetch.CVSFetchTaskFactory" >- id="CVS"/> > </extension> > </pre> > </documentation> >@@ -101,7 +101,7 @@ > <meta.section type="apiInfo"/> > </appInfo> > <documentation> >- See the org.eclipse.pde.build.IFetchFactory interface. >+ See the <code>org.eclipse.pde.build.IFetchFactory</code> interface. > </documentation> > </annotation> > >Index: src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java >diff -N src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,177 @@ >+/********************************************************************** >+ * Copyright (c) 2004, 2006 Eclipse Foundation 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.build.fetch; >+ >+import java.util.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.build.*; >+import org.eclipse.pde.internal.build.*; >+ >+/** >+ * An <code>IFetchFactory</code> that fetches features and plugins by >+ * copying from a specific location (id: <code>COPY</code>). >+ * <p> >+ * Map file arguments: >+ * <code><ROOT_LOCATION>[,<ELEMENT_LOCATION>]</code> >+ * <dl> >+ * <dt>ROOT_LOCATION</dt> >+ * <dd>The ROOT_LOCATION (eg. <code>/source/eclipse</code>, or >+ * <code>D:/dev/myproduct</code>) is used as root path to determine the >+ * location to fetch. It can be overwritten via the >+ * <code>fetchTag</code> to fetch from another location (for example, on a different machine).</dd> >+ * </dl> >+ * <dt>ELEMENT_LOCATION</dt> >+ * <dd>A path withing the ROOT_LOCATION (eg. >+ * <code>org.eclipse.sdk-feature/features/org.eclipse.rcp</code>) to retrive >+ * the element from if it is not within the root. If this is not provided the >+ * default path will be used which simply maps to the element name.</dd> >+ * </dl> >+ * </p> >+ */ >+public class COPYFetchTasksFactory implements IFetchFactory, IPDEBuildConstants { >+ public static final String ID = "COPY"; //$NON-NLS-1$ >+ >+ private static final String TARGET_GET_FROM_DISC = "FetchFromDisc"; //$NON-NLS-1$ >+ private static final String SEPARATOR = ","; //$NON-NLS-1$ >+ private static final String OVERRIDE_TAG = ID; >+ >+ //COPY specific keys used in the map being passed around. >+ private static final String KEY_PATH = "path"; //$NON-NLS-1$ >+ private static final String KEY_ROOT = "root"; //$NON-NLS-1$ >+ >+ //Properties used in the COPY part of the scripts >+ private static final String PROP_DESTINATIONFOLDER = "destination"; //$NON-NLS-1$ >+ private static final String PROP_QUIET = "quiet"; //$NON-NLS-1$ >+ private static final String PROP_SOURCEPATH = "sourcePath"; //$NON-NLS-1$ >+ private static final String PROP_FILETOCHECK = "fileToCheck"; //$NON-NLS-1$ >+ >+ public void generateRetrieveElementCall(Map entryInfos, IPath destination, IAntScript script) { >+ String type = (String) entryInfos.get(KEY_ELEMENT_TYPE); >+ String element = (String) entryInfos.get(KEY_ELEMENT_NAME); >+ >+ Map params = new HashMap(2); >+ // we directly copy the disc content into the destination >+ params.put(PROP_DESTINATIONFOLDER, destination.toString()); >+ params.put(PROP_QUIET, "${copy.quiet}"); //$NON-NLS-1$ >+ >+ String root = (String) entryInfos.get(KEY_ROOT); >+ String path = (String) entryInfos.get(KEY_PATH); >+ IPath sourcePath = new Path(root); >+ if (path != null) { >+ sourcePath = sourcePath.append(path); >+ } else { >+ sourcePath = sourcePath.append(element); >+ } >+ params.put(PROP_SOURCEPATH, sourcePath.toString()); >+ >+ IPath locationToCheck = (IPath) destination.clone(); >+ if (type.equals(ELEMENT_TYPE_FEATURE)) { >+ locationToCheck = locationToCheck.append(Constants.FEATURE_FILENAME_DESCRIPTOR); >+ } else if (type.equals(ELEMENT_TYPE_PLUGIN)) { >+ locationToCheck = locationToCheck.append(Constants.PLUGIN_FILENAME_DESCRIPTOR); >+ } else if (type.equals(ELEMENT_TYPE_FRAGMENT)) { >+ locationToCheck = locationToCheck.append(Constants.FRAGMENT_FILENAME_DESCRIPTOR); >+ } else if (type.equals(ELEMENT_TYPE_BUNDLE)) { >+ locationToCheck = locationToCheck.append(Constants.BUNDLE_FILENAME_DESCRIPTOR); >+ } >+ params.put(PROP_FILETOCHECK, locationToCheck.toString()); >+ >+ printAvailableTask(locationToCheck.toString(), locationToCheck.toString(), script); >+ if (type.equals(IFetchFactory.ELEMENT_TYPE_PLUGIN) || type.equals(IFetchFactory.ELEMENT_TYPE_FRAGMENT)) { >+ printAvailableTask(locationToCheck.toString(), locationToCheck.removeLastSegments(1).append(Constants.BUNDLE_FILENAME_DESCRIPTOR).toString(), script); >+ } >+ >+ script.printAntCallTask(TARGET_GET_FROM_DISC, true, params); >+ } >+ >+ public void generateRetrieveFilesCall(final Map entryInfos, IPath destination, final String[] files, IAntScript script) { >+ String root = (String) entryInfos.get(KEY_ROOT); >+ String path = (String) entryInfos.get(KEY_PATH); >+ >+ for (int i = 0; i < files.length; i++) { >+ String file = files[i]; >+ IPath filePath = new Path(root); >+ if (path != null) { >+ filePath = filePath.append(path).append(file); >+ } else { >+ filePath = filePath.append((String) entryInfos.get(KEY_ELEMENT_NAME)).append(file); >+ } >+ printCopyTask(filePath.toString(), destination.toString(), null, false, true, script); >+ } >+ } >+ >+ public void addTargets(IAntScript script) { >+ script.printTargetDeclaration(TARGET_GET_FROM_DISC, null, null, "${" + PROP_FILETOCHECK + "}", null); //$NON-NLS-1$ //$NON-NLS-2$ >+ printCopyTask(null, "${" + PROP_DESTINATIONFOLDER + "}", new String[] {"${" + PROP_SOURCEPATH + "}"}, false, true, script); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ script.printTargetEnd(); >+ } >+ >+ public void parseMapFileEntry(String repoSpecificentry, Properties overrideTags, Map entryInfos) throws CoreException { >+ String[] arguments = Utils.getArrayFromStringWithBlank(repoSpecificentry, SEPARATOR); >+ if (arguments.length < 1) { >+ String message = NLS.bind(Messages.error_incorrectDirectoryEntry, entryInfos.get(KEY_ELEMENT_NAME)); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); >+ } >+ >+ String overrideTag = overrideTags.getProperty(OVERRIDE_TAG); >+ entryInfos.put(KEY_ROOT, (null == overrideTag || overrideTag.trim().length() == 0) ? arguments[0] : overrideTag); >+ entryInfos.put(KEY_PATH, (arguments.length > 1 && arguments[1].trim().length() > 0) ? arguments[1] : null); >+ } >+ >+ /** >+ * Print the <code>available</code> Ant task to this script. This task sets a property >+ * value if the given file exists at runtime. >+ * >+ * @param property the property to set >+ * @param file the file to look for >+ * @param script the script to print to >+ */ >+ private void printAvailableTask(String property, String file, IAntScript script) { >+ script.printTabs(); >+ script.print("<available"); //$NON-NLS-1$ >+ script.printAttribute("property", property, true); //$NON-NLS-1$ >+ script.printAttribute("file", file, false); //$NON-NLS-1$ >+ script.println("/>"); //$NON-NLS-1$ >+ } >+ >+ /** >+ * Print a <code>copy</code> task to the script. The source file is specified >+ * by the <code>file</code> OR the <code>dirs</code> parameter. >+ * The destination directory is specified by the <code>todir</code> parameter. >+ * @param file the source file >+ * @param todir the destination directory >+ * @param dirs the directories to copy >+ * @param overwrite indicates if existing files should be overwritten >+ * @param script the script to print to >+ */ >+ private void printCopyTask(String file, String todir, String[] dirs, boolean failOnError, boolean overwrite, IAntScript script) { >+ script.printTabs(); >+ script.print("<copy"); //$NON-NLS-1$ >+ script.printAttribute("file", file, false); //$NON-NLS-1$ >+ script.printAttribute("todir", todir, false); //$NON-NLS-1$ >+ script.printAttribute("failonerror", failOnError ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ script.printAttribute("overwrite", overwrite ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ >+ if (dirs == null) >+ script.println("/>"); //$NON-NLS-1$ >+ else { >+ script.println(">"); //$NON-NLS-1$ >+ for (int i = 0; i < dirs.length; i++) { >+ script.printTabs(); >+ script.print("\t<fileset"); //$NON-NLS-1$ >+ script.printAttribute("dir", dirs[i], true); //$NON-NLS-1$ >+ script.println("/>"); //$NON-NLS-1$ >+ } >+ script.println("</copy>"); //$NON-NLS-1$ >+ } >+ } >+}
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 34757
:
12626
|
22206
|
30757
|
33845
|
33847
|
34178
|
34179
|
34327
|
34649
|
34650
|
34651
|
34743