in initializer-generator/src/main/java/org/apache/dubbo/initializer/generation/extension/codes/sample/ProtoBufCodeContributor.java [85:117]
public void contribute(Path projectRoot) throws IOException {
Language language = description.getLanguage();
Map<String, String> params = new HashMap<>();
params.put(BootstrapTemplateRenderConstants.KEY_APP_SHOTNAME, description.getName());
params.put(BootstrapTemplateRenderConstants.KEY_APPLICATION_NAME, description.getApplicationName());
params.put(BootstrapTemplateRenderConstants.KEY_BASE_PACKAGE, description.getPackageName());
params.put(BootstrapTemplateRenderConstants.KEY_SPRINGBOOT_VERSION, description.getPlatformVersion().toString());
params.put(BootstrapTemplateRenderConstants.KEY_JAVA_VERSION, description.getLanguage().jvmVersion());
params.put(KEY_ARTIFACT_ID, description.getArtifactId());
params.put(BootstrapTemplateRenderConstants.KEY_MODULE, module.getName());
params.put(BootstrapTemplateRenderConstants.KEY_BASE_VERSION, description.getVersion());
SourceStructure structure = description.getBuildSystem().getMainSource(projectRoot, language);
Architecture architecture = description.getArchitecture();
Map<Dependency, String> dependencyRepoUris = getRepos(description);
List<String> uris = new ArrayList<>();
dependencyRepoUris.values().forEach(uri -> {
uris.add(uri);
uris.add(uri + "/" + architecture.getId() + "/" + module.getName());
});
uris.forEach(uri -> {
CodeTemplateRepo repo = loader.load(uri);
RepoRenderResult result = renderer.render(repo, params);
// write protobuf file
List<RepoRenderResult.TemplateRenderResult> codes = result.getResults(language.id());
codes.forEach(res -> writeCode(res, language, projectRoot, structure));
});
}