HHH-9143 - Build baseline Jandex as part of scanning

This commit is contained in:
Steve Ebersole 2014-05-08 12:43:56 -05:00
parent f410417f25
commit 457937885b
5 changed files with 29 additions and 52 deletions

View File

@ -207,28 +207,6 @@ subprojects { subProject ->
] ]
} }
compileJava {
File mainAptDir = mkdir( "${subProject.buildDir}/generated-src/apt/main" )
options.compilerArgs += [ "-s", "$mainAptDir.absolutePath" ]
doFirst {
if ( !mainAptDir.exists() ) {
mainAptDir.mkdirs();
}
}
}
compileTestJava {
File testAptDir = mkdir( "${subProject.buildDir}/generated-src/apt/test" );
options.compilerArgs += [ "-s", "$testAptDir.absolutePath" ]
doFirst {
if ( !testAptDir.exists() ) {
testAptDir.mkdirs();
}
}
}
jar { jar {
manifest = osgiManifest { manifest = osgiManifest {
// GRADLE-1411: Even if we override Imports and Exports // GRADLE-1411: Even if we override Imports and Exports

View File

@ -53,5 +53,5 @@ public interface DeprecationLogger {
"use [hibernate.archive.scanner] instead", "use [hibernate.archive.scanner] instead",
id = 90000001 id = 90000001
) )
public void logScannerDeprecation(); public void logDeprecatedScannerSetting();
} }

View File

@ -30,8 +30,8 @@ import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause; import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageBundle;
import org.jboss.logging.annotations.MessageLogger; import org.jboss.logging.annotations.MessageLogger;
import org.jboss.logging.annotations.ValidIdRange;
import static org.jboss.logging.Logger.Level.WARN; import static org.jboss.logging.Logger.Level.WARN;
@ -43,9 +43,8 @@ import static org.jboss.logging.Logger.Level.WARN;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@MessageLogger( projectCode = "HHH" ) @MessageLogger( projectCode = "HHH" )
//@MessageBundle( projectCode = "HHH" ) @ValidIdRange( min = 10000001, max = 10001000 )
public interface UrlMessageBundle { public interface UrlMessageBundle {
public static final UrlMessageBundle URL_LOGGER = Logger.getMessageLogger( public static final UrlMessageBundle URL_LOGGER = Logger.getMessageLogger(
UrlMessageBundle.class, UrlMessageBundle.class,
"org.hibernate.orm.url" "org.hibernate.orm.url"
@ -58,7 +57,7 @@ public interface UrlMessageBundle {
* @param e The underlying URISyntaxException * @param e The underlying URISyntaxException
*/ */
@LogMessage( level = WARN ) @LogMessage( level = WARN )
@Message( value = "Malformed URL: %s", id = 100001 ) @Message( value = "Malformed URL: %s", id = 10000001 )
void logMalformedUrl(URL jarUrl, @Cause URISyntaxException e); void logMalformedUrl(URL jarUrl, @Cause URISyntaxException e);
/** /**
@ -69,7 +68,7 @@ public interface UrlMessageBundle {
* @param e The underlying URISyntaxException * @param e The underlying URISyntaxException
*/ */
@LogMessage( level = WARN ) @LogMessage( level = WARN )
@Message( value = "File or directory named by URL [%s] could not be found. URL will be ignored", id = 100002 ) @Message( value = "File or directory named by URL [%s] could not be found. URL will be ignored", id = 10000002 )
void logUnableToFindFileByUrl(URL url, @Cause Exception e); void logUnableToFindFileByUrl(URL url, @Cause Exception e);
/** /**
@ -81,7 +80,7 @@ public interface UrlMessageBundle {
* @see java.io.File#exists() * @see java.io.File#exists()
*/ */
@LogMessage( level = WARN ) @LogMessage( level = WARN )
@Message( value = "File or directory named by URL [%s] did not exist. URL will be ignored", id = 100003 ) @Message( value = "File or directory named by URL [%s] did not exist. URL will be ignored", id = 10000003 )
void logFileDoesNotExist(URL url); void logFileDoesNotExist(URL url);
/** /**
@ -93,7 +92,7 @@ public interface UrlMessageBundle {
* @see java.io.File#isDirectory() * @see java.io.File#isDirectory()
*/ */
@LogMessage( level = WARN ) @LogMessage( level = WARN )
@Message( value = "Expecting resource named by URL [%s] to be a directory, but it was not. URL will be ignored", id = 100004 ) @Message( value = "Expecting resource named by URL [%s] to be a directory, but it was not. URL will be ignored", id = 10000004 )
void logFileIsNotDirectory(URL url); void logFileIsNotDirectory(URL url);
/** /**
@ -106,6 +105,6 @@ public interface UrlMessageBundle {
* *
* @return The message * @return The message
*/ */
@Message( value = "File [%s] referenced by given URL [%s] does not exist", id = 100005 ) @Message( value = "File [%s] referenced by given URL [%s] does not exist", id = 10000005 )
String fileDoesNotExist(String filePart, URL url); String fileDoesNotExist(String filePart, URL url);
} }

View File

@ -94,27 +94,27 @@ public class JandexInitManager implements JandexInitializer {
* INTENDED FOR TESTING ONLY * INTENDED FOR TESTING ONLY
*/ */
public JandexInitManager() { public JandexInitManager() {
this( this( null, TestingOnlyClassLoaderAccess.INSTANCE, false );
null, }
new ClassLoaderAccess() {
@Override
@SuppressWarnings("unchecked")
public <T> Class<T> classForName(String name) {
try {
return (Class<T>) getClass().getClassLoader().loadClass( name );
}
catch ( Exception e ) {
throw new ClassLoadingException( "Could not load class by name : " + name );
}
}
@Override private static class TestingOnlyClassLoaderAccess implements ClassLoaderAccess {
public URL locateResource(String resourceName) { public static final TestingOnlyClassLoaderAccess INSTANCE = new TestingOnlyClassLoaderAccess();
return getClass().getClassLoader().getResource( resourceName );
} @Override
}, @SuppressWarnings("unchecked")
false public <T> Class<T> classForName(String name) {
); try {
return (Class<T>) getClass().getClassLoader().loadClass( name );
}
catch ( Exception e ) {
throw new ClassLoadingException( "Could not load class by name : " + name );
}
}
@Override
public URL locateResource(String resourceName) {
return getClass().getClassLoader().getResource( resourceName );
}
} }
public boolean wasIndexSupplied() { public boolean wasIndexSupplied() {

View File

@ -371,7 +371,7 @@ public class MetadataBuilderImpl implements MetadataBuilder, TypeContributions {
if ( scannerSetting == null ) { if ( scannerSetting == null ) {
scannerSetting = configService.getSettings().get( AvailableSettings.SCANNER_DEPRECATED ); scannerSetting = configService.getSettings().get( AvailableSettings.SCANNER_DEPRECATED );
if ( scannerSetting != null ) { if ( scannerSetting != null ) {
DEPRECATION_LOGGER.logScannerDeprecation(); DEPRECATION_LOGGER.logDeprecatedScannerSetting();
} }
} }
archiveDescriptorFactory = strategySelector.resolveStrategy( archiveDescriptorFactory = strategySelector.resolveStrategy(