aconfig: move CodegenMode to codegen crate

This change moves CodegenMode to codegen crate.

Bug: 311152507
Test: ateset aconfig.test
Change-Id: I4f64cdbdc3d1b419412012560bfe03344b2b8faf
This commit is contained in:
Zhi Dou
2023-12-19 18:59:26 +00:00
parent 0f1b9da4d9
commit dcfa0400c9
6 changed files with 26 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ pub mod java;
pub mod rust;
use anyhow::{ensure, Result};
use clap::ValueEnum;
pub fn is_valid_name_ident(s: &str) -> bool {
// Identifiers must match [a-z][a-z0-9_]*, except consecutive underscores are not allowed
@@ -52,6 +53,13 @@ pub fn create_device_config_ident(package: &str, flag_name: &str) -> Result<Stri
Ok(format!("{}.{}", package, flag_name))
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, ValueEnum)]
pub enum CodegenMode {
Production,
Test,
Exported,
}
#[cfg(test)]
mod tests {
use super::*;