Hi,

I've noticed that the SCR Generator is being reimplemented ( 
https://issues.apache.org/jira/browse/FELIX-3550 ) so this might a good time to 
discuss annotation processing [1] as an implementation option.

I think that the javax.annotation.processing API and tools support the SCR use 
case, which is - to my knowledge:

1. analyse annotated classes
2. write XML descriptors based on the annotated classes
3. fail the build under certain conditions

I have written a couple of annotation processors some time ago - not open 
source - but I can at least validate that the above are possible.

The benefits of implementing the SCR generator using an annotation process are 
IMO:

1. Simpler integration with build tools by simply dropping the jar in the 
compilation classpath . This works for both Maven/Ant, which we now support, 
but would make it easier to integrate with other build tools , like Gradle .

2. Better IDE integration 
- at least  Eclipse can report errors / warnings in the editor [2,3] 
- it will no longer be required to provide a specific m2eclipse plugin 

Some points which are still not clear for me implementation-wise are:

1. Configuration

There is a standard way of passing compiler arguments when invoking javac 
(-Akey=value ) but it would require configuring the compiler rather than the 
scr plugin. At least for maven builds this is less convenient.

2. Incremental builds

When performing a partial build ( for instance in Eclipse, but I think it also 
applies to Maven ) not all annotated classes are passed to the processor so the 
SCR generator should either only work on full builds by deign or be able to 
perform incremental builds.

Thoughts?

Robert


[1]: 
http://docs.oracle.com/javase/6/docs/technotes/guides/language/annotations.html
[2]: 
http://rombertw.wordpress.com/2010/07/03/cutting-down-gwts-verbosity-with-gwt-mpv-apt/
[3]: http://rombertw.files.wordpress.com/2010/07/genevent-error.png

Reply via email to