about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release.yaml11
-rw-r--r--editors/code/package.json2
-rw-r--r--xtask/src/install.rs18
-rw-r--r--xtask/src/not_bash.rs30
4 files changed, 14 insertions, 47 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 4584a271f01..d6d5dba95e6 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 8f24a13f54c..d54b1750a40 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 00bbabce431..91426377fec 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 3e30e7279ff..d5577cce923 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<Path>) -> 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<Path>) -> Result<()> {
     }
 }
 
-pub fn ls(glob: &str) -> Result<Vec<PathBuf>> {
-    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<String> {
     run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd))