Skip to content

Commit

Permalink
HHH-9143 - Build baseline Jandex as part of scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed May 8, 2014
1 parent f410417 commit 4579378
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 53 deletions.
22 changes: 0 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
manifest = osgiManifest {
// GRADLE-1411: Even if we override Imports and Exports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ public interface DeprecationLogger {
"use [hibernate.archive.scanner] instead",
id = 90000001
)
public void logScannerDeprecation();
public void logDeprecatedScannerSetting();
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageBundle;
import org.jboss.logging.annotations.MessageLogger;
import org.jboss.logging.annotations.ValidIdRange;

import static org.jboss.logging.Logger.Level.WARN;

Expand All @@ -43,9 +43,8 @@
* @author Steve Ebersole
*/
@MessageLogger( projectCode = "HHH" )
//@MessageBundle( projectCode = "HHH" )
@ValidIdRange( min = 10000001, max = 10001000 )
public interface UrlMessageBundle {

public static final UrlMessageBundle URL_LOGGER = Logger.getMessageLogger(
UrlMessageBundle.class,
"org.hibernate.orm.url"
Expand All @@ -58,7 +57,7 @@ public interface UrlMessageBundle {
* @param e The underlying URISyntaxException
*/
@LogMessage( level = WARN )
@Message( value = "Malformed URL: %s", id = 100001 )
@Message( value = "Malformed URL: %s", id = 10000001 )
void logMalformedUrl(URL jarUrl, @Cause URISyntaxException e);

/**
Expand All @@ -69,7 +68,7 @@ public interface UrlMessageBundle {
* @param e The underlying URISyntaxException
*/
@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);

/**
Expand All @@ -81,7 +80,7 @@ public interface UrlMessageBundle {
* @see java.io.File#exists()
*/
@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);

/**
Expand All @@ -93,7 +92,7 @@ public interface UrlMessageBundle {
* @see java.io.File#isDirectory()
*/
@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);

/**
Expand All @@ -106,6 +105,6 @@ public interface UrlMessageBundle {
*
* @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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,27 @@ public JandexInitManager(
* INTENDED FOR TESTING ONLY
*/
public JandexInitManager() {
this(
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
public URL locateResource(String resourceName) {
return getClass().getClassLoader().getResource( resourceName );
}
},
false
);
this( null, TestingOnlyClassLoaderAccess.INSTANCE, false );
}

private static class TestingOnlyClassLoaderAccess implements ClassLoaderAccess {
public static final TestingOnlyClassLoaderAccess INSTANCE = new TestingOnlyClassLoaderAccess();

@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
public URL locateResource(String resourceName) {
return getClass().getClassLoader().getResource( resourceName );
}
}

public boolean wasIndexSupplied() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public AccessType convert(Object value) {
if ( scannerSetting == null ) {
scannerSetting = configService.getSettings().get( AvailableSettings.SCANNER_DEPRECATED );
if ( scannerSetting != null ) {
DEPRECATION_LOGGER.logScannerDeprecation();
DEPRECATION_LOGGER.logDeprecatedScannerSetting();
}
}
archiveDescriptorFactory = strategySelector.resolveStrategy(
Expand Down

0 comments on commit 4579378

Please sign in to comment.