build method
Generates the outputs for a given BuildStep
.
Implementation
@override
Future build(BuildStep buildStep) async {
var module = Module.fromJson(
json.decode(await buildStep.readAsString(buildStep.inputId))
as Map<String, dynamic>);
// Entrypoints always have a `.module` file for ease of looking them up,
// but they might not be the primary source.
if (module.primarySource.changeExtension(moduleExtension(platform)) !=
buildStep.inputId) {
return;
}
try {
await _createKernel(
module: module,
buildStep: buildStep,
summaryOnly: summaryOnly,
outputExtension: outputExtension,
targetName: kernelTargetName,
dartSdkDir: platformSdk,
sdkKernelPath: sdkKernelPath,
librariesPath: librariesPath,
useIncrementalCompiler: useIncrementalCompiler,
trackUnusedInputs: trackUnusedInputs,
experiments: experiments,
soundNullSafety: soundNullSafety);
} on MissingModulesException catch (e) {
log.severe(e.toString());
} on KernelException catch (e, s) {
log.severe(
'Error creating '
'${module.primarySource.changeExtension(outputExtension)}',
e,
s);
}
}