Remove taskchampion source from this repo (#3427)

* move taskchampion-lib to src/tc/lib, remove the rest
* update references to taskchampion
* Use a top-level Cargo.toml so everything is consistent
* apply comments from ryneeverett
This commit is contained in:
Dustin J. Mitchell
2024-05-01 22:45:11 -04:00
committed by GitHub
parent ef9613e2d6
commit 94b3e301d1
157 changed files with 62 additions and 16265 deletions

35
xtask/src/main.rs Normal file
View File

@@ -0,0 +1,35 @@
//! This executable defines the `cargo xtask` subcommands.
//!
//! At the moment it is very simple, but if this grows more subcommands then
//! it will be sensible to use `clap` or another similar library.
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
pub fn main() -> anyhow::Result<()> {
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
let workspace_dir = manifest_dir.parent().unwrap();
let arguments: Vec<String> = env::args().collect();
if arguments.len() < 2 {
anyhow::bail!("xtask: Valid arguments are: `codegen`");
}
match arguments[1].as_str() {
"codegen" => codegen(workspace_dir),
_ => anyhow::bail!("xtask: unknown xtask"),
}
}
/// `cargo xtask codegen`
///
/// This uses ffizz-header to generate `lib/taskchampion.h`.
fn codegen(workspace_dir: &Path) -> anyhow::Result<()> {
let lib_crate_dir = workspace_dir.join("src/tc/lib");
let mut file = File::create(lib_crate_dir.join("taskchampion.h")).unwrap();
write!(&mut file, "{}", ::taskchampion_lib::generate_header()).unwrap();
Ok(())
}