Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » DLTK 2.0 CLEAN_BUILD broken?(Programatically do a CLEAN_BUILD and FULL_BUILD, stale cached modules and problems get loaded...)
DLTK 2.0 CLEAN_BUILD broken? [message #651156] Fri, 28 January 2011 03:33
Carl Knight is currently offline Carl KnightFriend
Messages: 13
Registered: December 2010
Junior Member

We have multiple versions of our script engine. They use different grammas (newer building on the older). If you change interpretters, we kick off a clean and rebuild with the gramma associated with the new interpreter chosen if it's gramma differs from the currently selected.

if( hasOutstandingConfigurationChange() == true ){
    try {
        //TODO Figure out what to do about the problem view when switching grammars
        //     results in parse errors for one but not the other.
        ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.CLEAN_BUILD, null);
        ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
    } catch (CoreException e) {
    } finally {

What I noticed was that even when the gramma was switched, the errors were those of the last build.

The suspect.

When I request a CLEAN_BUILD, as near as I can determine, the ModelManager cache of module information is never cleared. i.e.
never happens. This means that when I request a FULL_BUILD following the clean, the following happens inside

		public void build(IBuildContext context) throws CoreException {
			IModuleDeclaration moduleDeclaration = (ModuleDeclaration) context
			if (moduleDeclaration != null) {
				// do nothing if already have AST - optimization for reconcile

The following call to getSourceModuleInfoCache() retrieves stale module and problem data.
			// get cache entry
			final ISourceModuleInfo cacheEntry = ModelManager.getModelManager()

			// check if there is cached AST
			moduleDeclaration = SourceParserUtil.getModuleFromCache(cacheEntry,
			if (moduleDeclaration != null) {
				// use AST from cache

And we return (above), instead of proceeding with a reparse (below). If I have cleaned, I expect a build to require the reparsing of files, not the loading of stale cached modules and problem information.
			// create problem collector
			final ProblemCollector problemCollector = new ProblemCollector();
			// parse
			moduleDeclaration = parser.parse((IModuleSource) context
					.getSourceModule(), problemCollector);
			// put result to the cache
			SourceParserUtil.putModuleToCache(cacheEntry, moduleDeclaration,
			// report errors to the build context

Solution (and by no means the right one)

Create a class that implements IResourceChangeListener and listen for requests to CLEAN (either by menu or programattically, works in either case) and call SourceParserUtil.clearCache(). As near as I can tell, this happens before anything else gets interested in the cache and so seems safe. Please correct me if I'm wrong.

	public void resourceChanged(IResourceChangeEvent event) {
		if( (event.getType() & IResourceChangeEvent.PRE_BUILD) != 0 && event.getBuildKind() == IncrementalProjectBuilder.CLEAN_BUILD ){
			} catch (Throwable e) {

Is this a bug in the DLTK or an issue with my use of it?


- Carl Knight.
Previous Topic:Ruby Dev: Two Ruby Perspectives?!!
Next Topic:MixinModel lacks thread safety (DLTK 2.0)
Goto Forum:

Current Time: Wed Feb 28 04:21:48 GMT 2024

Powered by FUDForum. Page generated in 0.01769 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top