runBasic function
Run a Dartle build with a "basic" setup.
Unlike run, this function does not handle errors, times the build or initializes the logging system.
It is only appropriate for embedding Dartle within another system.
Implementation
Future<void> runBasic(Set<Task> tasks, Set<Task> defaultTasks, Options options,
DartleCache cache) async {
logger.fine(() => 'Dartle version: $dartleVersion\nOptions: $options');
if (options.resetCache) {
await cache.clean();
cache.init();
}
var tasksInvocation = options.tasksInvocation;
final directTasksCount = tasksInvocation
.where((name) => !name.startsWith(taskArgumentPrefix))
.length;
if (directTasksCount == 0 && defaultTasks.isNotEmpty) {
tasksInvocation = defaultTasks.map((t) => t.name).toList();
}
final taskMap = createTaskMap(tasks);
final tasksAffectedByDeletion =
await verifyTaskInputsAndOutputsConsistency(taskMap);
await verifyTaskPhasesConsistency(taskMap);
final executableTasks = await _getExecutableTasks(
taskMap, tasksInvocation, options, tasksAffectedByDeletion);
if (options.showInfoOnly) {
print(colorize(
'======== Showing build information only, no tasks will '
'be executed ========\n',
LogColor.blue));
showTasksInfo(executableTasks, taskMap, defaultTasks, options);
} else {
if (logger.isLoggable(log.Level.INFO)) {
logTasksInfo(tasks, executableTasks, options.tasksInvocation,
directTasksCount, defaultTasks);
}
try {
await _runAll(executableTasks, options);
} finally {
if (!options.disableCache) {
await _cleanCache(cache,
taskMap.keys.followedBy(const ['_compileDartleFile']).toSet());
}
}
}
}