use of com.google.api.codegen.config.VersionBound in project toolkit by googleapis.
the class PackageMetadataTransformer method getDependencies.
private List<PackageDependencyView> getDependencies(PackageMetadataNamer namer, Map<String, VersionBound> dependencies, Set<String> whitelistedDependencies) {
List<PackageDependencyView> protoPackageDependencies = new ArrayList<>();
if (dependencies != null) {
Map<String, VersionBound> dependenciesCopy = new HashMap<>(dependencies);
if (whitelistedDependencies != null) {
dependenciesCopy.keySet().retainAll(whitelistedDependencies);
}
for (Map.Entry<String, VersionBound> entry : dependenciesCopy.entrySet()) {
PackageDependencyView packageDependency = PackageDependencyView.newBuilder().group(namer.getProtoPackageGroup()).name(entry.getKey()).versionBound(entry.getValue()).build();
protoPackageDependencies.add(packageDependency);
}
// Ensures deterministic test results.
Collections.sort(protoPackageDependencies);
}
return protoPackageDependencies;
}
Aggregations