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 22206 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]
[patch] pluggable fetch script builder
org.eclipse.pde.build-patch.txt (text/plain), 58.94 KB, created by
Gunnar Wagenknecht
on 2005-06-02 02:06:28 EDT
(
hide
)
Description:
[patch] pluggable fetch script builder
Filename:
MIME Type:
Creator:
Gunnar Wagenknecht
Created:
2005-06-02 02:06:28 EDT
Size:
58.94 KB
patch
obsolete
>Index: .cvsignore >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/.cvsignore,v >retrieving revision 1.3 >diff -u -r1.3 .cvsignore >--- .cvsignore 4 Apr 2002 18:44:53 -0000 1.3 >+++ .cvsignore 2 Jun 2005 05:55:23 -0000 >@@ -1,2 +1,7 @@ > bin >-lib >\ No newline at end of file >+lib >+temp* >+build.xml >+pdebuild.jar >+org.eclipse.pde.build_*.zip >+pdebuildsrc.zip >Index: plugin.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/plugin.properties,v >retrieving revision 1.12 >diff -u -r1.12 plugin.properties >--- plugin.properties 21 Feb 2005 23:31:25 -0000 1.12 >+++ plugin.properties 2 Jun 2005 05:55:23 -0000 >@@ -10,3 +10,6 @@ > ############################################################################### > pluginName = Plug-in Development Environment Build Support > providerName = Eclipse.org >+ >+ >+fetchScriptBuilders.name = Fetch Script Builders >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/plugin.xml,v >retrieving revision 1.53 >diff -u -r1.53 plugin.xml >--- plugin.xml 2 May 2005 14:17:55 -0000 1.53 >+++ plugin.xml 2 Jun 2005 05:55:23 -0000 >@@ -1,6 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> > <plugin> >+ <extension-point id="fetchScriptBuilders" name="%fetchScriptBuilders.name" schema="schema/fetchScriptBuilders.exsd"/> > <!-- Tasks --> > <extension > point="org.eclipse.ant.core.antTasks"> >@@ -86,4 +87,14 @@ > </application> > </extension> > >+ <extension >+ point="org.eclipse.pde.build.fetchScriptBuilders"> >+ <builder >+ class="org.eclipse.pde.internal.build.fetch.COPYFetchScriptBuilder" >+ id="COPY"/> >+ <builder >+ class="org.eclipse.pde.internal.build.fetch.CVSFetchScriptBuilder" >+ id="CVS"/> >+ </extension> >+ > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/META-INF/MANIFEST.MF,v >retrieving revision 1.8 >diff -u -r1.8 MANIFEST.MF >--- META-INF/MANIFEST.MF 20 May 2005 15:26:03 -0000 1.8 >+++ META-INF/MANIFEST.MF 2 Jun 2005 05:55:23 -0000 >@@ -10,7 +10,8 @@ > org.eclipse.update.core, > org.apache.ant, > org.eclipse.core.runtime.compatibility;optional=true >-Provide-Package: org.eclipse.pde.internal.build;x-friends:="org.eclipse.pde.ui", >+Provide-Package: org.eclipse.pde.build, >+ org.eclipse.pde.internal.build;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.build.ant;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.build.builder;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.build.packager;x-friends:="org.eclipse.pde.ui", >Index: src/org/eclipse/pde/internal/build/BuildActivator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/BuildActivator.java,v >retrieving revision 1.4 >diff -u -r1.4 BuildActivator.java >--- src/org/eclipse/pde/internal/build/BuildActivator.java 21 Feb 2005 23:31:25 -0000 1.4 >+++ src/org/eclipse/pde/internal/build/BuildActivator.java 2 Jun 2005 05:55:23 -0000 >@@ -20,5 +20,6 @@ > > public void stop(BundleContext ctx) throws Exception { > BundleHelper.close(); >+ FetchScriptBuildersRegistry.shutdown(); > } > } >Index: src/org/eclipse/pde/internal/build/FetchScriptGenerator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FetchScriptGenerator.java,v >retrieving revision 1.44 >diff -u -r1.44 FetchScriptGenerator.java >--- src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 11 May 2005 20:15:57 -0000 1.44 >+++ src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 2 Jun 2005 05:55:23 -0000 >@@ -10,13 +10,35 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.build; > >-import java.io.*; >-import java.util.*; >+import java.io.BufferedInputStream; >+import java.io.BufferedOutputStream; >+import java.io.File; >+import java.io.FileInputStream; >+import java.io.FileOutputStream; >+import java.io.IOException; >+import java.io.InputStream; >+import java.io.OutputStream; >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+import java.util.Properties; >+ > import org.eclipse.ant.core.AntRunner; >-import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Status; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.build.IFetchScriptBuilder; > import org.eclipse.pde.internal.build.ant.AntScript; >-import org.eclipse.update.core.*; >+import org.eclipse.pde.internal.build.ant.ITask; >+import org.eclipse.pde.internal.build.fetch.CVSFetchScriptBuilder; >+import org.eclipse.update.core.Feature; >+import org.eclipse.update.core.IFeature; >+import org.eclipse.update.core.IIncludedFeatureReference; >+import org.eclipse.update.core.IPluginEntry; > import org.eclipse.update.internal.core.FeatureExecutableFactory; > > /** >@@ -24,16 +46,13 @@ > * to retrieve plug-ins and features from the CVS repository. > */ > public class FetchScriptGenerator extends AbstractScriptGenerator { >- private static final String BUNDLE = "bundle"; //$NON-NLS-1$ >- private static final String FRAGMENT = "fragment"; //$NON-NLS-1$ >- private static final String PLUGIN = "plugin"; //$NON-NLS-1$ >- private static final String FEATURE = "feature"; //$NON-NLS-1$ >+ private static final String BUNDLE = IFetchScriptBuilder.ELEMENT_TYPE_BUNDLE; >+ private static final String FRAGMENT = IFetchScriptBuilder.ELEMENT_TYPE_FRAGMENT; >+ private static final String PLUGIN = IFetchScriptBuilder.ELEMENT_TYPE_PLUGIN; >+ private static final String FEATURE = IFetchScriptBuilder.ELEMENT_TYPE_FEATURE; > private static final String ELEMENT = "element"; //$NON-NLS-1$ > private static final String TYPE = "type"; //$NON-NLS-1$ >- private static final String PATH = "path"; //$NON-NLS-1$ >- private static final String PASSWORD = "password"; //$NON-NLS-1$ >- private static final String CVSROOT = "cvsRoot"; //$NON-NLS-1$ >- private static final String TAG = "tag"; //$NON-NLS-1$ >+ private static final String BUILDER = "builder"; //$NON-NLS-1$ > > // flag saying if we want to recursively generate the scripts > protected boolean recursiveGeneration = true; >@@ -173,7 +192,7 @@ > generateFetchPluginsTarget(); > generateFetchRecusivelyTarget(); > } >- generateGetFromCVSTarget(); >+ generateGetFromRepositoryTarget(); > generateEpilogue(); > } > >@@ -204,7 +223,7 @@ > > protected void generateFetchPluginsTarget() throws CoreException { > script.printTargetDeclaration(TARGET_FETCH_PLUGINS, null, FEATURE_AND_PLUGINS, null, null); >- retrieveFeature((String) mapInfos.get(ELEMENT), (String) mapInfos.get(CVSROOT), (String) mapInfos.get(TAG), (String) mapInfos.get(PASSWORD), (String) mapInfos.get(PATH)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-1$ //$NON-NLS-5$ >+ retrieveFeature((String) mapInfos.get(ELEMENT), (String) mapInfos.get(TYPE), mapInfos); > generateChildrenFetchScript(); > script.printTargetEnd(); > } >@@ -219,28 +238,59 @@ > private Map processMapFileEntry(String entry) throws CoreException { > Map entryInfos = new HashMap(5); > >- String cvsInfo = getCVSInfo(entry); >- if (cvsInfo == null) { >+ // extract type and element from entry >+ int index = entry.indexOf('@'); //$NON-NLS-1$ >+ String type = entry.substring(0, index); >+ String currentElement = entry.substring(index + 1); >+ >+ // read and validate the repository info >+ String repositoryInfo = getRepositoryInfo(entry); >+ if (repositoryInfo == null) { > String message = NLS.bind(Messages.error_missingDirectoryEntry, entry); > BundleHelper.getDefault().getLog().log(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); > return null; > } > >- String[] cvsFields = Utils.getArrayFromStringWithBlank(cvsInfo, ","); //$NON-NLS-1$ >- if (cvsFields.length < 2) { >- String message = NLS.bind(Messages.error_incorrectDirectoryEntry, element); >+ // collect and validate the repository info >+ String[] repositoryFields = Utils.getArrayFromStringWithBlank(repositoryInfo, ","); //$NON-NLS-1$ >+ if (repositoryFields.length < 2) { >+ String message = NLS.bind(Messages.error_incorrectDirectoryEntry, currentElement); > throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); > } > >- entryInfos.put(TAG, fetchTag.length() == 0 ? cvsFields[0] : fetchTag); //$NON-NLS-1$ >- entryInfos.put(CVSROOT, cvsFields[1]); //$NON-NLS-1$ >- entryInfos.put(PASSWORD, (cvsFields.length > 2 && !cvsFields[2].equals("")) ? cvsFields[2] : null); //$NON-NLS-1$ //$NON-NLS-2$ >- >- entryInfos.put(PATH, (cvsFields.length > 3 && !cvsFields[3].equals("")) ? cvsFields[3] : null); //$NON-NLS-1$ //$NON-NLS-2$ >- >- int index = entry.indexOf('@'); //$NON-NLS-1$ >- entryInfos.put(TYPE, entry.substring(0, index)); //$NON-NLS-1$ >- entryInfos.put(ELEMENT, entry.substring(index + 1)); //$NON-NLS-1$ >+ // determine fetch script builder >+ IFetchScriptBuilder fetchScriptBuilder = null; >+ String[] arguments = null; >+ >+ // check if first repository field matches a builder id >+ if(FetchScriptBuildersRegistry.getRegistry().getBuilderIds().contains(repositoryFields[0])) >+ { >+ fetchScriptBuilder = FetchScriptBuildersRegistry.getRegistry().getBuilder(repositoryFields[0]); >+ >+ // construct arguments array for registered builder >+ arguments = new String[repositoryFields.length-1]; >+ System.arraycopy(repositoryFields, 1, arguments, 0, repositoryFields.length-1); >+ } >+ >+ // default to CVS builder (to be compatible) >+ if( null == fetchScriptBuilder) >+ { >+ // fall back to CVS >+ fetchScriptBuilder = new CVSFetchScriptBuilder(); >+ >+ // construct arguments array for CVS builder >+ arguments = repositoryFields; >+ } >+ >+ // add infos from registered builder >+ fetchScriptBuilder.processMapFileEntry(currentElement, type, arguments, fetchTag, entryInfos); >+ >+ // store builder >+ entryInfos.put(BUILDER, fetchScriptBuilder); >+ >+ // add general infos (will override builder specific infos) >+ entryInfos.put(TYPE, type); >+ entryInfos.put(ELEMENT, currentElement); > return entryInfos; > } > >@@ -257,14 +307,14 @@ > } > continue; > } >- >+ > //Included features can be available in the baseLocation. >- if (getCVSInfo(FEATURE + '@' + featureId) != null) >+ if (getRepositoryInfo(FEATURE + '@' + featureId) != null) > script.printAntTask(Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + FETCH_FILE_PREFIX + featureId + ".xml", null, TARGET_FETCH, null, null, null); //$NON-NLS-1$ > else if (getSite(false).findFeature(featureId, null, false) == null) { > String message = NLS.bind(Messages.error_cannotFetchNorFindFeature, featureId); > throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_FEATURE_MISSING, message, null)); >- } >+ } > } > script.printTargetEnd(); > } >@@ -277,57 +327,63 @@ > return false; > } > >- String password = (String) mapFileEntry.get(PASSWORD); >- if (password != null) >- script.printCVSPassTask((String) mapFileEntry.get(CVSROOT), password, cvsPassFileLocation); //$NON-NLS-1$ >- >+ IFetchScriptBuilder builder = (IFetchScriptBuilder) mapFileEntry.get(BUILDER); >+ String elementToFetch = (String) mapFileEntry.get(ELEMENT); > String type = (String) mapFileEntry.get(TYPE); >+ >+ // print authentification task if one is provided >+ ITask authTask = builder.generateAuthentificationTask(elementToFetch,type,mapFileEntry); >+ if(null != authTask) script.print(authTask); >+ >+ // the location > String location = getElementLocation(type); >- Map params = new HashMap(5); > >- //We directly export the CVS content into the correct directory >- params.put("destination", mapFileEntry.get(ELEMENT)); //$NON-NLS-1$ //$NON-NLS-2$ >- params.put(TAG, mapFileEntry.get(TAG)); //$NON-NLS-1$ //$NON-NLS-2$ >- params.put(CVSROOT, mapFileEntry.get(CVSROOT)); //$NON-NLS-1$ //$NON-NLS-2$ >- params.put("quiet", "${quiet}"); //$NON-NLS-1$ //$NON-NLS-2$ >+ // the destination >+ // we directly export the content into the correct directory >+ String destination = elementToFetch; >+ >+ // get params from builder >+ Map params = new HashMap(builder.generatePropertiesForFetchTask(elementToFetch, type, mapFileEntry, destination, manifestFileOnly)); > >- String cvsPackage = ((String) mapFileEntry.get(PATH) == null ? (String) mapFileEntry.get(ELEMENT) : (String) mapFileEntry.get(PATH)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > String fullLocation = null; > if (type.equals(FEATURE)) { > fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >- repositoryFeatureVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryFeatureVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); > } else if (type.equals(PLUGIN)) { >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ fullLocation = location + '/' + elementToFetch + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >- repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); > } else if (type.equals(FRAGMENT)) { >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ fullLocation = location + '/' + elementToFetch + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >- repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); > } else if (type.equals(BUNDLE)) { > fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR; > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR : "";//$NON-NLS-1$ >- repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); > } >- params.put("package", cvsPackage); //$NON-NLS-1$ > > // This call create a new property for every feature, plugins or fragments that we must check the existence of > script.printAvailableTask(fullLocation, fullLocation); > if (type.equals(PLUGIN) || type.equals(FRAGMENT)) { >- script.printAvailableTask(fullLocation, location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR); >+ script.printAvailableTask(fullLocation, location + '/' + elementToFetch + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR); > } >- script.printAntTask("../" + scriptName, Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + (type.equals(FEATURE) ? DEFAULT_FEATURE_LOCATION : DEFAULT_PLUGIN_LOCATION), TARGET_GET_FROM_CVS, null, null, params); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ script.printAntTask("../" + scriptName, Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + (type.equals(FEATURE) ? DEFAULT_FEATURE_LOCATION : DEFAULT_PLUGIN_LOCATION), TARGET_FETCH_FROM_REPOSITORY, null, null, params); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > return true; > } > >- protected void generateGetFromCVSTarget() { >- script.printTargetDeclaration(TARGET_GET_FROM_CVS, null, null, "${fileToCheck}", "{destination}"); //$NON-NLS-1$ //$NON-NLS-2$ >- script.printCVSTask("export -d ${destination} -r ${tag} ${package}", "${cvsRoot}", null, null, null, "${quiet}", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ protected void generateGetFromRepositoryTarget() { >+ script.printTargetDeclaration(TARGET_FETCH_FROM_REPOSITORY, null, null, "${fileToCheck}", null); //$NON-NLS-1$ >+ if(null != mapInfos) { >+ IFetchScriptBuilder builder = (IFetchScriptBuilder) mapInfos.get(BUILDER); >+ if(null != builder) { >+ ITask getTask = builder.getFetchTask(); >+ if(null != getTask) { >+ script.print(getTask); >+ } >+ } >+ } > script.printTargetEnd(); > } > >@@ -379,12 +435,11 @@ > * constructor from Update. > * > * @param elementName the feature to retrieve >- * @param cvsRoot the root in CVS >- * @param tag the CVS tag >- * @param password the CVS password >+ * @param elementType the element type >+ * @param elementInfos the element information > * @throws CoreException > */ >- protected void retrieveFeature(String elementName, String cvsRoot, String tag, String password, String path) throws CoreException { >+ protected void retrieveFeature(String elementName, String elementType, Map elementInfos) throws CoreException { > // Generate a temporary Ant script which retrieves the feature.xml for this > // feature from CVS > File root = new File(workingDirectory); >@@ -395,21 +450,15 @@ > retrieve.printProjectDeclaration("RetrieveFeature", "main", "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > retrieve.printTargetDeclaration(TARGET_MAIN, null, null, null, null); //$NON-NLS-1$ > >- IPath moduleFeatureFile; >- IPath moduleFeatureProperties; >- if (path != null) { >- moduleFeatureFile = new Path(path).append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); >- moduleFeatureProperties = new Path(path).append(PROPERTIES_FILE); >- } else { >- moduleFeatureFile = new Path(elementName).append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); >- moduleFeatureProperties = new Path(elementName).append(PROPERTIES_FILE); >+ String destination = elementName; >+ String[] files = new String[] {DEFAULT_FEATURE_FILENAME_DESCRIPTOR, PROPERTIES_FILE}; >+ IFetchScriptBuilder builder = (IFetchScriptBuilder) elementInfos.get(BUILDER); >+ ITask retrieveFeatureTask = builder.generateRetrieveFilesTask(elementName, elementType, elementInfos, destination, files); >+ if(null == retrieveFeatureTask) { >+ String message = NLS.bind(Messages.error_noRetrieveFeatureTask, elementName); //$NON-NLS-1$ >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); > } >- >- if (password != null) >- retrieve.printCVSPassTask(cvsRoot, password, cvsPassFileLocation); >- >- retrieve.printCVSTask("export -r " + tag + " " + moduleFeatureFile.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ >- retrieve.printCVSTask("export -r " + tag + " " + moduleFeatureProperties.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ >+ retrieve.print(retrieveFeatureTask); > > retrieve.printTargetEnd(); > retrieve.printProjectEnd(); >@@ -427,14 +476,15 @@ > AntRunner runner = new AntRunner(); > runner.setBuildFileLocation(target.getAbsolutePath()); > runner.run(); >+ String destination = elementName; > FeatureExecutableFactory factory = new FeatureExecutableFactory(); >- File featureFolder = new File(root, (path == null ? elementName : path)); >+ File featureFolder = new File(root, destination); > feature = (Feature) factory.createFeature(featureFolder.toURL(), null, null); > > //We only delete here, so if an exception is thrown the user can still see the retrieve.xml > target.delete(); > featureProperties = new Properties(); >- InputStream featureStream = new FileInputStream(new File(root, (path == null ? elementName : path) + '/' + PROPERTIES_FILE)); >+ InputStream featureStream = new FileInputStream(new File(root, destination + '/' + PROPERTIES_FILE)); > featureProperties.load(featureStream); > featureStream.close(); > clear(featureFolder); >@@ -484,7 +534,7 @@ > */ > protected String getElementLocation(String type) { > IPath location = new Path(Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY)); >- if (type.equals(FEATURE)) //$NON-NLS-1$ >+ if (type.equals(FEATURE)) > location = location.append(DEFAULT_FEATURE_LOCATION); > else > location = location.append(DEFAULT_PLUGIN_LOCATION); >@@ -498,7 +548,7 @@ > * @return String > * @throws CoreException > */ >- protected String getCVSInfo(String elementName) throws CoreException { >+ protected String getRepositoryInfo(String elementName) throws CoreException { > if (directory == null) > directory = readProperties(directoryLocation, "", IStatus.ERROR); //$NON-NLS-1$ > return directory.getProperty(elementName); >Index: src/org/eclipse/pde/internal/build/IXMLConstants.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IXMLConstants.java,v >retrieving revision 1.56 >diff -u -r1.56 IXMLConstants.java >--- src/org/eclipse/pde/internal/build/IXMLConstants.java 27 Apr 2005 12:54:42 -0000 1.56 >+++ src/org/eclipse/pde/internal/build/IXMLConstants.java 2 Jun 2005 05:55:23 -0000 >@@ -53,7 +53,7 @@ > public static final String TARGET_FETCH_ELEMENT = "fetch.element"; //$NON-NLS-1$ > public static final String TARGET_FETCH_PLUGINS = "fetch.plugins"; //$NON-NLS-1$ > public static final String TARGET_FETCH_RECURSIVELY = "fetch.recursively"; //$NON-NLS-1$ >- public static final String TARGET_GET_FROM_CVS = "getFromCVS"; //$NON-NLS-1$ >+ public static final String TARGET_FETCH_FROM_REPOSITORY = "fetchFromRepository"; //$NON-NLS-1$ > public static final String TARGET_EFFECTIVE_FETCH = "effectiveFetch"; //$NON-NLS-1$ > public static final String TARGET_JARUP = "jarUp"; //$NON-NLS-1$ > public static final String TARGET_JARING = "jarIng"; //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/build/Messages.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/Messages.java,v >retrieving revision 1.8 >diff -u -r1.8 Messages.java >--- src/org/eclipse/pde/internal/build/Messages.java 27 Apr 2005 14:46:58 -0000 1.8 >+++ src/org/eclipse/pde/internal/build/Messages.java 2 Jun 2005 05:55:23 -0000 >@@ -33,7 +33,8 @@ > public static String error_configWrongFormat; > public static String error_missingCustomBuildFile; > public static String error_missingSourceFolder; >- >+ public static String error_noRetrieveFeatureTask; >+ > // exception > public static String exception_missingElement; > public static String exception_missingFeature; >Index: src/org/eclipse/pde/internal/build/messages.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/messages.properties,v >retrieving revision 1.38 >diff -u -r1.38 messages.properties >--- src/org/eclipse/pde/internal/build/messages.properties 27 Apr 2005 14:46:58 -0000 1.38 >+++ src/org/eclipse/pde/internal/build/messages.properties 2 Jun 2005 05:55:23 -0000 >@@ -29,7 +29,8 @@ > error_configWrongFormat = {0} is not a valid configuration. > error_missingCustomBuildFile = No custom build file found in {0}. > error_missingSourceFolder = In plugin {0}, the value for property {1} is not set. >- >+error_noRetrieveFeatureTask = No fetch task available for element {0}, check your map files. >+ > ### exception > exception_missingElement = Unable to find element: {0}. > exception_missingFeature = Unable to find feature: {0}. >Index: templates/customTargets.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/templates/customTargets.xml,v >retrieving revision 1.3 >diff -u -r1.3 customTargets.xml >--- templates/customTargets.xml 12 May 2005 03:57:40 -0000 1.3 >+++ templates/customTargets.xml 2 Jun 2005 05:55:23 -0000 >@@ -6,8 +6,8 @@ > <!-- ===================================================================== --> > <target name="allElements"> > <ant antfile="${genericTargets}" target="${target}"> >- <property name="type" value="<feature | plugin | fragment>" /> >- <property name="id" value="<element.id>" /> >+ <property name="type" value="'feature | plugin | fragment'" /> >+ <property name="id" value="'element.id'" /> > </ant> > </target> > >@@ -18,7 +18,7 @@ > <!-- Add one target for each root element and each configuration --> > <!-- ===================================================================== --> > >- <target name="assemble.<element.id>[.config.spec]"> >+ <target name="assemble.'element.id[.config.spec]'"> > <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> > </target> > >Index: schema/fetchScriptBuilders.exsd >=================================================================== >RCS file: schema/fetchScriptBuilders.exsd >diff -N schema/fetchScriptBuilders.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/fetchScriptBuilders.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,117 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.pde.build"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.pde.build" id="fetchScriptBuilders" name="Fetch Script Builder"/> >+ </appInfo> >+ <documentation> >+ Provides builders for constructing fetch scripts during the build process. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="builder" minOccurs="1" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="builder"> >+ <annotation> >+ <appInfo> >+ <meta.element labelAttribute="id"/> >+ </appInfo> >+ <documentation> >+ The builder. >+ </documentation> >+ </annotation> >+ <complexType> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The builder id (must be unique). >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The builder implementation (must implement <code>org.eclipse.pde.build.IFetchScriptBuilder</code> and must provide a parameter less, public constructor). >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.pde.build.IFetchScriptBuilder"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+</schema> >Index: src/org/eclipse/pde/build/IFetchScriptBuilder.java >=================================================================== >RCS file: src/org/eclipse/pde/build/IFetchScriptBuilder.java >diff -N src/org/eclipse/pde/build/IFetchScriptBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/build/IFetchScriptBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,183 @@ >+/********************************************************************** >+ * Copyright (c) 2004, 2005 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 >+ * $Id$ >+ * >+ * Contributors: >+ * Gunnar Wagenknecht - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.build; >+ >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.pde.internal.build.ant.ITask; >+ >+/** >+ * A <code>IFetchScriptBuilder</code> constructs a repository specific fetch >+ * script for the PDE build process. >+ * <p> >+ * It is registered via the >+ * <code>org.eclipse.pde.build.fetchScriptBuilder</code> extension point. >+ * </p> >+ */ >+public interface IFetchScriptBuilder { >+ >+ /** element type <code>bundle</code> */ >+ String ELEMENT_TYPE_BUNDLE = "bundle"; //$NON-NLS-1$ >+ >+ /** element type <code>feature</code> */ >+ String ELEMENT_TYPE_FEATURE = "feature"; //$NON-NLS-1$ >+ >+ /** element type <code>fragment</code> */ >+ String ELEMENT_TYPE_FRAGMENT = "fragment"; //$NON-NLS-1$ >+ >+ /** element type <code>plugin</code> */ >+ String ELEMENT_TYPE_PLUGIN = "plugin"; //$NON-NLS-1$ >+ >+ /** >+ * Generates a task that is necessary for authentificate against the >+ * repository. >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)} >+ * @return the authentification task (maybe <code>null</code> if not >+ * necessary) >+ */ >+ ITask generateAuthentificationTask(String element, String type, >+ Map entryInfos); >+ >+ /** >+ * Generates a properties for fetching the specified element via the fetch >+ * task. >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)} >+ * @param destination >+ * the destination where the files should be fetched to >+ * @param xmlFileOnly >+ * if <code>true</code> only the element's XML descriptor >+ * should be fetched, otherwise the complete element must be >+ * fetched >+ * @return the map with properties (must be <code>String</code> keys and >+ * <code>String</code> values) >+ * @throws CoreException >+ */ >+ Map generatePropertiesForFetchTask(String element, String type, >+ Map entryInfos, String destination, boolean xmlFileOnly) >+ throws CoreException; >+ >+ /** >+ * Generates a task for retrieving the specified files only. >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)} >+ * @param destination >+ * the destination where the files should be fetched to >+ * @param files >+ * the list of files to fetch >+ * @return the task for fetching the files >+ */ >+ ITask generateRetrieveFilesTask(String element, String type, >+ Map entryInfos, String destination, String[] files); >+ >+ /** >+ * Returns the common task that is used to fetch elements specified via Ant >+ * properties. >+ * <p> >+ * This task is called from within the element specific generated fetch >+ * tasks to fetch an elements. >+ * </p> >+ * >+ * @return the common fetch task >+ * @see #generatePropertiesForFetchTask(String, String, Map, String, >+ * boolean) >+ */ >+ ITask getFetchTask(); >+ >+ /** >+ * Returns a version identifyer (eg. TAG name) of the element that will be >+ * fetched. >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)} >+ * @return a version identifyer >+ */ >+ String getVersionToFetch(String element, String type, Map entryInfos); >+ >+ /** >+ * Processes the specified element with the specified type. >+ * <p> >+ * The arguments specified in the map file are provided. The map with entry >+ * infos should be filled with provider specific information that is >+ * required in later processing to sucessfully generate the fetch script. >+ * </p> >+ * >+ * @param element >+ * the element name (eg. <code>com.my.plugin</code>) (may not >+ * be <code>null</code>) >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param arguments >+ * the arguments specified in the build script (may not be >+ * <code>null</code>) >+ * @param fetchTag >+ * the fetch tag that will overwrite all tags specified in the >+ * repository if set (maybe <code>null</code> or empty) >+ * @param entryInfos >+ * the map to store repository specific information (may not be >+ * <code>null</code>) >+ * @throws CoreException >+ * if the arguments are invalid >+ */ >+ void processMapFileEntry(String element, String type, String[] arguments, >+ String fetchTag, Map entryInfos) throws CoreException; >+} >Index: src/org/eclipse/pde/internal/build/FetchScriptBuildersRegistry.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/FetchScriptBuildersRegistry.java >diff -N src/org/eclipse/pde/internal/build/FetchScriptBuildersRegistry.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/FetchScriptBuildersRegistry.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,165 @@ >+/********************************************************************** >+ * Copyright (c) 2004, 2005 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 >+ * $Id$ >+ * >+ * Contributors: >+ * Gunnar Wagenknecht - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.internal.build; >+ >+import java.util.Collection; >+import java.util.Collections; >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IRegistryChangeEvent; >+import org.eclipse.core.runtime.IRegistryChangeListener; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.pde.build.IFetchScriptBuilder; >+ >+/** >+ * A registry for acessing fetch script builders. >+ */ >+public class FetchScriptBuildersRegistry implements IRegistryChangeListener { >+ >+ /** the extension point */ >+ private static final String EXT_FETCH_SCRIPT_BUILDERS = "org.eclipse.pde.build.fetchScriptBuilders"; //$NON-NLS-1$ >+ >+ /** attribute <code>id</code> */ >+ private static final String ATTR_ID = "id"; //$NON-NLS-1$ >+ >+ /** attribute <code>class</code> */ >+ private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ >+ >+ /** element <code>builder</code> */ >+ private static final String ELEM_BUILDER = "builder"; //$NON-NLS-1$ >+ >+ /** the shared instance */ >+ private static FetchScriptBuildersRegistry instance; >+ >+ /** >+ * Returns the singleton registry instance. >+ * >+ * @return the registry instance >+ */ >+ public static FetchScriptBuildersRegistry getRegistry() { >+ if (null == instance) { >+ createRegistry(); >+ } >+ return instance; >+ } >+ >+ /** >+ * Creates the singleton registry instance. >+ */ >+ private static synchronized void createRegistry() { >+ >+ if (null != instance) return; >+ >+ instance = new FetchScriptBuildersRegistry(); >+ Platform.getExtensionRegistry().addRegistryChangeListener(instance, >+ "org.eclipse.pde.build"); //$NON-NLS-1$ >+ } >+ >+ /** >+ * Shuts down the registry. >+ */ >+ static void shutdown() { >+ if (null != instance) { >+ Platform.getExtensionRegistry().removeRegistryChangeListener( >+ instance); >+ } >+ } >+ >+ /** a map of registered builders */ >+ private Map builders; >+ >+ /** >+ * Hidden constructor. >+ */ >+ private FetchScriptBuildersRegistry() { >+ // hidden constructor >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent) >+ */ >+ public void registryChanged(IRegistryChangeEvent event) { >+ >+ // reset list of known builders >+ if (null != builders) builders = null; >+ } >+ >+ /** >+ * Returns a collection of registered builder ids. >+ * >+ * @return a collection of registered builder ids >+ */ >+ public Collection getBuilderIds() { >+ >+ // ensure initialized >+ initializeRegistry(); >+ >+ return null != builders ? builders.keySet() : Collections.EMPTY_SET; >+ } >+ >+ /** >+ * Initializes the registry >+ */ >+ private void initializeRegistry() { >+ >+ // don't initialize twice >+ if (null != builders) return; >+ >+ synchronized (builders = new HashMap()) { >+ IConfigurationElement[] extensions = Platform >+ .getExtensionRegistry().getConfigurationElementsFor( >+ EXT_FETCH_SCRIPT_BUILDERS); >+ for (int i = 0; i < extensions.length; i++) { >+ IConfigurationElement extension = extensions[i]; >+ if(ELEM_BUILDER.equals(extension.getName())) { >+ String id = extension.getAttribute(ATTR_ID); >+ if (null != id && id.trim().length() > 0) { >+ builders.put(id, extension); >+ } >+ } >+ } >+ } >+ } >+ >+ /** >+ * Returns the builder instance with the specified id. >+ * <p> >+ * The instance is not cached. Each time this method is called, a new >+ * instance is created. >+ * </p> >+ * >+ * @param id >+ * @return the builder instance (maybe <code>null</code>) >+ */ >+ public IFetchScriptBuilder getBuilder(String id) { >+ >+ // ensure initialized >+ initializeRegistry(); >+ >+ IConfigurationElement extension = (IConfigurationElement) builders >+ .get(id); >+ if (null != extension) { >+ try { >+ return (IFetchScriptBuilder) extension >+ .createExecutableExtension(ATTR_CLASS); >+ } catch (CoreException e) { >+ BundleHelper.getDefault().getLog().log(e.getStatus()); >+ } >+ } >+ return null; >+ } >+} >Index: src/org/eclipse/pde/internal/build/fetch/COPYFetchScriptBuilder.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/fetch/COPYFetchScriptBuilder.java >diff -N src/org/eclipse/pde/internal/build/fetch/COPYFetchScriptBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/fetch/COPYFetchScriptBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,208 @@ >+/********************************************************************** >+ * Copyright (c) 2004, 2005 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 >+ * $Id$ >+ * >+ * Contributors: >+ * Gunnar Wagenknecht - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.internal.build.fetch; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.build.IFetchScriptBuilder; >+import org.eclipse.pde.internal.build.IPDEBuildConstants; >+import org.eclipse.pde.internal.build.Messages; >+import org.eclipse.pde.internal.build.ant.AntScript; >+import org.eclipse.pde.internal.build.ant.FileSet; >+import org.eclipse.pde.internal.build.ant.ITask; >+ >+/** >+ * An <code>IFetchScriptBuilder</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 COPYFetchScriptBuilder implements IFetchScriptBuilder, >+ IPDEBuildConstants { >+ >+ public static final String ID = "COPY"; //$NON-NLS-1$ >+ >+ private static final String PATH = "path"; //$NON-NLS-1$ >+ >+ private static final String ROOT = "root"; //$NON-NLS-1$ >+ >+ private static final ITask GET_FROM_PATH_TASK = new ITask() { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.ant.ITask#print(org.eclipse.pde.internal.build.ant.AntScript) >+ */ >+ public void print(AntScript script) { >+ FileSet dir = new FileSet( >+ "${sourcePath}", null, null, null, null, null, null); //$NON-NLS-1$ >+ script.printCopyTask(null, >+ "${destination}", new FileSet[] { dir }, false, true); //$NON-NLS-1$ >+ } >+ }; >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#generateAuthentificationTask(java.lang.String, >+ * java.lang.String, java.util.Map) >+ */ >+ public ITask generateAuthentificationTask(String element, String type, >+ Map entryInfos) { >+ // not necessary >+ return null; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#generatePropertiesForFetchTask(java.lang.String, >+ * java.lang.String, java.util.Map, java.lang.String, boolean) >+ */ >+ public Map generatePropertiesForFetchTask(String element, String type, >+ Map entryInfos, String destination, boolean xmlFileOnly) { >+ Map params = new HashMap(2); >+ >+ // we directly export the CVS content into the destination >+ params.put("destination", destination); //$NON-NLS-1$ >+ params.put("quiet", "${quiet}"); //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ String root = (String) entryInfos.get(ROOT); >+ String path = (String) entryInfos.get(PATH); >+ IPath sourcePath = new Path(root); >+ if (path != null) { >+ sourcePath = sourcePath.append(path); >+ } else { >+ sourcePath = sourcePath.append(element); >+ } >+ >+ if (xmlFileOnly) { >+ if (type.equals("feature")) { //$NON-NLS-1$ >+ sourcePath.append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); >+ } else if (type.equals("plugin")) { //$NON-NLS-1$ >+ sourcePath.append(DEFAULT_PLUGIN_FILENAME_DESCRIPTOR); >+ } else if (type.equals("fragment")) { //$NON-NLS-1$ >+ sourcePath.append(DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR); >+ } >+ } >+ params.put("sourcePath", sourcePath.toString()); //$NON-NLS-1$ >+ >+ return params; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#generateRetrieveFilesTask(java.lang.String, >+ * java.lang.String, java.util.Map, java.lang.String, >+ * java.lang.String[]) >+ */ >+ public ITask generateRetrieveFilesTask(final String element, >+ final String type, final Map entryInfos, final String destination, >+ final String[] files) { >+ >+ return new ITask() { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.ant.ITask#print(org.eclipse.pde.internal.build.ant.AntScript) >+ */ >+ public void print(AntScript script) { >+ String root = (String) entryInfos.get(ROOT); >+ String path = (String) entryInfos.get(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(element).append(file); >+ } >+ >+ script.printCopyTask(filePath.toString(), destination, >+ null, false, true); >+ } >+ } >+ }; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#getFetchTask() >+ */ >+ public ITask getFetchTask() { >+ return GET_FROM_PATH_TASK; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#getVersionToFetch(java.lang.String, >+ * java.lang.String, java.util.Map) >+ */ >+ public String getVersionToFetch(String element, String type, Map entryInfos) { >+ return (String) entryInfos.get(ROOT); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#processMapFileEntry(java.lang.String, >+ * java.lang.String, java.lang.String[], java.lang.String, >+ * java.util.Map) >+ */ >+ public void processMapFileEntry(String element, String type, >+ String[] arguments, String fetchTag, Map entryInfos) >+ throws CoreException { >+ >+ if (arguments.length < 1) { >+ String message = NLS.bind(Messages.error_incorrectDirectoryEntry, >+ element); //$NON-NLS-1$ >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, >+ EXCEPTION_ENTRY_MISSING, message, null)); >+ } >+ >+ entryInfos >+ .put( >+ ROOT, >+ (null == fetchTag || fetchTag.trim().length() == 0) ? arguments[0] >+ : fetchTag); >+ entryInfos.put(PATH, (arguments.length > 1 && arguments[1].trim() >+ .length() > 0) ? arguments[1] : null); >+ } >+ >+} >Index: src/org/eclipse/pde/internal/build/fetch/CVSFetchScriptBuilder.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/fetch/CVSFetchScriptBuilder.java >diff -N src/org/eclipse/pde/internal/build/fetch/CVSFetchScriptBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/fetch/CVSFetchScriptBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,227 @@ >+/********************************************************************** >+ * Copyright (c) 2000, 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Gunnar Wagenknecht - adaption to new fetch script builder API >+ **********************************************************************/ >+package org.eclipse.pde.internal.build.fetch; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.build.IFetchScriptBuilder; >+import org.eclipse.pde.internal.build.IPDEBuildConstants; >+import org.eclipse.pde.internal.build.Messages; >+import org.eclipse.pde.internal.build.ant.AntScript; >+import org.eclipse.pde.internal.build.ant.ITask; >+ >+/** >+ * An <code>IFetchScriptBuilder</code> for building fetch scripts that will >+ * fetch content from a CVS repository (id: <code>CVS</code>). >+ * <p> >+ * Map file arguments: >+ * <code><TAG>,<CVSROOT>[,<PASSWORD>[,<PATH>[,<CVSPASSFILE>]]]</code> >+ * </p> >+ */ >+public class CVSFetchScriptBuilder implements IFetchScriptBuilder, >+ IPDEBuildConstants { >+ >+ private static final String CVSPASSFILE = "cvsPassFile"; //$NON-NLS-1$ >+ >+ private static final String CVSROOT = "cvsRoot"; //$NON-NLS-1$ >+ >+ private static final ITask GET_FROM_CVS_TASK = new ITask() { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.ant.ITask#print(org.eclipse.pde.internal.build.ant.AntScript) >+ */ >+ public void print(AntScript script) { >+ script >+ .printCVSTask( >+ "export -d ${destination} -r ${tag} ${package}", "${cvsRoot}", null, null, null, "${quiet}", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+ }; >+ >+ public static final String ID = "CVS"; //$NON-NLS-1$ >+ >+ private static final String PASSWORD = "password"; //$NON-NLS-1$ >+ >+ private static final String PATH = "path"; //$NON-NLS-1$ >+ >+ private static final String TAG = "tag"; //$NON-NLS-1$ >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#generateAuthentificationTask(java.lang.String, >+ * java.lang.String, java.util.Map) >+ */ >+ public ITask generateAuthentificationTask(final String element, >+ final String type, final Map entryInfos) { >+ >+ return new ITask() { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.ant.ITask#print(org.eclipse.pde.internal.build.ant.AntScript) >+ */ >+ public void print(AntScript script) { >+ String password = (String) entryInfos.get(PASSWORD); >+ String cvsPassFileLocation = (String) entryInfos >+ .get(CVSPASSFILE); >+ if (password != null) >+ script.printCVSPassTask((String) entryInfos.get(CVSROOT), >+ password, cvsPassFileLocation); >+ } >+ }; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#generatePropertiesForFetchTask(java.lang.String, >+ * java.lang.String, java.util.Map, java.lang.String, boolean) >+ */ >+ public Map generatePropertiesForFetchTask(String element, String type, >+ Map entryInfos, String destination, boolean manifestFileOnly) { >+ Map params = new HashMap(5); >+ >+ // we directly export the CVS content into the destination >+ params.put("destination", destination); //$NON-NLS-1$ >+ params.put(TAG, entryInfos.get(TAG)); >+ params.put(CVSROOT, entryInfos.get(CVSROOT)); >+ params.put("quiet", "${quiet}"); //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ String cvsPackage = ((String) entryInfos.get(PATH) == null ? element >+ : (String) entryInfos.get(PATH)); >+ if (type.equals(ELEMENT_TYPE_FEATURE)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR >+ : ""; //$NON-NLS-1$ >+ } else if (type.equals(ELEMENT_TYPE_PLUGIN)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR >+ : ""; //$NON-NLS-1$ >+ } else if (type.equals(ELEMENT_TYPE_FRAGMENT)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR >+ : ""; //$NON-NLS-1$ >+ } else if (type.equals(ELEMENT_TYPE_BUNDLE)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR >+ : "";//$NON-NLS-1$ >+ } >+ params.put("package", cvsPackage); //$NON-NLS-1$ >+ >+ return params; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#generateRetrieveFilesTask(java.lang.String, >+ * java.lang.String, java.util.Map, java.lang.String, >+ * java.lang.String[]) >+ */ >+ public ITask generateRetrieveFilesTask(final String element, >+ final String type, final Map entryInfos, final String destination, >+ final String[] files) { >+ return new ITask() { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.ant.ITask#print(org.eclipse.pde.internal.build.ant.AntScript) >+ */ >+ public void print(AntScript script) { >+ String cvsRoot = (String) entryInfos.get(CVSROOT); >+ String tag = (String) entryInfos.get(TAG); >+ String path = (String) entryInfos.get(PATH); >+ String password = (String) entryInfos.get(PASSWORD); >+ String cvsPassFileLocation = (String) entryInfos >+ .get(CVSPASSFILE); >+ >+ if (password != null) >+ script.printCVSPassTask(cvsRoot, password, >+ cvsPassFileLocation); >+ >+ for (int i = 0; i < files.length; i++) { >+ String file = files[i]; >+ IPath filePath; >+ if (path != null) { >+ filePath = new Path(path).append(file); >+ } else { >+ filePath = new Path(element).append(file); >+ } >+ >+ script >+ .printCVSTask( >+ "export -d " + destination + " -r " + tag + " " + filePath.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ >+ } >+ } >+ }; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#getFetchTask() >+ */ >+ public ITask getFetchTask() { >+ return GET_FROM_CVS_TASK; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#getVersionToFetch(java.lang.String, >+ * java.lang.String, java.util.Map) >+ */ >+ public String getVersionToFetch(String element, String type, Map entryInfos) { >+ return (String) entryInfos.get(TAG); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.pde.internal.build.IFetchScriptBuilder#processMapFileEntry(java.lang.String, >+ * java.lang.String, java.lang.String[], java.lang.String, >+ * java.util.Map) >+ */ >+ public void processMapFileEntry(String element, String type, >+ String[] arguments, String fetchTag, Map entryInfos) >+ throws CoreException { >+ >+ if (arguments.length < 2) { >+ String message = NLS.bind(Messages.error_incorrectDirectoryEntry, >+ element); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, >+ EXCEPTION_ENTRY_MISSING, message, null)); >+ } >+ >+ entryInfos >+ .put( >+ TAG, >+ (null == fetchTag || fetchTag.trim().length() == 0) ? arguments[0] >+ : fetchTag); >+ entryInfos.put(CVSROOT, arguments[1]); >+ entryInfos.put(PASSWORD, (arguments.length > 2 && !arguments[2] >+ .equals("")) ? arguments[2] : null); //$NON-NLS-1$ >+ entryInfos >+ .put( >+ PATH, >+ (arguments.length > 3 && !arguments[3].equals("")) ? arguments[3] : null); //$NON-NLS-1$ >+ entryInfos.put(CVSPASSFILE, (arguments.length > 4 && !arguments[4] >+ .equals("")) ? arguments[4] : null); //$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