Restored check that skips generation if the source template has not changed.
Note that javac still always recompiles everything. This makes the build process slower than before (apt was using the already compiled templates as input). Will investigate some other time if this can be mitigated.
This commit is contained in:
parent
78911cc0d4
commit
d17c19fe01
|
@ -77,7 +77,6 @@ public class GeneratorProcessor extends AbstractProcessor {
|
|||
}
|
||||
|
||||
Element lastFile = null;
|
||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "annotations " + annotations.toString());
|
||||
try {
|
||||
long generatorLM = getGeneratorLastModified(bin_path);
|
||||
TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance());
|
||||
|
|
|
@ -280,13 +280,21 @@ public class GeneratorVisitor extends ElementKindVisitor6<Void, Void> {
|
|||
|
||||
@Override
|
||||
public Void visitTypeAsInterface(TypeElement e, Void p) {
|
||||
final File input = new File("src/templates/" + e.getQualifiedName().toString().replace('.', '/') + ".java");
|
||||
final File outputJava = new File("src/generated/" + env.getElementUtils().getPackageOf(e).getQualifiedName().toString().replace('.', '/'), Utils.getSimpleClassName(e) + ".java");
|
||||
|
||||
PrintWriter java_writer = null;
|
||||
try {
|
||||
final Collection<? extends ExecutableElement> methods = Utils.getMethods(e);
|
||||
if ( methods.isEmpty() && Utils.getFields(e).isEmpty() ) {
|
||||
return DEFAULT_VALUE;
|
||||
}
|
||||
env.getMessager().printMessage(Kind.NOTE, "methods count : " + Utils.getMethods(e).size() + " fields count : " + Utils.getFields(e).size(), e);
|
||||
|
||||
// Skip this class if the output exists and the input has not been modified.
|
||||
if ( outputJava.exists() && Math.max(input.lastModified(), generatorLM) < outputJava.lastModified() )
|
||||
return DEFAULT_VALUE;
|
||||
|
||||
//env.getMessager().printMessage(Kind.NOTE, "methods count : " + Utils.getMethods(e).size() + " fields count : " + Utils.getFields(e).size(), e);
|
||||
for ( final ExecutableElement method : methods ) {
|
||||
validateMethod(method);
|
||||
}
|
||||
|
|
|
@ -135,8 +135,6 @@ public class JavaMethodsGenerator {
|
|||
if ( constant_annotation != null && constant_annotation.isNative() ) {
|
||||
continue;
|
||||
}
|
||||
/*env.getMessager().printMessage(Diagnostic.Kind.NOTE, param.getAnnotationMirrors()
|
||||
+ " (" + typeinfos_instance.get(param).getType() + ")", param);*/
|
||||
AnnotationMirror auto_annotation_mirror = Utils.getParameterAutoAnnotation(param);
|
||||
boolean hide_auto_parameter = mode == Mode.NORMAL && !native_stub && auto_annotation_mirror != null;
|
||||
if ( hide_auto_parameter ) {
|
||||
|
|
|
@ -168,7 +168,6 @@ public class TypeInfo {
|
|||
NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class);
|
||||
if ( native_type_annotation != null ) {
|
||||
Class<? extends Annotation> annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
/*env.getMessager().printMessage(Diagnostic.Kind.NOTE, "annotation_type " + annotation_type, param, annotation);*/
|
||||
Signedness signedness = type_map.getSignednessFromType(annotation_type);
|
||||
Class inverse_type = type_map.getInverseType(annotation_type);
|
||||
String auto_type = type_map.getAutoTypeFromAnnotation(annotation);
|
||||
|
|
Loading…
Reference in New Issue