Lines 64-70
Link Here
|
64 |
import org.eclipse.pde.api.tools.internal.IApiCoreConstants; |
64 |
import org.eclipse.pde.api.tools.internal.IApiCoreConstants; |
65 |
import org.eclipse.pde.api.tools.internal.problems.ApiProblemFactory; |
65 |
import org.eclipse.pde.api.tools.internal.problems.ApiProblemFactory; |
66 |
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin; |
66 |
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin; |
|
|
67 |
import org.eclipse.pde.api.tools.internal.provisional.Factory; |
68 |
import org.eclipse.pde.api.tools.internal.provisional.IApiAnnotations; |
67 |
import org.eclipse.pde.api.tools.internal.provisional.IApiComponent; |
69 |
import org.eclipse.pde.api.tools.internal.provisional.IApiComponent; |
|
|
70 |
import org.eclipse.pde.api.tools.internal.provisional.IApiDescription; |
68 |
import org.eclipse.pde.api.tools.internal.provisional.IApiMarkerConstants; |
71 |
import org.eclipse.pde.api.tools.internal.provisional.IApiMarkerConstants; |
69 |
import org.eclipse.pde.api.tools.internal.provisional.IApiProfile; |
72 |
import org.eclipse.pde.api.tools.internal.provisional.IApiProfile; |
70 |
import org.eclipse.pde.api.tools.internal.provisional.builder.IApiAnalyzer; |
73 |
import org.eclipse.pde.api.tools.internal.provisional.builder.IApiAnalyzer; |
Lines 165-170
Link Here
|
165 |
private IProject fCurrentProject = null; |
168 |
private IProject fCurrentProject = null; |
166 |
|
169 |
|
167 |
/** |
170 |
/** |
|
|
171 |
* Corresponding API component being analyzed |
172 |
*/ |
173 |
private IApiComponent fCurrentApiComponent = null; |
174 |
|
175 |
/** |
168 |
* The API analyzer for this builder |
176 |
* The API analyzer for this builder |
169 |
*/ |
177 |
*/ |
170 |
private IApiAnalyzer fAnalyzer = null; |
178 |
private IApiAnalyzer fAnalyzer = null; |
Lines 272-277
Link Here
|
272 |
if (memberIndex > 0) { |
280 |
if (memberIndex > 0) { |
273 |
typeName = typeName.substring(0, memberIndex); |
281 |
typeName = typeName.substring(0, memberIndex); |
274 |
} |
282 |
} |
|
|
283 |
if (fCurrentApiComponent != null) { |
284 |
try { |
285 |
IApiDescription description = fCurrentApiComponent.getApiDescription(); |
286 |
IApiAnnotations annotations = description.resolveAnnotations(Factory.packageDescriptor(packageName.replace('/', '.')).getType(typeName)); |
287 |
if (annotations != null && !annotations.hasChanged()) { |
288 |
return; |
289 |
} |
290 |
} catch (CoreException e) { |
291 |
ApiPlugin.log(e.getStatus()); |
292 |
} |
293 |
} |
275 |
if (fTypes.add(typeName) && fPackages.add(packageName) && DEBUG) { |
294 |
if (fTypes.add(typeName) && fPackages.add(packageName) && DEBUG) { |
276 |
System.out.println(" will look for dependents of " + typeName + " in " + packageName); //$NON-NLS-1$ //$NON-NLS-2$ |
295 |
System.out.println(" will look for dependents of " + typeName + " in " + packageName); //$NON-NLS-1$ //$NON-NLS-2$ |
277 |
} |
296 |
} |
Lines 283-288
Link Here
|
283 |
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { |
302 |
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { |
284 |
fCurrentProject = getProject(); |
303 |
fCurrentProject = getProject(); |
285 |
fAnalyzer = getAnalyzer(); |
304 |
fAnalyzer = getAnalyzer(); |
|
|
305 |
fCurrentApiComponent = null; |
286 |
if (fCurrentProject == null || !fCurrentProject.isAccessible() || !fCurrentProject.hasNature(ApiPlugin.NATURE_ID) || |
306 |
if (fCurrentProject == null || !fCurrentProject.isAccessible() || !fCurrentProject.hasNature(ApiPlugin.NATURE_ID) || |
287 |
hasBeenBuilt(fCurrentProject)) { |
307 |
hasBeenBuilt(fCurrentProject)) { |
288 |
return new IProject[0]; |
308 |
return new IProject[0]; |
Lines 291-298
Link Here
|
291 |
System.out.println("\nStarting build of " + fCurrentProject.getName() + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ //$NON-NLS-2$ |
311 |
System.out.println("\nStarting build of " + fCurrentProject.getName() + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ //$NON-NLS-2$ |
292 |
} |
312 |
} |
293 |
updateMonitor(monitor, 0); |
313 |
updateMonitor(monitor, 0); |
294 |
SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_builder, 2); |
314 |
SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_builder, 3); |
295 |
IProject[] projects = getRequiredProjects(true); |
315 |
IProject[] projects = getRequiredProjects(true); |
|
|
316 |
localMonitor.subTask(BuilderMessages.building_workspace_profile); |
317 |
IPluginModelBase currentModel = getCurrentModel(); |
318 |
IApiProfile wsprofile = null; |
319 |
if (currentModel != null) { |
320 |
wsprofile = getWorkspaceProfile(); |
321 |
if (wsprofile != null) { |
322 |
String id = currentModel.getBundleDescription().getSymbolicName(); |
323 |
fCurrentApiComponent = wsprofile.getApiComponent(id); |
324 |
} else { |
325 |
if (DEBUG) { |
326 |
System.err.println("Could not retrieve a workspace profile"); //$NON-NLS-1$ |
327 |
} |
328 |
} |
329 |
} |
330 |
updateMonitor(localMonitor, 1); |
296 |
try { |
331 |
try { |
297 |
switch(kind) { |
332 |
switch(kind) { |
298 |
case FULL_BUILD : { |
333 |
case FULL_BUILD : { |
Lines 342-347
Link Here
|
342 |
} |
377 |
} |
343 |
updateMonitor(monitor, 0); |
378 |
updateMonitor(monitor, 0); |
344 |
} finally { |
379 |
} finally { |
|
|
380 |
fCurrentApiComponent = null; |
345 |
fTypes.clear(); |
381 |
fTypes.clear(); |
346 |
fPackages.clear(); |
382 |
fPackages.clear(); |
347 |
fTypesToCheck.clear(); |
383 |
fTypesToCheck.clear(); |
Lines 356-361
Link Here
|
356 |
saveBuiltState(fCurrentProject, fBuildState); |
392 |
saveBuiltState(fCurrentProject, fBuildState); |
357 |
fBuildState = null; |
393 |
fBuildState = null; |
358 |
} |
394 |
} |
|
|
395 |
if (wsprofile != null) { |
396 |
wsprofile.close(); |
397 |
} |
359 |
} |
398 |
} |
360 |
if (DEBUG) { |
399 |
if (DEBUG) { |
361 |
System.out.println("Finished build of " + fCurrentProject.getName() + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ //$NON-NLS-2$ |
400 |
System.out.println("Finished build of " + fCurrentProject.getName() + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ //$NON-NLS-2$ |
Lines 368-408
Link Here
|
368 |
* @param monitor |
407 |
* @param monitor |
369 |
*/ |
408 |
*/ |
370 |
private void buildAll(IProgressMonitor monitor) throws CoreException { |
409 |
private void buildAll(IProgressMonitor monitor) throws CoreException { |
371 |
IApiProfile wsprofile = null; |
|
|
372 |
try { |
410 |
try { |
373 |
clearLastState(); |
411 |
clearLastState(); |
374 |
fBuildState = new BuildState(); |
412 |
fBuildState = new BuildState(); |
375 |
SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_on_0, 4); |
413 |
SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_on_0, 3); |
376 |
localMonitor.subTask(NLS.bind(BuilderMessages.ApiAnalysisBuilder_initializing_analyzer, fCurrentProject.getName())); |
414 |
localMonitor.subTask(NLS.bind(BuilderMessages.ApiAnalysisBuilder_initializing_analyzer, fCurrentProject.getName())); |
377 |
IApiProfile profile = ApiPlugin.getDefault().getApiProfileManager().getDefaultApiProfile(); |
415 |
IApiProfile profile = ApiPlugin.getDefault().getApiProfileManager().getDefaultApiProfile(); |
378 |
cleanupMarkers(fCurrentProject); |
416 |
cleanupMarkers(fCurrentProject); |
379 |
cleanupUnsupportedTagMarkers(fCurrentProject); |
417 |
cleanupUnsupportedTagMarkers(fCurrentProject); |
380 |
IPluginModelBase currentModel = getCurrentModel(); |
418 |
// Compatibility checks |
381 |
if (currentModel != null) { |
419 |
if(fCurrentApiComponent != null) { |
382 |
localMonitor.subTask(BuilderMessages.building_workspace_profile); |
420 |
fAnalyzer.analyzeComponent(fBuildState, null, profile, fCurrentApiComponent, null, null, localMonitor.newChild(1)); |
383 |
wsprofile = getWorkspaceProfile(); |
421 |
updateMonitor(localMonitor, 1); |
|
|
422 |
createMarkers(); |
384 |
updateMonitor(localMonitor, 1); |
423 |
updateMonitor(localMonitor, 1); |
385 |
if (wsprofile == null) { |
|
|
386 |
if (DEBUG) { |
387 |
System.err.println("Could not retrieve a workspace profile"); //$NON-NLS-1$ |
388 |
} |
389 |
return; |
390 |
} |
391 |
String id = currentModel.getBundleDescription().getSymbolicName(); |
392 |
// Compatibility checks |
393 |
IApiComponent apiComponent = wsprofile.getApiComponent(id); |
394 |
if(apiComponent != null) { |
395 |
fAnalyzer.analyzeComponent(fBuildState, null, profile, apiComponent, null, null, localMonitor.newChild(1)); |
396 |
updateMonitor(localMonitor, 1); |
397 |
createMarkers(); |
398 |
updateMonitor(localMonitor, 1); |
399 |
} |
400 |
} |
424 |
} |
401 |
} |
425 |
} |
402 |
finally { |
426 |
finally { |
403 |
if(wsprofile != null) { |
|
|
404 |
wsprofile.close(); |
405 |
} |
406 |
if(monitor != null) { |
427 |
if(monitor != null) { |
407 |
monitor.done(); |
428 |
monitor.done(); |
408 |
} |
429 |
} |
Lines 581-587
Link Here
|
581 |
* @param monitor |
602 |
* @param monitor |
582 |
*/ |
603 |
*/ |
583 |
private void build(final State state, IProgressMonitor monitor) throws CoreException { |
604 |
private void build(final State state, IProgressMonitor monitor) throws CoreException { |
584 |
IApiProfile wsprofile = null; |
|
|
585 |
try { |
605 |
try { |
586 |
clearLastState(); // so if the build fails, a full build will be triggered |
606 |
clearLastState(); // so if the build fails, a full build will be triggered |
587 |
SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_on_0, 6); |
607 |
SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_on_0, 6); |
Lines 590-625
Link Here
|
590 |
collectAffectedSourceFiles(state); |
610 |
collectAffectedSourceFiles(state); |
591 |
updateMonitor(localMonitor, 1); |
611 |
updateMonitor(localMonitor, 1); |
592 |
if (fTypesToCheck.size() != 0) { |
612 |
if (fTypesToCheck.size() != 0) { |
593 |
IPluginModelBase currentModel = getCurrentModel(); |
613 |
if(fCurrentApiComponent == null) { |
594 |
if (currentModel != null) { |
614 |
return; |
595 |
wsprofile = getWorkspaceProfile(); |
|
|
596 |
if (wsprofile == null) { |
597 |
if (DEBUG) { |
598 |
System.err.println("Could not retrieve a workspace profile"); //$NON-NLS-1$ |
599 |
} |
600 |
return; |
601 |
} |
602 |
String id = currentModel.getBundleDescription().getSymbolicName(); |
603 |
IApiComponent apiComponent = wsprofile.getApiComponent(id); |
604 |
if(apiComponent == null) { |
605 |
return; |
606 |
} |
607 |
List tnames = new ArrayList(fTypesToCheck.size()), |
608 |
cnames = new ArrayList(fChangedTypes.size()); |
609 |
collectAllQualifiedNames(fTypesToCheck, fChangedTypes, tnames, cnames, localMonitor.newChild(1)); |
610 |
updateMonitor(localMonitor, 1); |
611 |
IApiProfile profile = ApiPlugin.getDefault().getApiProfileManager().getDefaultApiProfile(); |
612 |
fAnalyzer.analyzeComponent(fBuildState, null, profile, apiComponent, (String[])tnames.toArray(new String[tnames.size()]), (String[])cnames.toArray(new String[cnames.size()]), localMonitor.newChild(1)); |
613 |
updateMonitor(localMonitor, 1); |
614 |
createMarkers(); |
615 |
updateMonitor(localMonitor, 1); |
616 |
} |
615 |
} |
|
|
616 |
List tnames = new ArrayList(fTypesToCheck.size()), |
617 |
cnames = new ArrayList(fChangedTypes.size()); |
618 |
collectAllQualifiedNames(fTypesToCheck, fChangedTypes, tnames, cnames, localMonitor.newChild(1)); |
619 |
updateMonitor(localMonitor, 1); |
620 |
IApiProfile profile = ApiPlugin.getDefault().getApiProfileManager().getDefaultApiProfile(); |
621 |
fAnalyzer.analyzeComponent(fBuildState, null, profile, fCurrentApiComponent, (String[])tnames.toArray(new String[tnames.size()]), (String[])cnames.toArray(new String[cnames.size()]), localMonitor.newChild(1)); |
622 |
updateMonitor(localMonitor, 1); |
623 |
createMarkers(); |
624 |
updateMonitor(localMonitor, 1); |
617 |
} |
625 |
} |
618 |
} |
626 |
} |
619 |
finally { |
627 |
finally { |
620 |
if(wsprofile != null) { |
|
|
621 |
wsprofile.close(); |
622 |
} |
623 |
if(monitor != null) { |
628 |
if(monitor != null) { |
624 |
monitor.done(); |
629 |
monitor.done(); |
625 |
} |
630 |
} |