resolve method
Try to resolve the source specification.
Returns a ResolvedSource if this provider can handle the
specification, or null to skip to the next provider.
Implementation
@override
Future<ResolvedSource?> resolve(SourceResolutionContext context) async {
final spec = context.specification;
if (spec is! GitSource) return null;
final cacheDir = context.sourceCacheDirectory(key: spec.cacheKey);
if (cacheDir.existsSync()) {
logger?.info('Using cached git source: ${spec.label}');
return ResolvedSource(
directory: _applySubdirectory(cacheDir, spec.subdirectory),
origin: SourceOrigin.cache,
revision: spec.revision,
);
}
logger?.info('Cloning git source: ${spec.label}');
await _clone(spec, cacheDir);
return ResolvedSource(
directory: _applySubdirectory(cacheDir, spec.subdirectory),
origin: SourceOrigin.git,
revision: spec.revision,
);
}