blob: 9d87ca45d626559d05805f5bb61d52ca1053edf2 [file] [log] [blame]
Mårten Kongstad867a3492023-04-25 15:06:30 +02001/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//! `aconfig` is a build time tool to manage build time configurations, such as feature flags.
18
Mårten Kongstadbb520722023-04-26 13:16:41 +020019use anyhow::Result;
Mårten Kongstad867a3492023-04-25 15:06:30 +020020
Mårten Kongstadbb520722023-04-26 13:16:41 +020021mod aconfig;
Mårten Kongstadfe753f52023-04-26 09:13:03 +020022mod protos;
Mårten Kongstadfe753f52023-04-26 09:13:03 +020023
Mårten Kongstadbb520722023-04-26 13:16:41 +020024use aconfig::{Flag, Override};
Mårten Kongstad867a3492023-04-25 15:06:30 +020025
Mårten Kongstadbb520722023-04-26 13:16:41 +020026fn main() -> Result<()> {
27 let flag = Flag::try_from_text_proto(r#"id: "a" description: "description of a" value: true"#)?;
28 println!("{:?}", flag);
29 let flags = Flag::try_from_text_proto_list(
30 r#"flag { id: "a" description: "description of a" value: true }"#,
31 )?;
32 println!("{:?}", flags);
33 let override_ = Override::try_from_text_proto(r#"id: "foo" value: true"#)?;
34 println!("{:?}", override_);
35 let overrides = Override::try_from_text_proto_list(r#"override { id: "foo" value: true }"#)?;
36 println!("{:?}", overrides);
37 Ok(())
Mårten Kongstad867a3492023-04-25 15:06:30 +020038}