4
* The idea of this task is to read all the properties as if bnd has read them.
5
* This makes it easier to use bnd standalone on the same data.
11
import org.apache.tools.ant.*;
13
import aQute.bnd.build.*;
14
import aQute.bnd.build.Project;
16
public class PrepareTask extends BaseTask {
18
boolean print = false;
21
public void execute() throws BuildException {
23
if (basedir == null || !basedir.isDirectory())
24
throw new BuildException("The given base dir does not exist "
27
Project project = Workspace.getProject(basedir);
28
project.setProperty("in.ant", "true");
29
project.setProperty("environment", "ant");
31
// Check if we are in a sub build, in that case
32
// top will be set to the target directory at the
34
if ( top!=null && top.length()>0 && !top.startsWith("$"))
35
project.setProperty("top", top);
37
project.setExceptions(true);
38
Properties properties = project.getFlattenedProperties();
39
if (report() || report(project))
40
throw new BuildException(
41
"Errors during Eclipse Path inspection");
43
copyProperties(properties);
44
} catch (Exception e) {
46
throw new BuildException(e);
50
private void copyProperties(Properties flattened) {
51
for (Enumeration<?> k = flattened.propertyNames(); k.hasMoreElements();) {
52
String key = (String) k.nextElement();
53
String value = flattened.getProperty(key);
55
System.out.printf("%-20s = %s\n", key, value);
57
// We override existing values.
58
getProject().setProperty(key, value.trim());
62
public boolean isPrint() {
67
* Print out the properties when they are set in sorted order
71
public void setPrint(boolean print) {
76
* Set the base directory of the project. This property MUST be set.
80
public void setBasedir(File basedir) {
81
this.basedir = basedir;
85
* Set the base directory of the project. This property MUST be set.
89
public void setTop(String top) {
4
* The idea of this task is to read all the properties as if bnd has read them.
5
* This makes it easier to use bnd standalone on the same data.
11
import org.apache.tools.ant.*;
13
import aQute.bnd.build.*;
14
import aQute.bnd.build.Project;
16
public class PrepareTask extends BaseTask {
18
boolean print = false;
21
public void execute() throws BuildException {
23
if (basedir == null || !basedir.isDirectory())
24
throw new BuildException("The given base dir does not exist "
27
Project project = Workspace.getProject(basedir);
28
project.setProperty("in.ant", "true");
29
project.setProperty("environment", "ant");
31
// Check if we are in a sub build, in that case
32
// top will be set to the target directory at the
34
if ( top!=null && top.length()>0 && !top.startsWith("$"))
35
project.setProperty("top", top);
37
project.setExceptions(true);
38
Properties properties = project.getFlattenedProperties();
39
if (report() || report(project))
40
throw new BuildException(
41
"Errors during Eclipse Path inspection");
43
copyProperties(properties);
44
} catch (Exception e) {
46
throw new BuildException(e);
50
private void copyProperties(Properties flattened) {
51
for (Enumeration<?> k = flattened.propertyNames(); k.hasMoreElements();) {
52
String key = (String) k.nextElement();
53
String value = flattened.getProperty(key);
55
System.out.printf("%-20s = %s\n", key, value);
57
// We override existing values.
58
getProject().setProperty(key, value.trim());
62
public boolean isPrint() {
67
* Print out the properties when they are set in sorted order
71
public void setPrint(boolean print) {
76
* Set the base directory of the project. This property MUST be set.
80
public void setBasedir(File basedir) {
81
this.basedir = basedir;
85
* Set the base directory of the project. This property MUST be set.
89
public void setTop(String top) {