Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Problems getting 'non-incremental' to work in AJDT


After rebuilding AJDT on last nights changes to aspectj, I couldn't get non-incremental to work properly - it would be OK for the first compile within eclipse, but subsequent compiles always appeared to be non-full builds, despite the fact that I was always calling buildFresh.  If I restarted eclipse, my first compile would always be OK.

I eventually traced it to AjState.prepareForNextBuild() - this function returns false if a batch build must be done.  Returns true if an incremental build *could* be done.  I extended the method to take an extra parameter (batch) and put the line in that checks for the batch setting.  I've attached the changed version below.

The problem with the original version of this method seems to be that on the second compilation, it gets past the 'if (lastSuccessfulBuildTime==-1 || buildConfig == null)' and starts modifying some fields of AjState - in particular it appears the 'simpleStrings' field that it changes is used elsewhere in the class - (see writeClassFile in AjState).  With my guard for the batch setting, we don't change these fields.  I don't think this is quite the right fix - as it forces prepareForNextBuild to return false whenever batch is in operation - but it is sufficient to get us to progress.  AJDT is looking much more healthy.

        /**
         * Returns false if a batch build is needed.
         */
        boolean prepareForNextBuild(AjBuildConfig newBuildConfig,boolean batch) {
                currentBuildTime = System.currentTimeMillis();
               
                addedClassFiles = new ArrayList();

                // Next line added by Andy
                if (batch) return false;

                if (lastSuccessfulBuildTime == -1 || buildConfig == null) {
                        return false;
                }
               
                simpleStrings = new ArrayList();
                qualifiedStrings = new ArrayList();
               
                Set oldFiles = new HashSet(buildConfig.getFiles());
                Set newFiles = new HashSet(newBuildConfig.getFiles());
               
                addedFiles = new HashSet(newFiles);
                addedFiles.removeAll(oldFiles);
                deletedFiles = new HashSet(oldFiles);
                deletedFiles.removeAll(newFiles);
               
                this.newBuildConfig = newBuildConfig;
               
                return true;
        }


cheers,
Andy.
clemas@xxxxxxxxxxxxxxx

Back to the top