blob: d0090c6c0a144f9641b204c2533a4b283dfae9de [file] [log] [blame]
// Copyright 2023 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
};
use clap::Parser;
use serde::Deserialize;
use std::fs;
mod aliases;
#[derive(Debug, Parser)]
struct Args {
#[arg(long, required(true))]
config: PathBuf,
}
#[derive(Deserialize)]
pub struct Config {
manifests: HashSet<String>,
bazel_aliases: HashMap<String, Mapping>,
}
#[derive(Deserialize)]
struct Mapping {
constraint: String,
path: String,
}
fn main() {
let args = Args::parse();
let config_str = fs::read_to_string(args.config).expect("config file exists");
let config: Config = toml::from_str(&config_str).expect("config file parses");
aliases::generate(&config);
}