From 5ae97362b4acdffb7468ea72586f4cfe280ea53e Mon Sep 17 00:00:00 2001 From: SpontanCombust <61706594+SpontanCombust@users.noreply.github.com> Date: Sat, 27 Jan 2024 20:00:54 +0100 Subject: [PATCH] refactor --- .github/workflows/draft-release.yml | 5 +---- xtask/src/cli.rs | 4 +++- xtask/src/commands/package.rs | 4 ++-- xtask/src/main.rs | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 258b3445..10f6b5d0 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -32,11 +32,8 @@ jobs: target: ${{ matrix.target }} override: true - - name: Build with Cargo - run: cargo build --release --workspace --target=${{ matrix.target }} - - name: Pack the client - run: cargo xtask package . + run: cargo xtask package --out-dir . - name: Create draft release uses: ncipollo/release-action@v1 diff --git a/xtask/src/cli.rs b/xtask/src/cli.rs index e9edff5b..d4e3ae98 100644 --- a/xtask/src/cli.rs +++ b/xtask/src/cli.rs @@ -17,7 +17,9 @@ pub enum Commands { CopyLspRelease, /// Build and package VSCode extension into a .vsix file Package { - output_dir: Option + /// Output directory for the .vsix file; default is the current working directory + #[arg(long)] + out_dir: Option }, /// Build, package and install the VSCode extension Install diff --git a/xtask/src/commands/package.rs b/xtask/src/commands/package.rs index 88e0bf4e..ee4d3318 100644 --- a/xtask/src/commands/package.rs +++ b/xtask/src/commands/package.rs @@ -8,11 +8,11 @@ const LSP_DST: &str = "./editors/vscode/server/bin"; const EXT_DIR: &str = "./editors/vscode"; const VSIX_NAME: &str = "witcherscript-ide.vsix"; -pub fn package(output_dir: Option) -> anyhow::Result<()> { +pub fn package(out_dir: Option) -> anyhow::Result<()> { let sh = Shell::new()?; // normalize the output path so it stays valid when we change cwd - let output_dir = if let Some(output_dir) = output_dir { + let output_dir = if let Some(output_dir) = out_dir { Some(PathBuf::from(&output_dir).canonicalize()?) } else { None diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 02b4cd80..d0e37f09 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -11,7 +11,7 @@ fn main() -> anyhow::Result<()> { match cli.command { cli::Commands::CopyLsp => commands::copy_lsp(), cli::Commands::CopyLspRelease => commands::copy_lsp_release(), - cli::Commands::Package { output_dir } => commands::package(output_dir), + cli::Commands::Package { out_dir } => commands::package(out_dir), cli::Commands::Install => commands::install() } } \ No newline at end of file