blob: 774934af7cf914bc4d9ddc9dfdbedb5d3e82b814 [file] [log] [blame]
package aQute.bnd.build;
import java.io.*;
import java.util.*;
import aQute.bnd.osgi.*;
public class ProjectBuilder extends Builder {
Project project;
boolean initialized;
public ProjectBuilder(Project project) {
super(project);
this.project = project;
}
public ProjectBuilder(ProjectBuilder builder) {
super(builder);
this.project = builder.project;
}
@Override
public long lastModified() {
return Math.max(project.lastModified(), super.lastModified());
}
/**
* We put our project and our workspace on the macro path.
*/
@Override
protected Object[] getMacroDomains() {
return new Object[] {
project, project.getWorkspace()
};
}
@Override
public Builder getSubBuilder() throws Exception {
return project.getBuilder(this);
}
public Project getProject() {
return project;
}
@Override
public void init() {
try {
if (!initialized) {
initialized = true;
for (Container file : project.getClasspath()) {
addClasspath(file.getFile());
}
for (Container file : project.getBuildpath()) {
addClasspath(file.getFile());
}
for (Container file : project.getBootclasspath()) {
addClasspath(file.getFile());
}
for (File file : project.getAllsourcepath()) {
addSourcepath(file);
}
}
}
catch (Exception e) {
msgs.Unexpected_Error_("ProjectBuilder init", e);
}
}
@Override
public List<Jar> getClasspath() {
init();
return super.getClasspath();
}
@Override
protected void changedFile(File f) {
project.getWorkspace().changedFile(f);
}
}