@Override public void cleanStarting(IJavaProject project) { super.cleanStarting(project); fCleaned.add(project); }
@Override public void buildStarting(BuildContext[] files, boolean isBatch) { super.buildStarting(files, isBatch); if (this.files != null) this.files.addAll(Arrays.asList(files)); else this.files = Lists.newArrayList(files); }
protected void processAnnotations(CompilationParticipantResult[] results) { boolean hasAnnotationProcessor = false; for (int i = 0, l = this.javaBuilder.participants.length; !hasAnnotationProcessor && i < l; i++) hasAnnotationProcessor = this.javaBuilder.participants[i].isAnnotationProcessor(); if (!hasAnnotationProcessor) return; boolean foundAnnotations = this.filesWithAnnotations != null && this.filesWithAnnotations.size() > 0; for (int i = results.length; --i >= 0;) results[i].reset(foundAnnotations && this.filesWithAnnotations.contains(results[i].sourceFile)); // even if no files have annotations, must still tell every annotation processor in case the file used to have them for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) if (this.javaBuilder.participants[i].isAnnotationProcessor()) this.javaBuilder.participants[i].processAnnotations(results); processAnnotationResults(results); }
@Override public void buildFinished(IJavaProject project) { super.buildFinished(project); if (fCleaned.remove(project)) { String eeId = null; IPath container = null; try { IClasspathEntry[] rawClasspath = project.getRawClasspath(); for (int j = 0; j < rawClasspath.length; j++) { IClasspathEntry entry = rawClasspath[j]; if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { IPath path = entry.getPath(); if (JavaRuntime.JRE_CONTAINER.equals(path.segment(0))) { container = path; eeId = JREContainerInitializer.getExecutionEnvironmentId(path); } } } } catch (CoreException e) { LaunchingPlugin.log(e); } if (container != null && eeId != null) { IVMInstall vm = JREContainerInitializer.resolveVM(container); validateEnvironment(eeId, project, vm); } } }
@Override public void run() throws Exception { participant.reconcile(context); } });
protected AbstractImageBuilder(JavaBuilder javaBuilder, boolean buildStarting, State newState, CompilationGroup compilationGroup) { // local copies this.javaBuilder = javaBuilder; this.compilationGroup = compilationGroup; this.nameEnvironment = compilationGroup == CompilationGroup.TEST ? javaBuilder.testNameEnvironment : javaBuilder.nameEnvironment; this.sourceLocations = this.nameEnvironment.sourceLocations; this.notifier = javaBuilder.notifier; this.keepStoringProblemMarkers = true; // may get disabled when missing classfiles are encountered if (buildStarting) { this.newState = newState == null ? new State(javaBuilder) : newState; this.compiler = newCompiler(); this.workQueue = new WorkQueue(); this.problemSourceFiles = new LinkedHashSet(3); if (this.javaBuilder.participants != null) { for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) { if (this.javaBuilder.participants[i].isAnnotationProcessor()) { // initialize this set so the builder knows to gather CUs that define Annotation types // each Annotation processor participant is then asked to process these files AFTER // the compile loop. The normal dependency loop will then recompile all affected types this.filesWithAnnotations = new HashSet<>(1); break; } } } } }
if ((participants[i] instanceof CompilationParticipant) && (participant = (CompilationParticipant) participants[i]).isActive(project)) result[index++] = participant;
if (this.participants != null) for (int i = 0, l = this.participants.length; i < l; i++) if (this.participants[i].aboutToBuild(this.javaProject) == CompilationParticipant.NEEDS_FULL_BUILD) kind = FULL_BUILD;
try { task.start(); super.buildFinished(project); if (files == null) return;
public void run() throws Exception { participant.reconcile(context); } });
protected AbstractImageBuilder(JavaBuilder javaBuilder, boolean buildStarting, State newState) { // local copies this.javaBuilder = javaBuilder; this.nameEnvironment = javaBuilder.nameEnvironment; this.sourceLocations = this.nameEnvironment.sourceLocations; this.notifier = javaBuilder.notifier; this.keepStoringProblemMarkers = true; // may get disabled when missing classfiles are encountered if (buildStarting) { this.newState = newState == null ? new State(javaBuilder) : newState; this.compiler = newCompiler(); this.workQueue = new WorkQueue(); this.problemSourceFiles = new ArrayList(3); if (this.javaBuilder.participants != null) { for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) { if (this.javaBuilder.participants[i].isAnnotationProcessor()) { // initialize this set so the builder knows to gather CUs that define Annotation types // each Annotation processor participant is then asked to process these files AFTER // the compile loop. The normal dependency loop will then recompile all affected types this.filesWithAnnotations = new SimpleSet(1); break; } } } } }
if ((participants[i] instanceof CompilationParticipant) && (participant = (CompilationParticipant) participants[i]).isActive(project)) result[index++] = participant;
if (this.participants != null) for (int i = 0, l = this.participants.length; i < l; i++) if (this.participants[i].aboutToBuild(this.javaProject) == CompilationParticipant.NEEDS_FULL_BUILD) kind = FULL_BUILD;
protected void processAnnotations(CompilationParticipantResult[] results) { boolean hasAnnotationProcessor = false; for (int i = 0, l = this.javaBuilder.participants.length; !hasAnnotationProcessor && i < l; i++) hasAnnotationProcessor = this.javaBuilder.participants[i].isAnnotationProcessor(); if (!hasAnnotationProcessor) return; boolean foundAnnotations = this.filesWithAnnotations != null && this.filesWithAnnotations.elementSize > 0; for (int i = results.length; --i >= 0;) results[i].reset(foundAnnotations && this.filesWithAnnotations.includes(results[i].sourceFile)); // even if no files have annotations, must still tell every annotation processor in case the file used to have them for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) if (this.javaBuilder.participants[i].isAnnotationProcessor()) this.javaBuilder.participants[i].processAnnotations(results); processAnnotationResults(results); }
} finally { for (int i = 0, l = this.participants == null ? 0 : this.participants.length; i < l; i++) this.participants[i].buildFinished(this.javaProject); if (!ok)
@Override public void cleanStarting(IJavaProject project) { super.cleanStarting(project); fCleaned.add(project); }
this.javaBuilder.participants[i].buildStarting(results, this instanceof BatchImageBuilder);
public void run() throws Exception { participant.reconcile(context); } });
protected AbstractImageBuilder(JavaBuilder javaBuilder, boolean buildStarting, State newState) { // local copies this.javaBuilder = javaBuilder; this.nameEnvironment = javaBuilder.nameEnvironment; this.sourceLocations = this.nameEnvironment.sourceLocations; this.notifier = javaBuilder.notifier; this.keepStoringProblemMarkers = true; // may get disabled when missing classfiles are encountered if (buildStarting) { this.newState = newState == null ? new State(javaBuilder) : newState; this.compiler = newCompiler(); this.workQueue = new WorkQueue(); this.problemSourceFiles = new ArrayList(3); if (this.javaBuilder.participants != null) { for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) { if (this.javaBuilder.participants[i].isAnnotationProcessor()) { // initialize this set so the builder knows to gather CUs that define Annotation types // each Annotation processor participant is then asked to process these files AFTER // the compile loop. The normal dependency loop will then recompile all affected types this.filesWithAnnotations = new SimpleSet(1); break; } } } } }
if ((participants[i] instanceof CompilationParticipant) && (participant = (CompilationParticipant) participants[i]).isActive(project)) result[index++] = participant;