Lines 37-42
Link Here
|
37 |
protected Properties featuresPostProcessingSteps; |
37 |
protected Properties featuresPostProcessingSteps; |
38 |
protected ArrayList addedByPermissions = new ArrayList(); //contains the list of files and folders that have been added to an archive by permission management |
38 |
protected ArrayList addedByPermissions = new ArrayList(); //contains the list of files and folders that have been added to an archive by permission management |
39 |
|
39 |
|
|
|
40 |
private static final int MAX_ZIP_EXEC_COMMAND_PARAMETERS = 15; |
41 |
|
40 |
private static final String PROPERTY_SOURCE = "source"; //$NON-NLS-1$ |
42 |
private static final String PROPERTY_SOURCE = "source"; //$NON-NLS-1$ |
41 |
private static final String PROPERTY_ELEMENT_NAME = "elementName"; //$NON-NLS-1$ |
43 |
private static final String PROPERTY_ELEMENT_NAME = "elementName"; //$NON-NLS-1$ |
42 |
|
44 |
|
Lines 131-138
Link Here
|
131 |
if (embeddedSource) |
133 |
if (embeddedSource) |
132 |
generateGatherSourceCalls(); |
134 |
generateGatherSourceCalls(); |
133 |
generatePostProcessingSteps(); |
135 |
generatePostProcessingSteps(); |
134 |
generateBrandingCalls(); |
136 |
generateBrandingCalls(); // BAE: TODO: PACKAGE ONLY??? |
135 |
generateArchivingSteps(); |
137 |
generateArchivingSteps(); // BAE: TODO: PACKAGE ONLY??? |
136 |
generateEpilogue(); |
138 |
generateEpilogue(); |
137 |
} |
139 |
} |
138 |
|
140 |
|
Lines 466-521
Link Here
|
466 |
} |
468 |
} |
467 |
|
469 |
|
468 |
private void generateZipTarget() { |
470 |
private void generateZipTarget() { |
469 |
final int parameterSize = 15; |
471 |
List parameters = new ArrayList(plugins.length + features.length + 1); |
470 |
List parameters = new ArrayList(parameterSize + 1); |
472 |
for (int i = 0; i < plugins.length; i++) { |
471 |
for (int i = 0; i < plugins.length; i++) { |
473 |
parameters.add(Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(plugins[i])[0]); |
472 |
parameters.add(Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(plugins[i])[0]); |
474 |
} |
473 |
if (i % parameterSize == 0) { |
475 |
for (int i = 0; i < features.length; i++) { |
474 |
createZipExecCommand(parameters); |
476 |
parameters.add(Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(features[i])[0]); |
475 |
parameters.clear(); |
477 |
} |
476 |
} |
478 |
createZipExecCommand(Utils.getPropertyFormat(PROPERTY_ASSEMBLY_TMP), parameters); |
477 |
} |
479 |
|
478 |
if (!parameters.isEmpty()) { |
480 |
if (!rootFileProviders.isEmpty()) { |
479 |
createZipExecCommand(parameters); |
481 |
parameters.clear(); |
480 |
parameters.clear(); |
482 |
parameters.add("."); //$NON-NLS-1$ |
481 |
} |
483 |
createZipExecCommand(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING), parameters); //$NON-NLS-1$ |
482 |
|
484 |
} |
483 |
if (!parameters.isEmpty()) { |
485 |
} |
484 |
createZipExecCommand(parameters); |
486 |
|
485 |
parameters.clear(); |
487 |
/** |
486 |
} |
488 |
* Create a zip command for the specified parameters. This will chunk the zip |
487 |
|
489 |
* command into a command of no more that MAX_ZIP_EXEC_COMMAND_PARAMETERS. |
488 |
for (int i = 0; i < features.length; i++) { |
490 |
* |
489 |
parameters.add(Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(features[i])[0]); |
491 |
* @param dir |
490 |
if (i % parameterSize == 0) { |
492 |
* the root directory to zip from. |
491 |
createZipExecCommand(parameters); |
493 |
* @param lineArgs |
492 |
parameters.clear(); |
494 |
* the list of parameters to the zip command. |
493 |
} |
495 |
*/ |
494 |
} |
496 |
private void createZipExecCommand(String dir, List lineArgs) { |
495 |
if (!parameters.isEmpty()) { |
497 |
String zipArguments = "-r -q " + Utils.getPropertyFormat(PROPERTY_ZIP_ARGS) + " '" + Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH) + '\''; //$NON-NLS-1$ //$NON-NLS-2$ |
496 |
createZipExecCommand(parameters); |
498 |
List zipLineArgs = new ArrayList(MAX_ZIP_EXEC_COMMAND_PARAMETERS + 1); |
497 |
parameters.clear(); |
499 |
for (Iterator iter = lineArgs.iterator(); iter.hasNext();) { |
498 |
} |
500 |
zipLineArgs.add(iter.next()); |
499 |
|
501 |
if (zipLineArgs.size() == MAX_ZIP_EXEC_COMMAND_PARAMETERS) { |
500 |
createZipRootFileCommand(); |
502 |
zipLineArgs.add(0, zipArguments); |
501 |
} |
503 |
script.printExecTask("zip", dir, zipLineArgs, null); //$NON-NLS-1$ |
502 |
|
504 |
zipLineArgs.clear(); |
503 |
/** |
505 |
} |
504 |
* Zip the root files |
506 |
} |
505 |
*/ |
507 |
if (!zipLineArgs.isEmpty()) { |
506 |
private void createZipRootFileCommand() { |
508 |
zipLineArgs.add(0, zipArguments); |
507 |
if (rootFileProviders.size() == 0) |
509 |
script.printExecTask("zip", dir, zipLineArgs, null); //$NON-NLS-1$ |
508 |
return; |
510 |
} |
509 |
|
511 |
} |
510 |
List parameters = new ArrayList(1); |
|
|
511 |
parameters.add("-r -q ${zipargs} '" + Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH) + "' . "); //$NON-NLS-1$ //$NON-NLS-2$ |
512 |
script.printExecTask("zip", Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING), parameters, null); //$NON-NLS-1$ //$NON-NLS-2$ |
513 |
} |
514 |
|
515 |
private void createZipExecCommand(List parameters) { |
516 |
parameters.add(0, "-r -q " + Utils.getPropertyFormat(PROPERTY_ZIP_ARGS) + " '" + Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH) + '\''); //$NON-NLS-1$ //$NON-NLS-2$ |
517 |
script.printExecTask("zip", Utils.getPropertyFormat(PROPERTY_ASSEMBLY_TMP), parameters, null); //$NON-NLS-1$ |
518 |
} |
519 |
|
512 |
|
520 |
protected String computeArchiveName() { |
513 |
protected String computeArchiveName() { |
521 |
String extension = (FORMAT_TAR.equalsIgnoreCase(archiveFormat) || FORMAT_ANTTAR.equalsIgnoreCase(archiveFormat)) ? ".tar.gz" : ".zip"; //$NON-NLS-1$ //$NON-NLS-2$ |
514 |
String extension = (FORMAT_TAR.equalsIgnoreCase(archiveFormat) || FORMAT_ANTTAR.equalsIgnoreCase(archiveFormat)) ? ".tar.gz" : ".zip"; //$NON-NLS-1$ //$NON-NLS-2$ |
Lines 547-592
Link Here
|
547 |
script.printExecTask("rm", null, args, null); //$NON-NLS-1$ |
540 |
script.printExecTask("rm", null, args, null); //$NON-NLS-1$ |
548 |
} |
541 |
} |
549 |
|
542 |
|
550 |
//TODO this code andn the generateAntTarTarget() should be refactored using a factory or something like that. |
543 |
// TODO this code andn the generateAntTarTarget() should be refactored using a |
551 |
protected void generateAntZipTarget() { |
544 |
// factory or something like that. |
552 |
FileSet[] filesPlugins = new FileSet[plugins.length]; |
545 |
protected void generateAntZipTarget() { |
553 |
for (int i = 0; i < plugins.length; i++) { |
546 |
List fileSets = new ArrayList(); |
554 |
Object[] shape = getFinalShape(plugins[i]); |
547 |
FileSet[] pluginsFileSets = getPluginsFileSets(); |
555 |
filesPlugins[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null); |
548 |
if (pluginsFileSets.length != 0) { |
556 |
} |
549 |
fileSets.addAll(Arrays.asList(pluginsFileSets)); |
557 |
if (plugins.length != 0) |
550 |
} |
558 |
script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesPlugins); |
551 |
FileSet[] featuresFileSets = getFeaturesFileSets(); |
559 |
|
552 |
if (featuresFileSets.length != 0) { |
560 |
FileSet[] filesFeatures = new FileSet[features.length]; |
553 |
fileSets.addAll(Arrays.asList(featuresFileSets)); |
561 |
for (int i = 0; i < features.length; i++) { |
554 |
} |
562 |
Object[] shape = getFinalShape(features[i]); |
555 |
if (!rootFileProviders.isEmpty()) { |
563 |
filesFeatures[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null); |
556 |
if (groupConfigs) { |
564 |
} |
557 |
List allConfigs = getConfigInfos(); |
565 |
if (features.length != 0) |
558 |
for (Iterator iter = allConfigs.iterator(); iter.hasNext();) { |
566 |
script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesFeatures); |
559 |
Config elt = (Config) iter.next(); |
567 |
|
560 |
fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + elt.toStringReplacingAny(".", ANY_STRING), false, null, "**/**", null, null, null, elt.toStringReplacingAny(".", ANY_STRING), null, null)); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ |
568 |
if (rootFileProviders.size() == 0) |
561 |
} |
569 |
return; |
562 |
} else { |
570 |
|
563 |
FileSet[] permissionSets = generatePermissions(true); |
571 |
if (groupConfigs) { |
564 |
String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$ |
572 |
List allConfigs = getConfigInfos(); |
565 |
fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING) + '/' + Utils.getPropertyFormat(PROPERTY_COLLECTING_FOLDER), false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$//$NON-NLS-2$ |
573 |
FileSet[] rootFiles = new FileSet[allConfigs.size()]; |
566 |
if (permissionSets.length != 0) { |
574 |
int i = 0; |
567 |
fileSets.addAll(Arrays.asList(permissionSets)); |
575 |
for (Iterator iter = allConfigs.iterator(); iter.hasNext();) { |
568 |
} |
576 |
Config elt = (Config) iter.next(); |
569 |
} |
577 |
rootFiles[i++] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + elt.toStringReplacingAny(".", ANY_STRING), false, null, "**/**", null, null, null, elt.toStringReplacingAny(".", ANY_STRING), null, null); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ |
570 |
} |
578 |
} |
571 |
if (!fileSets.isEmpty()) { |
579 |
script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, rootFiles); |
572 |
FileSet[] filesSetsToAdd = (FileSet[]) fileSets.toArray(new FileSet[fileSets.size()]); |
580 |
} else { |
573 |
script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesSetsToAdd); |
581 |
FileSet[] permissionSets = generatePermissions(true); |
574 |
} |
582 |
FileSet[] rootFiles = new FileSet[permissionSets.length + 1]; |
575 |
} |
583 |
String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$ |
576 |
|
584 |
System.arraycopy(permissionSets, 0, rootFiles, 1, permissionSets.length); |
577 |
/** |
585 |
rootFiles[0] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING) + '/' + Utils.getPropertyFormat(PROPERTY_COLLECTING_FOLDER), false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null); //$NON-NLS-1$//$NON-NLS-2$ |
578 |
* @return the file sets for all defined features. |
586 |
script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, rootFiles); |
579 |
*/ |
587 |
} |
580 |
private FileSet[] getFeaturesFileSets() { |
588 |
} |
581 |
FileSet[] filesFeatures = new FileSet[features.length]; |
589 |
|
582 |
for (int i = 0; i < features.length; i++) { |
|
|
583 |
Object[] shape = getFinalShape(features[i]); |
584 |
filesFeatures[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null); |
585 |
} |
586 |
return filesFeatures; |
587 |
} |
588 |
|
589 |
/** |
590 |
* @return the file sets for all defined plugins. |
591 |
*/ |
592 |
private FileSet[] getPluginsFileSets() { |
593 |
FileSet[] filesPlugins = new FileSet[plugins.length]; |
594 |
for (int i = 0; i < plugins.length; i++) { |
595 |
Object[] shape = getFinalShape(plugins[i]); |
596 |
filesPlugins[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null); |
597 |
} |
598 |
return filesPlugins; |
599 |
} |
600 |
|
590 |
protected FileSet[] generatePermissions(boolean zip) { |
601 |
protected FileSet[] generatePermissions(boolean zip) { |
591 |
String configInfix = configInfo.toString("."); //$NON-NLS-1$ |
602 |
String configInfix = configInfo.toString("."); //$NON-NLS-1$ |
592 |
String prefixPermissions = ROOT_PREFIX + configInfix + '.' + PERMISSIONS + '.'; |
603 |
String prefixPermissions = ROOT_PREFIX + configInfix + '.' + PERMISSIONS + '.'; |
Lines 631-637
Link Here
|
631 |
return (FileSet[]) fileSets.toArray(new FileSet[fileSets.size()]); |
642 |
return (FileSet[]) fileSets.toArray(new FileSet[fileSets.size()]); |
632 |
} |
643 |
} |
633 |
|
644 |
|
634 |
//TODO this code andn the generateAntZipTarget() should be refactored using a factory or something like that. |
645 |
//TODO this code and the generateAntZipTarget() should be refactored using a factory or something like that. |
635 |
private void generateAntTarTarget() { |
646 |
private void generateAntTarTarget() { |
636 |
FileSet[] filesPlugins = new FileSet[plugins.length]; |
647 |
FileSet[] filesPlugins = new FileSet[plugins.length]; |
637 |
for (int i = 0; i < plugins.length; i++) { |
648 |
for (int i = 0; i < plugins.length; i++) { |