in crate_universe/src/renderer.rs [182:277]
fn new_tera() -> Tera {
let mut internal_renderer = Tera::new("src/not/a/dir/*").unwrap();
internal_renderer.register_function(
"crate_to_repo_rule_name",
|args: &HashMap<String, tera::Value>| {
let value = config::crate_to_repo_rule_name(
string_arg(args, "repo_rule_name")?,
string_arg(args, "package_name")?,
string_arg(args, "package_version")?,
);
Ok(tera::Value::String(value))
},
);
internal_renderer.register_function(
"crate_to_label",
|args: &HashMap<String, tera::Value>| {
let value = config::crate_to_label(
string_arg(args, "repo_rule_name")?,
string_arg(args, "package_name")?,
string_arg(args, "package_version")?,
);
Ok(tera::Value::String(value))
},
);
internal_renderer
.add_raw_templates(vec![
(
"templates/defs.bzl.template",
include_str!("templates/defs.bzl.template"),
),
(
"templates/helper_functions.template",
include_str!("templates/helper_functions.template"),
),
(
"templates/partials/build_script.template",
include_str!("templates/partials/build_script.template"),
),
(
"templates/partials/rust_binary.template",
include_str!("templates/partials/rust_binary.template"),
),
(
"templates/partials/rust_library.template",
include_str!("templates/partials/rust_library.template"),
),
(
"templates/partials/common_attrs.template",
include_str!("templates/partials/common_attrs.template"),
),
(
"templates/BUILD.crate.bazel.template",
include_str!("templates/BUILD.crate.bazel.template"),
),
(
"templates/partials/targeted_aliases.template",
include_str!("templates/partials/targeted_aliases.template"),
),
(
"templates/partials/targeted_dependencies.template",
include_str!("templates/partials/targeted_dependencies.template"),
),
(
"templates/partials/targeted_data_dependencies.template",
include_str!("templates/partials/targeted_data_dependencies.template"),
),
(
"templates/partials/targeted_build_script_dependencies.template",
include_str!("templates/partials/targeted_build_script_dependencies.template"),
),
(
"templates/partials/targeted_build_script_data_dependencies.template",
include_str!(
"templates/partials/targeted_build_script_data_dependencies.template"
),
),
(
"templates/partials/default_data_dependencies.template",
include_str!("templates/partials/default_data_dependencies.template"),
),
(
"templates/partials/git_repository.template",
include_str!("templates/partials/git_repository.template"),
),
(
"templates/partials/http_archive.template",
include_str!("templates/partials/http_archive.template"),
),
])
.unwrap();
internal_renderer
}