From cfc18b6cf883dc0c54beca9d037ac7c699eea204 Mon Sep 17 00:00:00 2001 From: Hardy Ferentschik Date: Tue, 2 Nov 2010 12:48:04 +0100 Subject: [PATCH] METAGEN-45 Removed the second compilation. It should not be needed. --- tooling/metamodel-generator/pom.xml | 7 ++++--- tooling/metamodel-generator/readme.txt | 15 ++++++--------- .../jpamodelgen/JPAMetaModelEntityProcessor.java | 9 +++------ .../jpamodelgen/test/util/CompilationTest.java | 9 --------- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/tooling/metamodel-generator/pom.xml b/tooling/metamodel-generator/pom.xml index c773fdc2e6..51fbfcf53d 100644 --- a/tooling/metamodel-generator/pom.xml +++ b/tooling/metamodel-generator/pom.xml @@ -4,10 +4,11 @@ org.hibernate hibernate-jpamodelgen - 1.1.0-SNAPSHOT + 1.2.0-SNAPSHOT Hibernate JPA 2 Metamodel Generator Annotation Processor to generate JPA 2 static metamodel classes + http://www.hibernate.org/subprojects/jpamodelgen.html 2009 @@ -59,7 +60,8 @@ - scm:git:git://github.com/hibernate/git@github.com:hibernate/hibernate-metamodelgen.git + scm:git:git://github.com/hibernate/hibernate-metamodelgen.git + scm:git:git@github.com:hibernate/hibernate-metamodelgen.git http://github.com/hibernate/hibernate-metamodelgen @@ -272,7 +274,6 @@ true true - true package deploy javadoc:javadoc org.jboss.maven.plugins:maven-jdocbook-plugin:2.2.1:resources org.jboss.maven.plugins:maven-jdocbook-plugin:2.2.1:generate assembly:assembly diff --git a/tooling/metamodel-generator/readme.txt b/tooling/metamodel-generator/readme.txt index 77b26b9427..52ef0b5276 100644 --- a/tooling/metamodel-generator/readme.txt +++ b/tooling/metamodel-generator/readme.txt @@ -8,6 +8,12 @@ or @Embeddable, as well as entities mapped in /META-INF/orm.xml and mapping files specified in persistence.xml. + Latest stable version + ------------------- + + 1.1.0.Final, 3.11.2010 + + System Requirements ------------------- @@ -34,12 +40,3 @@ Source Code: http://github.com/hibernate/hibernate-metamodelgen Issue Tracking: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN - - - - - - - - - diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java index 783d9d3331..240e1a01af 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java @@ -109,12 +109,8 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor { @Override public boolean process(final Set annotations, final RoundEnvironment roundEnvironment) { - if ( roundEnvironment.processingOver() ) { - if ( !context.isPersistenceUnitCompletelyXmlConfigured() ) { - context.logMessage( Diagnostic.Kind.OTHER, "Last processing round." ); - createMetaModelClasses(); - context.logMessage( Diagnostic.Kind.OTHER, "Finished processing" ); - } + // see also METAGEN-45 + if ( roundEnvironment.processingOver() || annotations.size() == 0) { return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS; } @@ -134,6 +130,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor { } } + createMetaModelClasses(); return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS; } diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/util/CompilationTest.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/util/CompilationTest.java index ecb8d925b7..90d3378671 100644 --- a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/util/CompilationTest.java +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/util/CompilationTest.java @@ -111,15 +111,6 @@ public abstract class CompilationTest { sourceFiles ); - // TODO - need to call the compiler twice. Once to compile the test classes and generate the java files - // of the generated metamodel. The second compile is for generated the class files of the metamodel. - // Note sure why this is not recursive the same way as on the command line - compileSources( options, compiler, diagnostics, fileManager, compilationUnits ); - - compilationUnits = fileManager.getJavaFileObjectsFromFiles( - getCompilationUnits( outBaseDir, packageName ) - ); - options.add( PROC_NONE ); // for the second compile skip the processor compileSources( options, compiler, diagnostics, fileManager, compilationUnits ); compilationDiagnostics.addAll( diagnostics.getDiagnostics() ); fileManager.close();