use of org.gradle.api.tasks.TaskAction in project meecrowave by apache.
the class MeecrowaveTask method bake.
@TaskAction
public void bake() {
fixConfig();
final Thread thread = Thread.currentThread();
final ClassLoader tccl = thread.getContextClassLoader();
thread.setContextClassLoader(createLoader(tccl));
try {
doRun();
} finally {
thread.setContextClassLoader(tccl);
}
}
use of org.gradle.api.tasks.TaskAction in project cayenne by apache.
the class CgenTask method generate.
@TaskAction
public void generate() {
File dataMapFile = getDataMapFile();
Injector injector = DIBootstrap.createInjector(new ToolsModule(LoggerFactory.getLogger(CgenTask.class)));
CayenneGeneratorMapLoaderAction loaderAction = new CayenneGeneratorMapLoaderAction(injector);
loaderAction.setMainDataMapFile(dataMapFile);
CayenneGeneratorEntityFilterAction filterAction = new CayenneGeneratorEntityFilterAction();
filterAction.setClient(client);
filterAction.setNameFilter(NamePatternMatcher.build(getLogger(), includeEntities, excludeEntities));
try {
loaderAction.setAdditionalDataMapFiles(convertAdditionalDataMaps());
ClassGenerationAction generator = this.createGenerator();
DataMap dataMap = loaderAction.getMainDataMap();
generator.setLogger(getLogger());
if (this.force || getProject().hasProperty("force")) {
generator.setForce(true);
}
generator.setTimestamp(dataMapFile.lastModified());
generator.setDataMap(dataMap);
generator.addEntities(filterAction.getFilteredEntities(dataMap));
generator.addEmbeddables(dataMap.getEmbeddables());
generator.addQueries(dataMap.getQueryDescriptors());
generator.execute();
} catch (Exception exception) {
throw new GradleException("Error generating classes: ", exception);
}
}
Aggregations