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 12626 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 to add support for pluggable fetch script bulder
org.eclipse.pde.build-patch.txt (text/plain), 54.41 KB, created by
Gunnar Wagenknecht
on 2004-06-22 03:07:58 EDT
(
hide
)
Description:
Patch to add support for pluggable fetch script bulder
Filename:
MIME Type:
Creator:
Gunnar Wagenknecht
Created:
2004-06-22 03:07:58 EDT
Size:
54.41 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 22 Jun 2004 06:58:39 -0000 >@@ -1,2 +1,5 @@ > bin >-lib >\ No newline at end of file >+lib >+temp* >+build.xml >+pdebuild.jar >Index: plugin.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/plugin.properties,v >retrieving revision 1.11 >diff -u -r1.11 plugin.properties >--- plugin.properties 7 Jul 2003 16:02:24 -0000 1.11 >+++ plugin.properties 22 Jun 2004 06:58:39 -0000 >@@ -1,2 +1,5 @@ > pluginName = Plug-in Development Environment Build Support > providerName = Eclipse.org >+ >+ >+fetchScriptBuilder.name = Fetch Script Builder >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/plugin.xml,v >retrieving revision 1.48 >diff -u -r1.48 plugin.xml >--- plugin.xml 3 Jun 2004 13:40:08 -0000 1.48 >+++ plugin.xml 22 Jun 2004 06:58:39 -0000 >@@ -1,6 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> > <plugin> >+ <extension-point id="fetchScriptBuilder" name="%fetchScriptBuilder.name" schema="schema/fetchScriptBuilder.exsd"/> > <!-- Tasks --> > <extension > point="org.eclipse.ant.core.antTasks"> >@@ -84,6 +85,15 @@ > <feature-factory > class="org.eclipse.pde.internal.build.site.BuildTimeFeatureFactory"> > </feature-factory> >+ </extension> >+ <extension >+ point="org.eclipse.pde.build.fetchScriptBuilder"> >+ <builder >+ class="org.eclipse.pde.internal.build.PATHFetchScriptBuilder" >+ id="PATH"/> >+ <builder >+ class="org.eclipse.pde.internal.build.CVSFetchScriptBuilder" >+ id="CVS"/> > </extension> > > </plugin> >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.3 >diff -u -r1.3 BuildActivator.java >--- src/org/eclipse/pde/internal/build/BuildActivator.java 17 Apr 2004 13:34:11 -0000 1.3 >+++ src/org/eclipse/pde/internal/build/BuildActivator.java 22 Jun 2004 06:58:39 -0000 >@@ -20,5 +20,6 @@ > > public void stop(BundleContext ctx) throws Exception { > BundleHelper.close(); >+ FetchScriptBuilderRegistry.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.33 >diff -u -r1.33 FetchScriptGenerator.java >--- src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 26 May 2004 19:10:34 -0000 1.33 >+++ src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 22 Jun 2004 06:58:39 -0000 >@@ -10,12 +10,32 @@ > **********************************************************************/ > 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.pde.internal.build.ant.AntScript; >-import org.eclipse.update.core.*; >+import org.eclipse.pde.internal.build.ant.ITask; >+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; > > /** >@@ -25,10 +45,7 @@ > public class FetchScriptGenerator extends AbstractScriptGenerator { > 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; >@@ -37,9 +54,6 @@ > protected String directoryLocation; > protected static Properties directory; //TODO Should be passed around > >- // The location of the CVS password file. >- protected String cvsPassFileLocation; >- > protected boolean fetchChildren = true; > > protected String fetchTag = ""; //$NON-NLS-1$ >@@ -145,7 +159,6 @@ > FetchScriptGenerator generator = new FetchScriptGenerator("feature@" + featureId); //$NON-NLS-1$ > generator.setDirectoryLocation(directoryLocation); > generator.setFetchChildren(fetchChildren); >- generator.setCvsPassFileLocation(cvsPassFileLocation); > generator.setRecursiveGeneration(recursiveGeneration); > generator.setFetchTag(fetchTag); > generator.repositoryPluginVersions = repositoryPluginVersions; >@@ -197,7 +210,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(); > } >@@ -212,32 +225,63 @@ > 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 element = entry.substring(index + 1); >+ >+ // read and validate the repository info >+ String repositoryInfo = getRepositoryInfo(entry); >+ if (repositoryInfo == null) { > String message = Policy.bind("error.missingDirectoryEntry", entry); //$NON-NLS-1$ > 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) { >+ // collect and validate the repository info >+ String[] repositoryFields = Utils.getArrayFromStringWithBlank(repositoryInfo, ","); //$NON-NLS-1$ >+ if (repositoryFields.length < 2) { > String message = Policy.bind("error.incorrectDirectoryEntry", element); //$NON-NLS-1$ > 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(FetchScriptBuilderRegistry.getRegistry().getBuilderIds().contains(repositoryFields[0])) >+ { >+ fetchScriptBuilder = FetchScriptBuilderRegistry.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); >+ } >+ >+ // check builder not nuöl >+ 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(element, type, arguments, fetchTag, entryInfos); >+ >+ // store builde >+ entryInfos.put(BUILDER, fetchScriptBuilder); >+ >+ // add general infos (will override builder specific infos) >+ entryInfos.put(TYPE, type); >+ entryInfos.put(ELEMENT, element); > return entryInfos; > } > >- protected void generateFetchRecusivelyTarget() throws CoreException { >+ protected void generateFetchRecusivelyTarget() throws CoreException { > script.printTargetDeclaration(TARGET_FETCH_RECURSIVELY, null, FEATURES_RECURSIVELY, null, null); > > IIncludedFeatureReference[] compiledFeatures = ((Feature) feature).getFeatureIncluded(); >@@ -264,49 +308,56 @@ > return; > } > >- String password = (String) mapFileEntry.get(PASSWORD); >- if (password != null) >- script.printCVSPassTask((String) mapFileEntry.get(CVSROOT), password, cvsPassFileLocation); //$NON-NLS-1$ >- >- String type = (String) mapFileEntry.get(TYPE); >+ IFetchScriptBuilder builder = (IFetchScriptBuilder) mapFileEntry.get(BUILDER); >+ String element = (String) mapFileEntry.get(ELEMENT); >+ String type = (String) mapFileEntry.get(TYPE); >+ >+ // print authentification task if one is provided >+ ITask authTask = builder.generateAuthentificationTask(element,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 = element; >+ >+ // get params from builder >+ Map params = new HashMap(builder.generatePropertiesForFetchTask(element, type, mapFileEntry, destination, xmlFileOnly)); > >- 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")) { //$NON-NLS-1$ >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ fullLocation = location + '/' + element + '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += xmlFileOnly ? '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ //$NON-NLS-2$ >- repositoryFeatureVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryFeatureVersions.put(element, builder.getVersionToFetch(element,type,mapFileEntry)); > } else if (type.equals("plugin")) { //$NON-NLS-1$ >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ fullLocation = location + '/' + element + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += xmlFileOnly ? '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ //$NON-NLS-2$ >- repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginVersions.put(element, builder.getVersionToFetch(element,type,mapFileEntry)); > } else if (type.equals("fragment")) { //$NON-NLS-1$ >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ fullLocation = location + '/' + element + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += xmlFileOnly ? '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ //$NON-NLS-2$ >- repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginVersions.put(element, builder.getVersionToFetch(element,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); >- script.printAntTask("../" + scriptName, 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, 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$ > > } > > protected void generateGetFromCVSTarget() { >- script.printTargetDeclaration(TARGET_GET_FROM_CVS, null, null, "${fileToCheck}", null); //$NON-NLS-1$ >- script.printCVSTask("export -d ${destination} -r ${tag} ${package}", "${cvsRoot}", null, null, null, "${quiet}", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ 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(); > } > >@@ -360,7 +411,7 @@ > * @param password the CVS password > * @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); >@@ -371,22 +422,16 @@ > 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); >- } >- >- 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$ >- >+ 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 = Policy.bind("error.noRetrieveFeatureTask", elementName); //$NON-NLS-1$ >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); >+ } >+ retrieve.print(retrieveFeatureTask); >+ > retrieve.printTargetEnd(); > retrieve.printProjectEnd(); > } finally { >@@ -403,14 +448,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); >@@ -474,7 +520,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); >@@ -526,15 +572,6 @@ > */ > public void setFetchTag(String value) { > fetchTag = value; >- } >- >- /** >- * Sets the CVS password file location to be the given value. >- * >- * @param cvsPassFileLocation the CVS password file location >- */ >- public void setCvsPassFileLocation(String cvsPassFileLocation) { >- this.cvsPassFileLocation = cvsPassFileLocation; > } > > public void setRecursiveGeneration(boolean recursiveGeneration) { >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.50 >diff -u -r1.50 IXMLConstants.java >--- src/org/eclipse/pde/internal/build/IXMLConstants.java 7 Jun 2004 21:42:59 -0000 1.50 >+++ src/org/eclipse/pde/internal/build/IXMLConstants.java 22 Jun 2004 06:58:39 -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_ant/org/eclipse/pde/internal/build/tasks/FetchTask.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/tasks/FetchTask.java,v >retrieving revision 1.15 >diff -u -r1.15 FetchTask.java >--- src_ant/org/eclipse/pde/internal/build/tasks/FetchTask.java 17 Apr 2004 13:59:19 -0000 1.15 >+++ src_ant/org/eclipse/pde/internal/build/tasks/FetchTask.java 22 Jun 2004 06:58:39 -0000 >@@ -45,15 +45,6 @@ > } > > /** >- * Set the location for the CVS password file. >- * >- * @param cvsPassFileLocation the location of the password file >- */ >- public void setCvsPassFile(String cvsPassFileLocation) { >- generator.setCvsPassFileLocation(cvsPassFileLocation); >- } >- >- /** > * > * @param directoryLocation > */ >Index: schema/fetchScriptBuilder.exsd >=================================================================== >RCS file: schema/fetchScriptBuilder.exsd >diff -N schema/fetchScriptBuilder.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/fetchScriptBuilder.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="fetchScriptBuilder" 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.internal.build.IFetchScriptBuilder</code> and must provide a parameter less, public constructor). >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.pde.internal.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/internal/build/CVSFetchScriptBuilder.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/CVSFetchScriptBuilder.java >diff -N src/org/eclipse/pde/internal/build/CVSFetchScriptBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/CVSFetchScriptBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,217 @@ >+/********************************************************************** >+ * 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 builder API >+ **********************************************************************/ >+package org.eclipse.pde.internal.build; >+ >+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.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 xmlFileOnly) >+ throws CoreException { >+ 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("feature")) { //$NON-NLS-1$ >+ cvsPackage += xmlFileOnly ? '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR >+ : ""; //$NON-NLS-1$ //$NON-NLS-2$ >+ } else if (type.equals("plugin")) { //$NON-NLS-1$ >+ cvsPackage += xmlFileOnly ? '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR >+ : ""; //$NON-NLS-1$ //$NON-NLS-2$ >+ } else if (type.equals("fragment")) { //$NON-NLS-1$ >+ cvsPackage += xmlFileOnly ? '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR >+ : ""; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ 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 = Policy.bind( >+ "error.incorrectDirectoryEntry", element); //$NON-NLS-1$ >+ 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$ >+ } >+} >Index: src/org/eclipse/pde/internal/build/FetchScriptBuilderRegistry.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/FetchScriptBuilderRegistry.java >diff -N src/org/eclipse/pde/internal/build/FetchScriptBuilderRegistry.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/FetchScriptBuilderRegistry.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,163 @@ >+/********************************************************************** >+ * 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: >+ * 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; >+ >+/** >+ * A registry for acessing fetch script builders. >+ */ >+public class FetchScriptBuilderRegistry implements IRegistryChangeListener { >+ >+ /** the extension point */ >+ public static final String EXT_FETCH_SCRIPT_BUILDER = "org.eclipse.pde.build.fetchScriptBuilder"; //$NON-NLS-1$ >+ >+ /** attribute <code>id</code> */ >+ public static final String ATTR_ID = "id"; //$NON-NLS-1$ >+ >+ /** attribute <code>class</code> */ >+ public static final String ATTR_CLASS = "class"; //$NON-NLS-1$ >+ >+ /** element <code>builder</code> */ >+ public static final String ELEM_BUILDER = "builder"; //$NON-NLS-1$ >+ >+ /** the shared instance */ >+ private static FetchScriptBuilderRegistry instance; >+ >+ /** >+ * Returns the singleton registry instance. >+ * >+ * @return the registry instance >+ */ >+ public static FetchScriptBuilderRegistry getRegistry() { >+ if (null == instance) { >+ createRegistry(); >+ } >+ return instance; >+ } >+ >+ /** >+ * Creates the singleton registry instance. >+ */ >+ private static synchronized void createRegistry() { >+ >+ if (null != instance) return; >+ >+ instance = new FetchScriptBuilderRegistry(); >+ 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 FetchScriptBuilderRegistry() { >+ // 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_BUILDER); >+ 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/IFetchScriptBuilder.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/IFetchScriptBuilder.java >diff -N src/org/eclipse/pde/internal/build/IFetchScriptBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/IFetchScriptBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,150 @@ >+/********************************************************************** >+ * 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: >+ * Gunnar Wagenknecht - initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.internal.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. >+ * >+ * <p> >+ * It is registered via the >+ * <code>org.eclipse.pde.build.fetchScriptBuilder</code> extension point. >+ * </p> >+ * <p> >+ * <strong>EXPERIMENTAL</strong> This API is subject to change. >+ * </p> >+ */ >+public interface IFetchScriptBuilder { >+ >+ /** >+ * Generates a task that is necessary for authentificate against the >+ * repository. >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type >+ * @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 >+ * @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 >+ * @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, 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 >+ * @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 <code>feature</code>, >+ * <code>plugin</code> or <code>fragment</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/PATHFetchScriptBuilder.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/PATHFetchScriptBuilder.java >diff -N src/org/eclipse/pde/internal/build/PATHFetchScriptBuilder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/PATHFetchScriptBuilder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,203 @@ >+/********************************************************************** >+ * 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: >+ * Gunnar Wagenknecht - initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.internal.build; >+ >+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.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 from >+ * a specific path (id: <code>PATH</code>). >+ * <p> >+ * Map file arguments: <code><ROOT>[,<PATH>]</code> >+ * <dl> >+ * <dt>ROOT</dt> >+ * <dd>The ROOT (eg. <code>/source/eclipse</code>) is used as root path to >+ * determine the location and the specific version to fetch. It can be >+ * overwritten via the <code>fetchTag</code> to fetch another version from >+ * another location (for nightly builds for example).</dd> >+ * </dl> >+ * <dt>PATH</dt> >+ * <dd>A custom path withing the ROOT (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 PATHFetchScriptBuilder implements IFetchScriptBuilder, >+ IPDEBuildConstants { >+ >+ public static final String ID = "PATH"; //$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); //$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) >+ throws CoreException { >+ 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); >+ } >+ } >+ }; >+ } >+ >+ /* >+ * (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 = Policy.bind( >+ "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); >+ } >+ >+}
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