@ -30,20 +30,28 @@ import org.springframework.util.FileSystemUtils;
@@ -30,20 +30,28 @@ import org.springframework.util.FileSystemUtils;
/ * *
* Abstract base class for filesystem - based ahead - of - time ( AOT ) processing .
*
* < p > Concrete implementations are typically used to kick off optimization of an
* application or test suite in a build tool .
* < p > Concrete implementations should override { @link # doProcess ( ) } that kicks
* off the optimization of the target , usually an application .
*
* @author Stephane Nicoll
* @author Andy Wilkinson
* @author Phillip Webb
* @author Sam Brannen
* @since 6 . 0
* @param < T > the type of the processing result
* @see FileSystemGeneratedFiles
* @see FileNativeConfigurationWriter
* @see org . springframework . context . aot . ContextAotProcessor
* @see org . springframework . test . context . aot . TestAotProcessor
* /
public abstract class AbstractAotProcessor {
public abstract class AbstractAotProcessor < T > {
/ * *
* The name of a system property that is made available when the processor
* runs .
* @see # doProcess ( )
* /
private static final String AOT_PROCESSING = "spring.aot.processing" ;
private final Settings settings ;
@ -64,6 +72,22 @@ public abstract class AbstractAotProcessor {
@@ -64,6 +72,22 @@ public abstract class AbstractAotProcessor {
return this . settings ;
}
/ * *
* Run AOT processing .
* @return the result of the processing .
* /
public final T process ( ) {
try {
System . setProperty ( AOT_PROCESSING , "true" ) ;
return doProcess ( ) ;
}
finally {
System . clearProperty ( AOT_PROCESSING ) ;
}
}
protected abstract T doProcess ( ) ;
/ * *
* Delete the source , resource , and class output directories .
* /