1 /*******************************************************************************
2  * Copyright (c) 2000, 2013 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.pde.internal.build.tasks;
15 
16 import java.io.File;
17 import org.apache.tools.ant.BuildException;
18 import org.apache.tools.ant.Task;
19 import org.eclipse.equinox.internal.p2.publisher.eclipse.BrandingIron;
20 import org.eclipse.equinox.internal.p2.publisher.eclipse.ExecutablesDescriptor;
21 
22 /**
23  *
24  */
25 public class BrandTask extends Task {
26 
27 	BrandingIron iron;
28 	private String name;
29 	private String os;
30 	private File root;
31 
BrandTask()32 	public BrandTask() {
33 		iron = new BrandingIron();
34 	}
35 
setName(String value)36 	public void setName(String value) {
37 		name = value;
38 		iron.setName(value);
39 	}
40 
setIcons(String value)41 	public void setIcons(String value) {
42 		iron.setIcons(value);
43 	}
44 
setRoot(String value)45 	public void setRoot(String value) {
46 		root = new File(value);
47 	}
48 
setOS(String value)49 	public void setOS(String value) {
50 		os = value;
51 		iron.setOS(value);
52 	}
53 
54 	@Override
execute()55 	public void execute() throws BuildException {
56 		try {
57 			iron.brand(ExecutablesDescriptor.createDescriptor(os, name, root));
58 		} catch (Exception e) {
59 			throw new BuildException(e);
60 		}
61 	}
62 }
63