Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SpontanCombust committed Jan 27, 2024
1 parent d0ebea6 commit 5ae9736
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion xtask/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ pub enum Commands {
CopyLspRelease,
/// Build and package VSCode extension into a .vsix file
Package {
output_dir: Option<String>
/// Output directory for the .vsix file; default is the current working directory
#[arg(long)]
out_dir: Option<String>
},
/// Build, package and install the VSCode extension
Install
Expand Down
4 changes: 2 additions & 2 deletions xtask/src/commands/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>) -> anyhow::Result<()> {
pub fn package(out_dir: Option<String>) -> 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
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

0 comments on commit 5ae9736

Please sign in to comment.