use of com.google.api.codegen.viewmodel.metadata.PackageMetadataView in project toolkit by googleapis.
the class JavaGrpcMetadataProvider method generate.
@Override
public Map<String, Doc> generate(Model model, PackageMetadataConfig config) {
ImmutableMap.Builder<String, Doc> docs = new ImmutableMap.Builder<>();
ProtoApiModel apiModel = new ProtoApiModel(model);
ArrayList<PackageMetadataView> metadataViews = new ArrayList<>();
metadataViews.addAll(transformer.transform(apiModel, config));
for (PackageMetadataView view : metadataViews) {
CommonSnippetSetRunner runner = new CommonSnippetSetRunner(view);
Doc result = runner.generate(view);
if (!result.isWhitespace()) {
docs.put(view.outputPath(), result);
}
}
return docs.build();
}
use of com.google.api.codegen.viewmodel.metadata.PackageMetadataView in project toolkit by googleapis.
the class PythonGrpcPackageGenerator method generate.
@Override
public Map<String, GeneratedResult<Doc>> generate() throws IOException {
ImmutableMap.Builder<String, GeneratedResult<Doc>> results = new ImmutableMap.Builder<>();
ArrayList<PackageMetadataView> metadataViews = new ArrayList<>();
PythonPackageCopier copier = new PythonPackageCopier();
PythonPackageCopierResult copierResult = copier.run(options, config);
results.putAll(copierResult.results());
PythonGrpcPackageTransformer pythonTransformer = new PythonGrpcPackageTransformer(copierResult);
ProtoApiModel apiModel = new ProtoApiModel(model);
metadataViews.addAll(pythonTransformer.transform(apiModel, config));
for (PackageMetadataView view : metadataViews) {
CommonSnippetSetRunner runner = new CommonSnippetSetRunner(view, false);
results.putAll(runner.generate(view));
}
return results.build();
}
use of com.google.api.codegen.viewmodel.metadata.PackageMetadataView in project toolkit by googleapis.
the class JavaGrpcPackageGenerator method generate.
@Override
public Map<String, GeneratedResult<Doc>> generate() {
ImmutableMap.Builder<String, GeneratedResult<Doc>> results = new ImmutableMap.Builder<>();
ProtoApiModel apiModel = new ProtoApiModel(model);
List<PackageMetadataView> metadataViews = transformer.transform(apiModel, config);
for (PackageMetadataView view : metadataViews) {
CommonSnippetSetRunner runner = new CommonSnippetSetRunner(view, false);
results.putAll(runner.generate(view));
}
return results.build();
}
use of com.google.api.codegen.viewmodel.metadata.PackageMetadataView in project toolkit by googleapis.
the class PythonGrpcMetadataProvider method generate.
@Override
public Map<String, Doc> generate(Model model, PackageMetadataConfig config) throws IOException {
ImmutableMap.Builder<String, Doc> docs = new ImmutableMap.Builder<String, Doc>();
ArrayList<PackageMetadataView> metadataViews = new ArrayList<>();
PythonPackageCopier copier = new PythonPackageCopier();
PythonPackageCopierResult copierResult = copier.run(options, config);
docs.putAll(copierResult.docs());
PythonGrpcMetadataTransformer pythonTransformer = new PythonGrpcMetadataTransformer(copierResult);
ProtoApiModel apiModel = new ProtoApiModel(model);
metadataViews.addAll(pythonTransformer.transform(apiModel, config));
for (PackageMetadataView view : metadataViews) {
CommonSnippetSetRunner runner = new CommonSnippetSetRunner(view);
Doc result = runner.generate(view);
if (!result.isWhitespace()) {
docs.put(view.outputPath(), result);
}
}
return docs.build();
}
use of com.google.api.codegen.viewmodel.metadata.PackageMetadataView in project toolkit by googleapis.
the class PythonGrpcMetadataTransformer method transform.
public List<PackageMetadataView> transform(ApiModel model, PackageMetadataConfig config) {
ArrayList<PackageMetadataView> views = new ArrayList<>();
PythonSurfaceNamer surfaceNamer = new PythonSurfaceNamer(config.packageName(TargetLanguage.PYTHON));
PackageMetadataTransformer transformer = new PackageMetadataTransformer();
for (String snippetFilename : SNIPPETS) {
PackageMetadataView view = transformer.generateMetadataView(new PackageMetadataNamer(), config, model, snippetFilename, outputPath(snippetFilename), TargetLanguage.PYTHON, PROTO_PACKAGE_DEPENDENCY_WHITELIST).namespacePackages(copierResult.namespacePackages()).developmentStatus(surfaceNamer.getReleaseAnnotation(config.releaseLevel(TargetLanguage.PYTHON))).build();
views.add(view);
}
return views;
}
Aggregations