1 11 package org.eclipse.pde.internal.build.packager; 12 13 import java.util.*; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.pde.internal.build.*; 16 17 public class PackageScriptGenerator extends AssembleScriptGenerator { 18 private String packagingPropertiesLocation; 19 private boolean backwardCompatibleName = false; 20 21 public PackageScriptGenerator(String directory, AssemblyInformation assemblageInformation, String featureId) { 22 super(directory, assemblageInformation, featureId); 23 } 24 25 protected void printProjectDeclaration() { 26 script.printProjectDeclaration("Package all config of " + featureId, TARGET_MAIN, null); } 28 29 protected AssembleConfigScriptGenerator getConfigScriptGenerator() { 30 return new PackageConfigScriptGenerator(); 31 } 32 33 protected String getScriptName() { 34 if (backwardCompatibleName) 35 return "package" + '.' + DEFAULT_ASSEMBLE_ALL; 36 return "package" + '.' + (featureId.equals("") ? "" : featureId + '.') + DEFAULT_ASSEMBLE_ALL; 37 } 38 39 public void setPropertyFile(String propertyFile) { 40 packagingPropertiesLocation = propertyFile; 41 } 42 43 protected Collection[] getConfigInfos(Config aConfig) { 44 return new Collection[] {assemblageInformation.getBinaryPlugins(aConfig), assemblageInformation.getBinaryFeatures(aConfig), assemblageInformation.getFeatures(aConfig), new HashSet(0) }; 45 } 46 47 protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException { 48 configScriptGenerator.initialize(directory, featureId, aConfig, binaryPlugins, binaryFeatures, allFeatures, rootFiles); 49 ((PackageConfigScriptGenerator) configScriptGenerator).setPackagingPropertiesLocation(packagingPropertiesLocation); 50 configScriptGenerator.setArchiveFormat((String ) archivesFormat.get(aConfig)); 51 configScriptGenerator.setGroupConfigs(groupConfigs); 52 setForceUpdateJar(forceUpdateJarFormat); 53 configScriptGenerator.setBuildSiteFactory(siteFactory); 54 configScriptGenerator.generate(); 55 56 Map params = new HashMap(1); 57 params.put("assembleScriptName", configScriptGenerator.getTargetName() + ".xml"); 58 script.printAntTask(Utils.getPropertyFormat(DEFAULT_CUSTOM_TARGETS), null, computeBackwardCompatibleName(aConfig), null, null, params); 59 } 60 61 public void setBackwardCompatibleName(boolean value) { 62 backwardCompatibleName = value; 63 } 64 65 private String computeBackwardCompatibleName(Config configInfo) { 66 if (backwardCompatibleName) 67 return DEFAULT_ASSEMBLE_NAME + (configInfo.equals(Config.genericConfig()) ? "" : ('.' + configInfo.toStringReplacingAny(".", ANY_STRING)) + (backwardCompatibleName ? ".xml" : "")); return DEFAULT_ASSEMBLE_NAME + (featureId.equals("") ? "" : ('.' + featureId)) + (configInfo.equals(Config.genericConfig()) ? "" : ('.' + configInfo.toStringReplacingAny(".", ANY_STRING)) + (backwardCompatibleName ? ".xml" : "")); } 70 } 71 | Popular Tags |