main.rs 903 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. mod build_ebpf;
  2. mod build_test;
  3. mod codegen;
  4. mod docs;
  5. mod run;
  6. pub(crate) mod utils;
  7. use std::process::exit;
  8. use clap::Parser;
  9. #[derive(Parser)]
  10. pub struct XtaskOptions {
  11. #[clap(subcommand)]
  12. command: Command,
  13. }
  14. #[derive(Parser)]
  15. enum Command {
  16. Codegen(codegen::Options),
  17. Docs,
  18. BuildIntegrationTest(build_test::Options),
  19. BuildIntegrationTestEbpf(build_ebpf::BuildEbpfOptions),
  20. IntegrationTest(run::Options),
  21. }
  22. fn main() {
  23. let opts = XtaskOptions::parse();
  24. use Command::*;
  25. let ret = match opts.command {
  26. Codegen(opts) => codegen::codegen(opts),
  27. Docs => docs::docs(),
  28. BuildIntegrationTest(opts) => build_test::build_test(opts),
  29. BuildIntegrationTestEbpf(opts) => build_ebpf::build_ebpf(opts),
  30. IntegrationTest(opts) => run::run(opts),
  31. };
  32. if let Err(e) = ret {
  33. eprintln!("{e:#}");
  34. exit(1);
  35. }
  36. }