Merge "Drive instrumentation with build flag" into main
This commit is contained in:
@@ -202,7 +202,11 @@ pub fn create_java_lib(mut input: Input, codegen_mode: CodegenMode) -> Result<Ve
|
|||||||
generate_java_code(&package, modified_parsed_flags.into_iter(), codegen_mode)
|
generate_java_code(&package, modified_parsed_flags.into_iter(), codegen_mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_cpp_lib(mut input: Input, codegen_mode: CodegenMode) -> Result<Vec<OutputFile>> {
|
pub fn create_cpp_lib(
|
||||||
|
mut input: Input,
|
||||||
|
codegen_mode: CodegenMode,
|
||||||
|
allow_instrumentation: bool,
|
||||||
|
) -> Result<Vec<OutputFile>> {
|
||||||
// TODO(327420679): Enable export mode for native flag library
|
// TODO(327420679): Enable export mode for native flag library
|
||||||
ensure!(
|
ensure!(
|
||||||
codegen_mode != CodegenMode::Exported,
|
codegen_mode != CodegenMode::Exported,
|
||||||
@@ -215,7 +219,13 @@ pub fn create_cpp_lib(mut input: Input, codegen_mode: CodegenMode) -> Result<Vec
|
|||||||
};
|
};
|
||||||
let package = package.to_string();
|
let package = package.to_string();
|
||||||
let flag_ids = assign_flag_ids(&package, modified_parsed_flags.iter())?;
|
let flag_ids = assign_flag_ids(&package, modified_parsed_flags.iter())?;
|
||||||
generate_cpp_code(&package, modified_parsed_flags.into_iter(), codegen_mode, flag_ids, false)
|
generate_cpp_code(
|
||||||
|
&package,
|
||||||
|
modified_parsed_flags.into_iter(),
|
||||||
|
codegen_mode,
|
||||||
|
flag_ids,
|
||||||
|
allow_instrumentation,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_rust_lib(mut input: Input, codegen_mode: CodegenMode) -> Result<OutputFile> {
|
pub fn create_rust_lib(mut input: Input, codegen_mode: CodegenMode) -> Result<OutputFile> {
|
||||||
|
@@ -83,6 +83,12 @@ fn cli() -> Command {
|
|||||||
.long("mode")
|
.long("mode")
|
||||||
.value_parser(EnumValueParser::<CodegenMode>::new())
|
.value_parser(EnumValueParser::<CodegenMode>::new())
|
||||||
.default_value("production"),
|
.default_value("production"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("allow-instrumentation")
|
||||||
|
.long("allow-instrumentation")
|
||||||
|
.value_parser(clap::value_parser!(bool))
|
||||||
|
.default_value("false"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
@@ -241,8 +247,10 @@ fn main() -> Result<()> {
|
|||||||
Some(("create-cpp-lib", sub_matches)) => {
|
Some(("create-cpp-lib", sub_matches)) => {
|
||||||
let cache = open_single_file(sub_matches, "cache")?;
|
let cache = open_single_file(sub_matches, "cache")?;
|
||||||
let mode = get_required_arg::<CodegenMode>(sub_matches, "mode")?;
|
let mode = get_required_arg::<CodegenMode>(sub_matches, "mode")?;
|
||||||
let generated_files =
|
let allow_instrumentation =
|
||||||
commands::create_cpp_lib(cache, *mode).context("failed to create cpp lib")?;
|
get_required_arg::<bool>(sub_matches, "allow-instrumentation")?;
|
||||||
|
let generated_files = commands::create_cpp_lib(cache, *mode, *allow_instrumentation)
|
||||||
|
.context("failed to create cpp lib")?;
|
||||||
let dir = PathBuf::from(get_required_arg::<String>(sub_matches, "out")?);
|
let dir = PathBuf::from(get_required_arg::<String>(sub_matches, "out")?);
|
||||||
generated_files
|
generated_files
|
||||||
.iter()
|
.iter()
|
||||||
|
Reference in New Issue
Block a user