Fix extension name

This commit is contained in:
Aleksey Kladov 2020-02-17 15:33:31 +01:00
parent 13d793929a
commit 94fb9ad6b3
4 changed files with 14 additions and 47 deletions

View file

@ -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 }}

View file

@ -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"
},

View file

@ -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)?;
}

View file

@ -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))