01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM - Initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.build.tasks;
11:
12: import org.apache.tools.ant.BuildException;
13: import org.eclipse.ant.core.Task;
14: import org.eclipse.core.runtime.CoreException;
15: import org.eclipse.pde.internal.build.AbstractScriptGenerator;
16: import org.eclipse.pde.internal.build.BundleHelper;
17: import org.eclipse.pde.internal.build.packager.UnzipperGenerator;
18:
19: /**
20: * Internal Task.
21: * This task generates an unzipper script that unzip a files.
22: * @since 3.0
23: */
24: public class UnzipperGeneratorTask extends Task {
25: private UnzipperGenerator generator = new UnzipperGenerator();
26:
27: public void execute() throws BuildException {
28: try {
29: BundleHelper.getDefault().setLog(this );
30: generator.generate();
31: BundleHelper.getDefault().setLog(null);
32: } catch (CoreException e) {
33: throw new BuildException(TaskHelper.statusToString(
34: e.getStatus(), null).toString());
35: }
36: }
37:
38: /**
39: * Set the name of the file listing all the files that must be unzipped.
40: * @param filename
41: */
42: public void setZipsDirectory(String filename) {
43: generator.setDirectoryLocation(filename);
44: }
45:
46: /**
47: * Set the folder in which the scripts will be generated.
48: * @param installLocation the location where the scripts will be generated and the files fetched.
49: */
50: public void setWorkingDirectory(String installLocation) {
51: generator.setWorkingDirectory(installLocation);
52: }
53:
54: /**
55: * Set the configuration for which the script should be generated. The default is set to be configuration independent.
56: * @param configInfo an ampersand separated list of configuration (for example win32, win32, x86 & macoxs, carbon, ppc).
57: * @throws BuildException
58: */
59: public void setConfigInfo(String configInfo) throws BuildException {
60: try {
61: AbstractScriptGenerator.setConfigInfo(configInfo);
62: } catch (CoreException e) {
63: throw new BuildException(e);
64: }
65: }
66:
67: /**
68: * Set the property file containing information about packaging
69: * @param propertyFile the path to a property file
70: */
71: public void setPackagePropertyFile(String propertyFile) {
72: generator.setPropertyFile(propertyFile);
73: }
74: }
|