KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > build > tasks > AssemblerTask


1 /**********************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM - Initial API and implementation
10  **********************************************************************/

11 package org.eclipse.pde.internal.build.tasks;
12
13 import java.net.MalformedURLException JavaDoc;
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.AbstractScriptGenerator;
18 import org.eclipse.pde.internal.build.Utils;
19 import org.eclipse.pde.internal.build.packager.PackagerBuildScriptGenerator;
20
21 /**
22  * Internal task.
23  * Generate assemble scripts to repackage binary distributions.
24  * @since 3.0
25  */

26 public class AssemblerTask extends Task {
27
28     protected PackagerBuildScriptGenerator generator;
29
30     {
31         generator = new PackagerBuildScriptGenerator();
32         generator.setGenerateIncludedFeatures(true);
33         generator.setAnalyseChildren(true);
34         generator.setSourceFeatureGeneration(false);
35         generator.setBinaryFeatureGeneration(true);
36         generator.setScriptGeneration(false);
37     }
38
39     /**
40      * Set the directory where the packaging will occur
41      * @param workingLocation: the location
42      * @throws MalformedURLException
43      */

44     public void setWorkingDirectory(String JavaDoc workingLocation) throws MalformedURLException JavaDoc {
45         generator.setWorkingDirectory(workingLocation);
46     }
47
48     /**
49      * Set the features to assemble
50      * @param featureList: a comma separated list of features to package
51      */

52     public void setFeatureList(String JavaDoc featureList) throws BuildException {
53         generator.setFeatureList(featureList);
54     }
55
56     /**
57      * Set the configuration for which the assembling is being done
58      * @param configInfo: a configuration
59      * @throws CoreException
60      */

61     public void setConfigInfo(String JavaDoc configInfo) throws CoreException {
62         AbstractScriptGenerator.setConfigInfo(configInfo);
63     }
64
65     /**
66      * Set the location where to find features, plugins and fragments
67      * @param baseLocation: a comma separated list of paths
68      */

69     public void setBaseLocation(String JavaDoc baseLocation) throws BuildException {
70         String JavaDoc[] locations = Utils.getArrayFromString(baseLocation);
71         generator.setPluginPath(locations);
72     }
73
74     public void execute() throws BuildException {
75         try {
76             generator.run();
77         } catch (CoreException e) {
78             throw new BuildException(e);
79         }
80     }
81
82     /**
83      * Set the property file containing information about packaging
84      * @param propertyFile: the path to a property file
85      */

86     public void setPackagePropertyFile(String JavaDoc propertyFile) {
87         generator.setPropertyFile(propertyFile);
88     }
89 }
Popular Tags