List of usage examples for org.eclipse.jdt.internal.core.util Messages build_analyzingDeltas
String build_analyzingDeltas
To view the source code for org.eclipse.jdt.internal.core.util Messages build_analyzingDeltas.
Click Source Link
From source file:net.sf.j2s.core.builder.IncrementalImageBuilder.java
License:Open Source License
public boolean build(SimpleLookupTable deltas) { // initialize builder // walk this project's deltas, find changed source files // walk prereq projects' deltas, find changed class files & add affected source files // use the build state # to skip the deltas for certain prereq projects // ignore changed zip/jar files since they caused a full build // compile the source files & acceptResult() // compare the produced class files against the existing ones on disk // recompile all dependent source files of any type with structural changes or new/removed secondary type // keep a loop counter to abort & perform a full build if (JavaBuilder.DEBUG) System.out.println("INCREMENTAL build"); //$NON-NLS-1$ try {/*from w ww. j a v a2 s . c om*/ resetCollections(); this.notifier.subTask(Messages.build_analyzingDeltas); if (this.javaBuilder.hasBuildpathErrors()) { // if a mssing class file was detected in the last build, a build state was saved since its no longer fatal // but we need to rebuild every source file since problems were not recorded // AND to avoid the infinite build scenario if this project is involved in a cycle, see bug 160550 // we need to avoid unnecessary deltas caused by doing a full build in this case if (JavaBuilder.DEBUG) System.out.println("COMPILING all source files since the buildpath has errors "); //$NON-NLS-1$ this.javaBuilder.currentProject.deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); addAllSourceFiles(this.sourceFiles); this.notifier.updateProgressDelta(0.25f); } else { IResourceDelta sourceDelta = (IResourceDelta) deltas.get(this.javaBuilder.currentProject); if (sourceDelta != null) if (!findSourceFiles(sourceDelta)) return false; this.notifier.updateProgressDelta(0.10f); Object[] keyTable = deltas.keyTable; Object[] valueTable = deltas.valueTable; for (int i = 0, l = valueTable.length; i < l; i++) { IResourceDelta delta = (IResourceDelta) valueTable[i]; if (delta != null) { IProject p = (IProject) keyTable[i]; ClasspathLocation[] classFoldersAndJars = (ClasspathLocation[]) this.javaBuilder.binaryLocationsPerProject .get(p); if (classFoldersAndJars != null) if (!findAffectedSourceFiles(delta, classFoldersAndJars, p)) return false; } } this.notifier.updateProgressDelta(0.10f); this.notifier.subTask(Messages.build_analyzingSources); addAffectedSourceFiles(); this.notifier.updateProgressDelta(0.05f); } this.compileLoop = 0; float increment = 0.40f; while (this.sourceFiles.size() > 0) { // added to in acceptResult if (++this.compileLoop > MaxCompileLoop) { if (JavaBuilder.DEBUG) System.out.println("ABORTING incremental build... exceeded loop count"); //$NON-NLS-1$ return false; } this.notifier.checkCancel(); SourceFile[] allSourceFiles = new SourceFile[this.sourceFiles.size()]; this.sourceFiles.toArray(allSourceFiles); resetCollections(); this.workQueue.addAll(allSourceFiles); this.notifier.setProgressPerCompilationUnit(increment / allSourceFiles.length); increment = increment / 2; compile(allSourceFiles); removeSecondaryTypes(); addAffectedSourceFiles(); } if (this.hasStructuralChanges && this.javaBuilder.javaProject.hasCycleMarker()) this.javaBuilder.mustPropagateStructuralChanges(); } catch (AbortIncrementalBuildException e) { // abort the incremental build and let the batch builder handle the problem if (JavaBuilder.DEBUG) System.out.println("ABORTING incremental build... problem with " + e.qualifiedTypeName + //$NON-NLS-1$ ". Likely renamed inside its existing source file."); //$NON-NLS-1$ return false; } catch (CoreException e) { throw internalException(e); } finally { cleanUp(); } return true; }