*/
public static boolean validate(TreeLogger logger, JJSOptions jjsOptions,
ModuleDef module, File genDir, File generatorResourcesDir,
File dumpSignatureFile) {
try {
CompilationState compilationState = module.getCompilationState(logger);
if (dumpSignatureFile != null) {
// Dump early to avoid generated types.
SignatureDumper.dumpSignatures(logger,
compilationState.getTypeOracle(), dumpSignatureFile);
}
String[] declEntryPts = module.getEntryPointTypeNames();
String[] additionalRootTypes = null;
if (declEntryPts.length == 0) {
// No declared entry points, just validate all visible classes.
Collection<CompilationUnit> compilationUnits = compilationState.getCompilationUnits();
additionalRootTypes = new String[compilationUnits.size()];
int i = 0;
for (CompilationUnit unit : compilationUnits) {
additionalRootTypes[i++] = unit.getTypeName();
}
}
ArtifactSet generatorArtifacts = new ArtifactSet();
DistillerRebindPermutationOracle rpo = new DistillerRebindPermutationOracle(
module, compilationState, generatorArtifacts,
new PropertyPermutations(module.getProperties()), genDir,
generatorResourcesDir);
// Allow GC later.
compilationState = null;
if (dumpSignatureFile != null) {
// Dump early to avoid generated types.
SignatureDumper.dumpSignatures(logger,
compilationState.getTypeOracle(), dumpSignatureFile);
}
// Never optimize on a validation run.
jjsOptions.setOptimizePrecompile(false);
getCompiler(module).precompile(logger, module, rpo, declEntryPts,
additionalRootTypes, jjsOptions, true);