1 11 package org.eclipse.pde.internal.build.tasks; 12 13 import java.util.Properties ; 14 import org.apache.tools.ant.BuildException; 15 import org.apache.tools.ant.Task; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.pde.internal.build.*; 18 import org.eclipse.pde.internal.build.packager.PackagerGenerator; 19 import org.eclipse.pde.internal.build.site.BuildTimeSiteFactory; 20 21 26 public class PackagerTask extends Task { 27 28 protected PackagerGenerator generator; 29 private Properties antProperties = new Properties (); 30 31 { 32 generator = new PackagerGenerator(); 33 generator.setReportResolutionErrors(true); 34 generator.setIgnoreMissingPropertiesFile(true); 35 BuildTimeSiteFactory.setInstalledBaseSite(null); 36 } 37 38 42 public void setWorkingDirectory(String workingLocation) { 43 generator.setWorkingDirectory(workingLocation); 44 } 45 46 50 public void setFeatureList(String featureList) throws BuildException { 51 generator.setFeatureList(featureList); 52 } 53 54 59 public void setConfigInfo(String configInfo) throws CoreException { 60 AbstractScriptGenerator.setConfigInfo(configInfo); 61 } 62 63 69 public void setArchivesFormat(String archivesFormat) throws CoreException { 70 generator.setArchivesFormat(archivesFormat); 71 } 72 73 77 public void setBaseLocation(String baseLocation) throws BuildException { 78 String [] locations = Utils.getArrayFromString(baseLocation); 79 generator.setPluginPath(locations); 80 } 81 82 public void execute() throws BuildException { 83 try { 84 generator.setImmutableAntProperties(antProperties); 85 antProperties.setProperty(IBuildPropertiesConstants.PROPERTY_PACKAGER_MODE, "true"); String value = getProject().getProperty(IBuildPropertiesConstants.RESOLVER_DEV_MODE); 87 if (Boolean.valueOf(value).booleanValue()) 88 antProperties.put(IBuildPropertiesConstants.RESOLVER_DEV_MODE, "true"); BundleHelper.getDefault().setLog(this); 90 generator.generate(); 91 BundleHelper.getDefault().setLog(null); 92 } catch (CoreException e) { 93 throw new BuildException(TaskHelper.statusToString(e.getStatus(), null).toString()); 94 } 95 } 96 97 101 public void setPackagePropertyFile(String propertyFile) { 102 generator.setPropertyFile(propertyFile); 103 } 104 105 public void setDeltaPack(boolean value) { 106 generator.includePlatformIndependent(! value); 107 generator.groupConfigs(value); 108 } 109 110 public void setFilteredDependencyCheck(boolean value) { 111 generator.setFilterState(value); 112 } 113 114 public void setNormalize(boolean value) { 115 if (value) 116 antProperties.setProperty(IBuildPropertiesConstants.PROPERTY_PACKAGER_AS_NORMALIZER, "true"); else 118 antProperties.setProperty(IBuildPropertiesConstants.PROPERTY_PACKAGER_AS_NORMALIZER, "false"); } 120 } 121 | Popular Tags |