listeners = new BuildListeners();
// Get the initial project
IProject myProject = getProject();
listeners.fireBuildStarting(myProject);
Project model = null;
try {
model = Central.getProject(myProject.getLocation().toFile());
} catch (Exception e) {
clearBuildMarkers();
addBuildMarkers(e.getMessage(), IMarker.SEVERITY_ERROR);
}
if (model == null)
return null;
this.model = model;
model.setDelayRunDependencies(true);
// Main build section
IProject[] dependsOn = calculateDependsOn(model);
// Clear errors and warnings
model.clear();
// CASE 1: CNF changed
if (isCnfChanged()) {
log(LOG_BASIC, "cnf project changed");
model.refresh();
if (BndContainerInitializer.resetClasspaths(model, myProject, classpathErrors)) {
log(LOG_BASIC, "classpaths were changed");
} else {
log(LOG_FULL, "classpaths did not need to change");
}
// Notify the repository listeners that ALL repo contents may have changed.
List<RepositoryListenerPlugin> repoListeners = Central.getWorkspace().getPlugins(RepositoryListenerPlugin.class);
for (RepositoryListenerPlugin repoListener : repoListeners) {
repoListener.repositoriesRefreshed();
}
return dependsOn;
}
// CASE 2: local Bnd file changed, or Eclipse asks for full build
boolean localChange = false;
if (kind == FULL_BUILD) {
localChange = true;
log(LOG_BASIC, "Eclipse requested full build");
} else if (isLocalBndFileChange()) {
localChange = true;
log(LOG_BASIC, "local bnd files changed");
}
if (localChange) {
model.refresh();
if (BndContainerInitializer.resetClasspaths(model, myProject, classpathErrors)) {
log(LOG_BASIC, "classpaths were changed");
return dependsOn;
}
log(LOG_FULL, "classpaths were not changed");
this.subBuilders = model.getSubBuilders();
rebuildIfLocalChanges(dependsOn, true);
return dependsOn;
}
// (NB: from now on the delta cannot be null, due to the check in
// isLocalBndFileChange)
// CASE 3: JAR file in dependency project changed
Project changedDependency = getDependencyTargetChange();
if (changedDependency != null) {
log(LOG_BASIC, "target files in dependency project %s changed", changedDependency.getName());
model.propertiesChanged();
if (BndContainerInitializer.resetClasspaths(model, myProject, classpathErrors)) {
log(LOG_BASIC, "classpaths were changed");
return dependsOn;
}