From 94fb9ad6b3167e8b8073a09fcf0cb135f383d3d2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 15:33:31 +0100 Subject: Fix extension name --- .github/workflows/release.yaml | 11 +++++------ editors/code/package.json | 2 +- xtask/src/install.rs | 18 +++++------------- xtask/src/not_bash.rs | 30 +++--------------------------- 4 files changed, 14 insertions(+), 47 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4584a271f..d6d5dba95 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -93,7 +93,7 @@ jobs: working-directory: ./editors/code - name: Copy vscode extension - run: mkdir -p ./dist/code && cp ./editors/code/*.vsix ./dist/ + run: mkdir -p ./dist/code && cp ./editors/code/rust-analyzer.vsix ./dist/ - name: Upload artifacts uses: actions/upload-artifact@v1 @@ -112,8 +112,7 @@ jobs: node-version: 12.x - run: echo "::set-env name=TAG::$(date --iso)" - - run: echo "::set-env name=EXT_VERSION::0.1.$(date +%Y%m%d)" - - run: 'echo "TAG: $TAG EXT_VERSION: $EXT_VERSION"' + - run: 'echo "TAG: $TAG"' - name: Checkout repository uses: actions/checkout@v1 @@ -181,8 +180,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/rust-analyzer-${{ env.EXT_VERSION }}.vsix - asset_name: rust-analyzer-${{ env.EXT_VERSION }}.vsix + asset_path: ./dist/rust-analyzer.vsix + asset_name: rust-analyzer.vsix asset_content_type: application/octet-stream - run: npm ci @@ -191,4 +190,4 @@ jobs: - name: Publish Extension working-directory: ./editors/code # token from https://dev.azure.com/rust-analyzer/ - run: npx vsce publish $EXT_VERSION --pat ${{ secrets.MARKETPLACE_TOKEN }} + run: npx vsce publish 0.1.$(date +%Y%m%d) --pat ${{ secrets.MARKETPLACE_TOKEN }} diff --git a/editors/code/package.json b/editors/code/package.json index 8f24a13f5..d54b1750a 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -20,7 +20,7 @@ }, "scripts": { "vscode:prepublish": "tsc && rollup -c", - "package": "vsce package", + "package": "vsce package -o rust-analyzer.vsix", "watch": "tsc --watch", "fmt": "tsfmt -r && tslint -p tsconfig.json -c tslint.json 'src/**/*.ts' --fix" }, diff --git a/xtask/src/install.rs b/xtask/src/install.rs index 00bbabce4..91426377f 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs @@ -4,7 +4,7 @@ use std::{env, path::PathBuf, str}; use anyhow::{bail, format_err, Context, Result}; -use crate::not_bash::{ls, pushd, rm, run}; +use crate::not_bash::{pushd, run}; // Latest stable, feel free to send a PR if this lags behind. const REQUIRED_RUST_VERSION: u32 = 41; @@ -99,28 +99,20 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> { run!("npm --version").context("`npm` is required to build the VS Code plugin")?; run!("npm install")?; - let vsix_pkg = { - rm("*.vsix")?; - run!("npm run package --scripts-prepend-node-path")?; - ls("*.vsix")?.pop().unwrap() - }; + run!("npm run package --scripts-prepend-node-path")?; let code = find_code(|bin| run!("{} --version", bin).is_ok())?; - run!("{} --install-extension {} --force", code, vsix_pkg.display())?; + run!("{} --install-extension rust-analyzer.vsix --force", code)?; installed_extensions = run!("{} --list-extensions", code; echo = false)?; } else { run!("cmd.exe /c npm --version") .context("`npm` is required to build the VS Code plugin")?; run!("cmd.exe /c npm install")?; - let vsix_pkg = { - rm("*.vsix")?; - run!("cmd.exe /c npm run package")?; - ls("*.vsix")?.pop().unwrap() - }; + run!("cmd.exe /c npm run package")?; let code = find_code(|bin| run!("cmd.exe /c {}.cmd --version", bin).is_ok())?; - run!(r"cmd.exe /c {}.cmd --install-extension {} --force", code, vsix_pkg.display())?; + run!(r"cmd.exe /c {}.cmd --install-extension rust-analyzer.vsix --force", code)?; installed_extensions = run!("cmd.exe /c {}.cmd --list-extensions", code; echo = false)?; } diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs index 3e30e7279..d5577cce9 100644 --- a/xtask/src/not_bash.rs +++ b/xtask/src/not_bash.rs @@ -2,8 +2,6 @@ use std::{ cell::RefCell, env, - ffi::OsStr, - fs, path::{Path, PathBuf}, process::{Command, Stdio}, }; @@ -68,14 +66,11 @@ impl Drop for Pushd { } } -pub fn rm(glob: &str) -> Result<()> { - let cwd = Env::with(|env| env.cwd()); - ls(glob)?.into_iter().try_for_each(|it| fs::remove_file(cwd.join(it)))?; - Ok(()) -} - pub fn rm_rf(path: impl AsRef) -> Result<()> { let path = path.as_ref(); + if !path.exists() { + return Ok(()); + } if path.is_file() { fs2::remove_file(path) } else { @@ -83,25 +78,6 @@ pub fn rm_rf(path: impl AsRef) -> Result<()> { } } -pub fn ls(glob: &str) -> Result> { - let cwd = Env::with(|env| env.cwd()); - let mut res = Vec::new(); - for entry in fs::read_dir(&cwd)? { - let entry = entry?; - if matches(&entry.file_name(), glob) { - let path = entry.path(); - let path = path.strip_prefix(&cwd).unwrap(); - res.push(path.to_path_buf()) - } - } - return Ok(res); - - fn matches(file_name: &OsStr, glob: &str) -> bool { - assert!(glob.starts_with('*')); - file_name.to_string_lossy().ends_with(&glob[1..]) - } -} - #[doc(hidden)] pub fn run_process(cmd: String, echo: bool) -> Result { run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd)) -- cgit v1.2.3