Bug 54622 - Incremental support ignores resources
Summary: Incremental support ignores resources
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.2.1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-12 09:42 EST by Adrian Colyer CLA
Modified: 2004-10-21 04:31 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Colyer CLA 2004-03-12 09:42:18 EST
Our incremental compilation support ignores changes to resources, and worse 
keeps binary copies of every resource it has ever seen in memory in bcelWeaver.
resources.
Comment 1 Adrian Colyer CLA 2004-03-16 17:15:36 EST
New implementation handles resources in AjBuildManager, keeping list of resource 
file names only (not content) in AjState. Correctly handles resources additions, 
deletions and updates from inpath directories. If resources in an injar are 
changed, the change of the jar itself will trigger a full build so incremental 
treatment of resources in jars is not required.

I'm leaving this bug open for now, despite checking in the working code, because 
I've been unable to write any satisfactory tests that exercise this function (I 
tested it with an incremental loop started in eclipse, and then manipulated 
resources by hand, pressing enter for a new incremental compile after each 
change). I'm checking in an extension to the test harness that supports staged 
copying of .class, .jar, .properties, and .xml files in addition to .java files 
(with tags etc.), but there are timing issues to do with the incremental 
compiler thread that escaped my limited knowledge of the harness. Perhaps Wes & 
I can work through this at AOSD next week.

Here's an example of the kind of test-spec I was trying to write:

<ajc-test dir="incremental/resources/add" 
    	title="expect resource added in initial incremental tests" 
    	keywords="incremental-test" >
        <compile staging="true" files="."
        	options="-incremental"
        	sourceroots="."/>
        <run class="SomeClass"/>
        <inc-compile tag="20" >
          <!-- do I need a dir-changes entry here for a resource file?? -->
        </inc-compile>
        <run class="SomeClass"  skipTester="true"/>
    </ajc-test>

Note that I need to put a directory into the files specification to pass in an 
inpath dir (containing the resources to be copied). I then have some properties 
files (foo.properties, which should be copied on the first iteration, and bar.
20.properties, which should be copied on the second iteration). I step through 
in the debugger and see that foo.properties at least is output into the sandbox.
classesDir, but the run command seems to get there ahead of the copy (race 
condition?) and so the execution of SomeClass fails with a missing resource 
bundle. It's not quite right though since the inpath dir itself also needs to be 
staged somehow (bar.20.properties is visible on the first run, with the 20 in 
the filename still). Needs more design thought on my part, and a greater 
understanding of the existing test harness implementation...
Comment 2 Wes Isberg CLA 2004-03-16 17:21:58 EST
We can talk next week.  It's good you got this far.  I seem to recall adding a
delay after the last .java file copied last-mod-time because it's possible to
compile and copy resources within the minimal time (1 ms?) recognized by the
filesystem, which would cause the updated resources to not be recognized as such.
Comment 3 Adrian Colyer CLA 2004-03-19 09:59:55 EST
included in 1.2 release
Comment 4 Adrian Colyer CLA 2004-08-05 09:47:12 EDT
Tests now committed to source tree and passing...

Found and fixed one bug in the process - when removing either a class file or a
resource from an in-jar, the corresponding element was not deleted from the 
output directory.
Comment 5 Adrian Colyer CLA 2004-10-21 04:31:39 EDT
Fix released as part of AspectJ 1.2.1