|
Lines 10-22
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.pde.internal.build; |
11 |
package org.eclipse.pde.internal.build; |
| 12 |
|
12 |
|
| 13 |
import java.io.*; |
13 |
import java.io.BufferedInputStream; |
| 14 |
import java.util.*; |
14 |
import java.io.BufferedOutputStream; |
|
|
15 |
import java.io.File; |
| 16 |
import java.io.FileInputStream; |
| 17 |
import java.io.FileOutputStream; |
| 18 |
import java.io.IOException; |
| 19 |
import java.io.InputStream; |
| 20 |
import java.io.OutputStream; |
| 21 |
import java.util.ArrayList; |
| 22 |
import java.util.HashMap; |
| 23 |
import java.util.List; |
| 24 |
import java.util.Map; |
| 25 |
import java.util.Properties; |
| 26 |
|
| 15 |
import org.eclipse.ant.core.AntRunner; |
27 |
import org.eclipse.ant.core.AntRunner; |
| 16 |
import org.eclipse.core.runtime.*; |
28 |
import org.eclipse.core.runtime.CoreException; |
|
|
29 |
import org.eclipse.core.runtime.IPath; |
| 30 |
import org.eclipse.core.runtime.IStatus; |
| 31 |
import org.eclipse.core.runtime.Path; |
| 32 |
import org.eclipse.core.runtime.Status; |
| 17 |
import org.eclipse.osgi.util.NLS; |
33 |
import org.eclipse.osgi.util.NLS; |
|
|
34 |
import org.eclipse.pde.build.FetchScriptBuilder; |
| 18 |
import org.eclipse.pde.internal.build.ant.AntScript; |
35 |
import org.eclipse.pde.internal.build.ant.AntScript; |
| 19 |
import org.eclipse.update.core.*; |
36 |
import org.eclipse.pde.internal.build.ant.ITask; |
|
|
37 |
import org.eclipse.pde.internal.build.fetch.CVSFetchScriptBuilder; |
| 38 |
import org.eclipse.update.core.Feature; |
| 39 |
import org.eclipse.update.core.IFeature; |
| 40 |
import org.eclipse.update.core.IIncludedFeatureReference; |
| 41 |
import org.eclipse.update.core.IPluginEntry; |
| 20 |
import org.eclipse.update.internal.core.FeatureExecutableFactory; |
42 |
import org.eclipse.update.internal.core.FeatureExecutableFactory; |
| 21 |
|
43 |
|
| 22 |
/** |
44 |
/** |
|
Lines 24-39
Link Here
|
| 24 |
* to retrieve plug-ins and features from the CVS repository. |
46 |
* to retrieve plug-ins and features from the CVS repository. |
| 25 |
*/ |
47 |
*/ |
| 26 |
public class FetchScriptGenerator extends AbstractScriptGenerator { |
48 |
public class FetchScriptGenerator extends AbstractScriptGenerator { |
| 27 |
private static final String BUNDLE = "bundle"; //$NON-NLS-1$ |
49 |
private static final String BUNDLE = FetchScriptBuilder.ELEMENT_TYPE_BUNDLE; |
| 28 |
private static final String FRAGMENT = "fragment"; //$NON-NLS-1$ |
50 |
private static final String FRAGMENT = FetchScriptBuilder.ELEMENT_TYPE_FRAGMENT; |
| 29 |
private static final String PLUGIN = "plugin"; //$NON-NLS-1$ |
51 |
private static final String PLUGIN = FetchScriptBuilder.ELEMENT_TYPE_PLUGIN; |
| 30 |
private static final String FEATURE = "feature"; //$NON-NLS-1$ |
52 |
private static final String FEATURE = FetchScriptBuilder.ELEMENT_TYPE_FEATURE; |
| 31 |
private static final String ELEMENT = "element"; //$NON-NLS-1$ |
53 |
private static final String ELEMENT = "element"; //$NON-NLS-1$ |
| 32 |
private static final String TYPE = "type"; //$NON-NLS-1$ |
54 |
private static final String TYPE = "type"; //$NON-NLS-1$ |
| 33 |
private static final String PATH = "path"; //$NON-NLS-1$ |
55 |
private static final String BUILDER = "builder"; //$NON-NLS-1$ |
| 34 |
private static final String PASSWORD = "password"; //$NON-NLS-1$ |
|
|
| 35 |
private static final String CVSROOT = "cvsRoot"; //$NON-NLS-1$ |
| 36 |
private static final String TAG = "tag"; //$NON-NLS-1$ |
| 37 |
|
56 |
|
| 38 |
// flag saying if we want to recursively generate the scripts |
57 |
// flag saying if we want to recursively generate the scripts |
| 39 |
protected boolean recursiveGeneration = true; |
58 |
protected boolean recursiveGeneration = true; |
|
Lines 173-179
Link Here
|
| 173 |
generateFetchPluginsTarget(); |
192 |
generateFetchPluginsTarget(); |
| 174 |
generateFetchRecusivelyTarget(); |
193 |
generateFetchRecusivelyTarget(); |
| 175 |
} |
194 |
} |
| 176 |
generateGetFromCVSTarget(); |
195 |
generateGetFromRepositoryTarget(); |
| 177 |
generateEpilogue(); |
196 |
generateEpilogue(); |
| 178 |
} |
197 |
} |
| 179 |
|
198 |
|
|
Lines 204-210
Link Here
|
| 204 |
|
223 |
|
| 205 |
protected void generateFetchPluginsTarget() throws CoreException { |
224 |
protected void generateFetchPluginsTarget() throws CoreException { |
| 206 |
script.printTargetDeclaration(TARGET_FETCH_PLUGINS, null, FEATURE_AND_PLUGINS, null, null); |
225 |
script.printTargetDeclaration(TARGET_FETCH_PLUGINS, null, FEATURE_AND_PLUGINS, null, null); |
| 207 |
retrieveFeature((String) mapInfos.get(ELEMENT), (String) mapInfos.get(CVSROOT), (String) mapInfos.get(TAG), (String) mapInfos.get(PASSWORD), (String) mapInfos.get(PATH)); |
226 |
retrieveFeature((String) mapInfos.get(ELEMENT), (String) mapInfos.get(TYPE), mapInfos); |
| 208 |
generateChildrenFetchScript(); |
227 |
generateChildrenFetchScript(); |
| 209 |
script.printTargetEnd(); |
228 |
script.printTargetEnd(); |
| 210 |
} |
229 |
} |
|
Lines 219-246
Link Here
|
| 219 |
private Map processMapFileEntry(String entry) throws CoreException { |
238 |
private Map processMapFileEntry(String entry) throws CoreException { |
| 220 |
Map entryInfos = new HashMap(5); |
239 |
Map entryInfos = new HashMap(5); |
| 221 |
|
240 |
|
| 222 |
String cvsInfo = getCVSInfo(entry); |
241 |
// extract type and element from entry |
| 223 |
if (cvsInfo == null) { |
242 |
int index = entry.indexOf('@'); |
|
|
243 |
String type = entry.substring(0, index); |
| 244 |
String currentElement = entry.substring(index + 1); |
| 245 |
|
| 246 |
// read and validate the repository info |
| 247 |
String repositoryInfo = getRepositoryInfo(entry); |
| 248 |
if (repositoryInfo == null) { |
| 224 |
String message = NLS.bind(Messages.error_missingDirectoryEntry, entry); |
249 |
String message = NLS.bind(Messages.error_missingDirectoryEntry, entry); |
| 225 |
BundleHelper.getDefault().getLog().log(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); |
250 |
BundleHelper.getDefault().getLog().log(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); |
| 226 |
return null; |
251 |
return null; |
| 227 |
} |
252 |
} |
| 228 |
|
253 |
|
| 229 |
String[] cvsFields = Utils.getArrayFromStringWithBlank(cvsInfo, ","); //$NON-NLS-1$ |
254 |
// collect and validate the repository info |
| 230 |
if (cvsFields.length < 2) { |
255 |
String[] repositoryFields = Utils.getArrayFromStringWithBlank(repositoryInfo, ","); //$NON-NLS-1$ |
| 231 |
String message = NLS.bind(Messages.error_incorrectDirectoryEntry, element); |
256 |
if (repositoryFields.length < 2) { |
|
|
257 |
String message = NLS.bind(Messages.error_incorrectDirectoryEntry, currentElement); |
| 232 |
throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); |
258 |
throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); |
| 233 |
} |
259 |
} |
| 234 |
|
260 |
|
| 235 |
entryInfos.put(TAG, fetchTag.length() == 0 ? cvsFields[0] : fetchTag); |
261 |
// determine fetch script builder |
| 236 |
entryInfos.put(CVSROOT, cvsFields[1]); |
262 |
FetchScriptBuilder fetchScriptBuilder = null; |
| 237 |
entryInfos.put(PASSWORD, (cvsFields.length > 2 && !cvsFields[2].equals("")) ? cvsFields[2] : null); //$NON-NLS-1$ |
263 |
String[] arguments = null; |
| 238 |
|
264 |
|
| 239 |
entryInfos.put(PATH, (cvsFields.length > 3 && !cvsFields[3].equals("")) ? cvsFields[3] : null); //$NON-NLS-1$ |
265 |
// check if first repository field matches a builder id |
| 240 |
|
266 |
if(FetchScriptBuildersRegistry.getRegistry().getBuilderIds().contains(repositoryFields[0])) |
| 241 |
int index = entry.indexOf('@'); |
267 |
{ |
| 242 |
entryInfos.put(TYPE, entry.substring(0, index)); |
268 |
fetchScriptBuilder = FetchScriptBuildersRegistry.getRegistry().getBuilder(repositoryFields[0]); |
| 243 |
entryInfos.put(ELEMENT, entry.substring(index + 1)); |
269 |
|
|
|
270 |
// construct arguments array for registered builder |
| 271 |
arguments = new String[repositoryFields.length-1]; |
| 272 |
System.arraycopy(repositoryFields, 1, arguments, 0, repositoryFields.length-1); |
| 273 |
} |
| 274 |
|
| 275 |
// default to CVS builder (to be compatible) |
| 276 |
if( null == fetchScriptBuilder) |
| 277 |
{ |
| 278 |
// fall back to CVS |
| 279 |
fetchScriptBuilder = new CVSFetchScriptBuilder(); |
| 280 |
|
| 281 |
// construct arguments array for CVS builder |
| 282 |
arguments = repositoryFields; |
| 283 |
} |
| 284 |
|
| 285 |
// add infos from registered builder |
| 286 |
fetchScriptBuilder.processMapFileEntry(currentElement, type, arguments, fetchTag, entryInfos); |
| 287 |
|
| 288 |
// store builder |
| 289 |
entryInfos.put(BUILDER, fetchScriptBuilder); |
| 290 |
|
| 291 |
// add general infos (will override builder specific infos) |
| 292 |
entryInfos.put(TYPE, type); |
| 293 |
entryInfos.put(ELEMENT, currentElement); |
| 244 |
return entryInfos; |
294 |
return entryInfos; |
| 245 |
} |
295 |
} |
| 246 |
|
296 |
|
|
Lines 257-270
Link Here
|
| 257 |
} |
307 |
} |
| 258 |
continue; |
308 |
continue; |
| 259 |
} |
309 |
} |
| 260 |
|
310 |
|
| 261 |
//Included features can be available in the baseLocation. |
311 |
//Included features can be available in the baseLocation. |
| 262 |
if (getCVSInfo(FEATURE + '@' + featureId) != null) |
312 |
if (getRepositoryInfo(FEATURE + '@' + featureId) != null) |
| 263 |
script.printAntTask(Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + FETCH_FILE_PREFIX + featureId + ".xml", null, TARGET_FETCH, null, null, null); //$NON-NLS-1$ |
313 |
script.printAntTask(Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + FETCH_FILE_PREFIX + featureId + ".xml", null, TARGET_FETCH, null, null, null); //$NON-NLS-1$ |
| 264 |
else if (getSite(false).findFeature(featureId, null, false) == null) { |
314 |
else if (getSite(false).findFeature(featureId, null, false) == null) { |
| 265 |
String message = NLS.bind(Messages.error_cannotFetchNorFindFeature, featureId); |
315 |
String message = NLS.bind(Messages.error_cannotFetchNorFindFeature, featureId); |
| 266 |
throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_FEATURE_MISSING, message, null)); |
316 |
throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_FEATURE_MISSING, message, null)); |
| 267 |
} |
317 |
} |
| 268 |
} |
318 |
} |
| 269 |
script.printTargetEnd(); |
319 |
script.printTargetEnd(); |
| 270 |
} |
320 |
} |
|
Lines 277-333
Link Here
|
| 277 |
return false; |
327 |
return false; |
| 278 |
} |
328 |
} |
| 279 |
|
329 |
|
| 280 |
String password = (String) mapFileEntry.get(PASSWORD); |
330 |
FetchScriptBuilder builder = (FetchScriptBuilder) mapFileEntry.get(BUILDER); |
| 281 |
if (password != null) |
331 |
String elementToFetch = (String) mapFileEntry.get(ELEMENT); |
| 282 |
script.printCVSPassTask((String) mapFileEntry.get(CVSROOT), password, cvsPassFileLocation); |
|
|
| 283 |
|
| 284 |
String type = (String) mapFileEntry.get(TYPE); |
332 |
String type = (String) mapFileEntry.get(TYPE); |
|
|
333 |
|
| 334 |
// print authentification task if one is provided |
| 335 |
ITask authTask = builder.generateAuthentificationTask(elementToFetch,type,mapFileEntry); |
| 336 |
if(null != authTask) script.print(authTask); |
| 337 |
|
| 338 |
// the location |
| 285 |
String location = getElementLocation(type); |
339 |
String location = getElementLocation(type); |
| 286 |
Map params = new HashMap(5); |
|
|
| 287 |
|
340 |
|
| 288 |
//We directly export the CVS content into the correct directory |
341 |
// the destination |
| 289 |
params.put("destination", mapFileEntry.get(ELEMENT)); //$NON-NLS-1$ |
342 |
// we directly export the content into the correct directory |
| 290 |
params.put(TAG, mapFileEntry.get(TAG)); |
343 |
String destination = elementToFetch; |
| 291 |
params.put(CVSROOT, mapFileEntry.get(CVSROOT)); |
344 |
|
| 292 |
params.put("quiet", "${quiet}"); //$NON-NLS-1$ //$NON-NLS-2$ |
345 |
// get params from builder |
|
|
346 |
Map params = new HashMap(builder.generatePropertiesForFetchTask(elementToFetch, type, mapFileEntry, destination, manifestFileOnly)); |
| 293 |
|
347 |
|
| 294 |
String cvsPackage = ((String) mapFileEntry.get(PATH) == null ? (String) mapFileEntry.get(ELEMENT) : (String) mapFileEntry.get(PATH)); |
|
|
| 295 |
String fullLocation = null; |
348 |
String fullLocation = null; |
| 296 |
if (type.equals(FEATURE)) { |
349 |
if (type.equals(FEATURE)) { |
| 297 |
fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR; |
350 |
fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR; |
| 298 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
351 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
| 299 |
cvsPackage += manifestFileOnly ? '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ |
352 |
repositoryFeatureVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); |
| 300 |
repositoryFeatureVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); |
|
|
| 301 |
} else if (type.equals(PLUGIN)) { |
353 |
} else if (type.equals(PLUGIN)) { |
| 302 |
fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; |
354 |
fullLocation = location + '/' + elementToFetch + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; |
| 303 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
355 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
| 304 |
cvsPackage += manifestFileOnly ? '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ |
356 |
repositoryPluginVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); |
| 305 |
repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); |
|
|
| 306 |
} else if (type.equals(FRAGMENT)) { |
357 |
} else if (type.equals(FRAGMENT)) { |
| 307 |
fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; |
358 |
fullLocation = location + '/' + elementToFetch + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; |
| 308 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
359 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
| 309 |
cvsPackage += manifestFileOnly ? '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ |
360 |
repositoryPluginVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); |
| 310 |
repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); |
|
|
| 311 |
} else if (type.equals(BUNDLE)) { |
361 |
} else if (type.equals(BUNDLE)) { |
| 312 |
fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR; |
362 |
fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR; |
| 313 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
363 |
params.put("fileToCheck", fullLocation); //$NON-NLS-1$ |
| 314 |
cvsPackage += manifestFileOnly ? '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR : "";//$NON-NLS-1$ |
364 |
repositoryPluginVersions.put(elementToFetch, builder.getVersionToFetch(elementToFetch,type,mapFileEntry)); |
| 315 |
repositoryPluginVersions.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); |
|
|
| 316 |
} |
365 |
} |
| 317 |
params.put("package", cvsPackage); //$NON-NLS-1$ |
|
|
| 318 |
|
366 |
|
| 319 |
// This call create a new property for every feature, plugins or fragments that we must check the existence of |
367 |
// This call create a new property for every feature, plugins or fragments that we must check the existence of |
| 320 |
script.printAvailableTask(fullLocation, fullLocation); |
368 |
script.printAvailableTask(fullLocation, fullLocation); |
| 321 |
if (type.equals(PLUGIN) || type.equals(FRAGMENT)) { |
369 |
if (type.equals(PLUGIN) || type.equals(FRAGMENT)) { |
| 322 |
script.printAvailableTask(fullLocation, location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR); |
370 |
script.printAvailableTask(fullLocation, location + '/' + elementToFetch + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR); |
| 323 |
} |
371 |
} |
| 324 |
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$ |
372 |
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$ |
| 325 |
return true; |
373 |
return true; |
| 326 |
} |
374 |
} |
| 327 |
|
375 |
|
| 328 |
protected void generateGetFromCVSTarget() { |
376 |
protected void generateGetFromRepositoryTarget() { |
| 329 |
script.printTargetDeclaration(TARGET_GET_FROM_CVS, null, null, "${fileToCheck}", "{destination}"); //$NON-NLS-1$ //$NON-NLS-2$ |
377 |
script.printTargetDeclaration(TARGET_FETCH_FROM_REPOSITORY, null, null, "${fileToCheck}", null); //$NON-NLS-1$ |
| 330 |
script.printCVSTask("export -d ${destination} -r ${tag} ${package}", "${cvsRoot}", null, null, null, "${quiet}", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
378 |
if(null != mapInfos) { |
|
|
379 |
FetchScriptBuilder builder = (FetchScriptBuilder) mapInfos.get(BUILDER); |
| 380 |
if(null != builder) { |
| 381 |
ITask getTask = builder.getFetchTask(); |
| 382 |
if(null != getTask) { |
| 383 |
script.print(getTask); |
| 384 |
} |
| 385 |
} |
| 386 |
} |
| 331 |
script.printTargetEnd(); |
387 |
script.printTargetEnd(); |
| 332 |
} |
388 |
} |
| 333 |
|
389 |
|
|
Lines 379-390
Link Here
|
| 379 |
* constructor from Update. |
435 |
* constructor from Update. |
| 380 |
* |
436 |
* |
| 381 |
* @param elementName the feature to retrieve |
437 |
* @param elementName the feature to retrieve |
| 382 |
* @param cvsRoot the root in CVS |
438 |
* @param elementType the element type |
| 383 |
* @param tag the CVS tag |
439 |
* @param elementInfos the element information |
| 384 |
* @param password the CVS password |
|
|
| 385 |
* @throws CoreException |
440 |
* @throws CoreException |
| 386 |
*/ |
441 |
*/ |
| 387 |
protected void retrieveFeature(String elementName, String cvsRoot, String tag, String password, String path) throws CoreException { |
442 |
protected void retrieveFeature(String elementName, String elementType, Map elementInfos) throws CoreException { |
| 388 |
// Generate a temporary Ant script which retrieves the feature.xml for this |
443 |
// Generate a temporary Ant script which retrieves the feature.xml for this |
| 389 |
// feature from CVS |
444 |
// feature from CVS |
| 390 |
File root = new File(workingDirectory); |
445 |
File root = new File(workingDirectory); |
|
Lines 395-415
Link Here
|
| 395 |
retrieve.printProjectDeclaration("RetrieveFeature", "main", "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
450 |
retrieve.printProjectDeclaration("RetrieveFeature", "main", "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 396 |
retrieve.printTargetDeclaration(TARGET_MAIN, null, null, null, null); |
451 |
retrieve.printTargetDeclaration(TARGET_MAIN, null, null, null, null); |
| 397 |
|
452 |
|
| 398 |
IPath moduleFeatureFile; |
453 |
String destination = elementName; |
| 399 |
IPath moduleFeatureProperties; |
454 |
String[] files = new String[] {DEFAULT_FEATURE_FILENAME_DESCRIPTOR, PROPERTIES_FILE}; |
| 400 |
if (path != null) { |
455 |
FetchScriptBuilder builder = (FetchScriptBuilder) elementInfos.get(BUILDER); |
| 401 |
moduleFeatureFile = new Path(path).append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); |
456 |
ITask retrieveFeatureTask = builder.generateRetrieveFilesTask(elementName, elementType, elementInfos, destination, files); |
| 402 |
moduleFeatureProperties = new Path(path).append(PROPERTIES_FILE); |
457 |
if(null == retrieveFeatureTask) { |
| 403 |
} else { |
458 |
String message = NLS.bind(Messages.error_noRetrieveFeatureTask, elementName); |
| 404 |
moduleFeatureFile = new Path(elementName).append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); |
459 |
throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); |
| 405 |
moduleFeatureProperties = new Path(elementName).append(PROPERTIES_FILE); |
|
|
| 406 |
} |
460 |
} |
| 407 |
|
461 |
retrieve.print(retrieveFeatureTask); |
| 408 |
if (password != null) |
|
|
| 409 |
retrieve.printCVSPassTask(cvsRoot, password, cvsPassFileLocation); |
| 410 |
|
| 411 |
retrieve.printCVSTask("export -r " + tag + " " + moduleFeatureFile.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ |
| 412 |
retrieve.printCVSTask("export -r " + tag + " " + moduleFeatureProperties.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ |
| 413 |
|
462 |
|
| 414 |
retrieve.printTargetEnd(); |
463 |
retrieve.printTargetEnd(); |
| 415 |
retrieve.printProjectEnd(); |
464 |
retrieve.printProjectEnd(); |
|
Lines 427-440
Link Here
|
| 427 |
AntRunner runner = new AntRunner(); |
476 |
AntRunner runner = new AntRunner(); |
| 428 |
runner.setBuildFileLocation(target.getAbsolutePath()); |
477 |
runner.setBuildFileLocation(target.getAbsolutePath()); |
| 429 |
runner.run(); |
478 |
runner.run(); |
|
|
479 |
String destination = elementName; |
| 430 |
FeatureExecutableFactory factory = new FeatureExecutableFactory(); |
480 |
FeatureExecutableFactory factory = new FeatureExecutableFactory(); |
| 431 |
File featureFolder = new File(root, (path == null ? elementName : path)); |
481 |
File featureFolder = new File(root, destination); |
| 432 |
feature = factory.createFeature(featureFolder.toURL(), null, null); |
482 |
feature = factory.createFeature(featureFolder.toURL(), null, null); |
| 433 |
|
483 |
|
| 434 |
//We only delete here, so if an exception is thrown the user can still see the retrieve.xml |
484 |
//We only delete here, so if an exception is thrown the user can still see the retrieve.xml |
| 435 |
target.delete(); |
485 |
target.delete(); |
| 436 |
featureProperties = new Properties(); |
486 |
featureProperties = new Properties(); |
| 437 |
InputStream featureStream = new FileInputStream(new File(root, (path == null ? elementName : path) + '/' + PROPERTIES_FILE)); |
487 |
InputStream featureStream = new FileInputStream(new File(root, destination + '/' + PROPERTIES_FILE)); |
| 438 |
featureProperties.load(featureStream); |
488 |
featureProperties.load(featureStream); |
| 439 |
featureStream.close(); |
489 |
featureStream.close(); |
| 440 |
clear(featureFolder); |
490 |
clear(featureFolder); |
|
Lines 498-504
Link Here
|
| 498 |
* @return String |
548 |
* @return String |
| 499 |
* @throws CoreException |
549 |
* @throws CoreException |
| 500 |
*/ |
550 |
*/ |
| 501 |
protected String getCVSInfo(String elementName) throws CoreException { |
551 |
protected String getRepositoryInfo(String elementName) throws CoreException { |
| 502 |
if (directory == null) |
552 |
if (directory == null) |
| 503 |
directory = readProperties(directoryLocation, "", IStatus.ERROR); //$NON-NLS-1$ |
553 |
directory = readProperties(directoryLocation, "", IStatus.ERROR); //$NON-NLS-1$ |
| 504 |
return directory.getProperty(elementName); |
554 |
return directory.getProperty(elementName); |