mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Fix extension name
This commit is contained in:
parent
13d793929a
commit
94fb9ad6b3
4 changed files with 14 additions and 47 deletions
11
.github/workflows/release.yaml
vendored
11
.github/workflows/release.yaml
vendored
|
@ -93,7 +93,7 @@ jobs:
|
||||||
working-directory: ./editors/code
|
working-directory: ./editors/code
|
||||||
|
|
||||||
- name: Copy vscode extension
|
- 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
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
|
@ -112,8 +112,7 @@ jobs:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
|
||||||
- run: echo "::set-env name=TAG::$(date --iso)"
|
- 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"'
|
||||||
- run: 'echo "TAG: $TAG EXT_VERSION: $EXT_VERSION"'
|
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
@ -181,8 +180,8 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ./dist/rust-analyzer-${{ env.EXT_VERSION }}.vsix
|
asset_path: ./dist/rust-analyzer.vsix
|
||||||
asset_name: rust-analyzer-${{ env.EXT_VERSION }}.vsix
|
asset_name: rust-analyzer.vsix
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
@ -191,4 +190,4 @@ jobs:
|
||||||
- name: Publish Extension
|
- name: Publish Extension
|
||||||
working-directory: ./editors/code
|
working-directory: ./editors/code
|
||||||
# token from https://dev.azure.com/rust-analyzer/
|
# 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 }}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "tsc && rollup -c",
|
"vscode:prepublish": "tsc && rollup -c",
|
||||||
"package": "vsce package",
|
"package": "vsce package -o rust-analyzer.vsix",
|
||||||
"watch": "tsc --watch",
|
"watch": "tsc --watch",
|
||||||
"fmt": "tsfmt -r && tslint -p tsconfig.json -c tslint.json 'src/**/*.ts' --fix"
|
"fmt": "tsfmt -r && tslint -p tsconfig.json -c tslint.json 'src/**/*.ts' --fix"
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::{env, path::PathBuf, str};
|
||||||
|
|
||||||
use anyhow::{bail, format_err, Context, Result};
|
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.
|
// Latest stable, feel free to send a PR if this lags behind.
|
||||||
const REQUIRED_RUST_VERSION: u32 = 41;
|
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 --version").context("`npm` is required to build the VS Code plugin")?;
|
||||||
run!("npm install")?;
|
run!("npm install")?;
|
||||||
|
|
||||||
let vsix_pkg = {
|
|
||||||
rm("*.vsix")?;
|
|
||||||
run!("npm run package --scripts-prepend-node-path")?;
|
run!("npm run package --scripts-prepend-node-path")?;
|
||||||
ls("*.vsix")?.pop().unwrap()
|
|
||||||
};
|
|
||||||
|
|
||||||
let code = find_code(|bin| run!("{} --version", bin).is_ok())?;
|
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)?;
|
installed_extensions = run!("{} --list-extensions", code; echo = false)?;
|
||||||
} else {
|
} else {
|
||||||
run!("cmd.exe /c npm --version")
|
run!("cmd.exe /c npm --version")
|
||||||
.context("`npm` is required to build the VS Code plugin")?;
|
.context("`npm` is required to build the VS Code plugin")?;
|
||||||
run!("cmd.exe /c npm install")?;
|
run!("cmd.exe /c npm install")?;
|
||||||
|
|
||||||
let vsix_pkg = {
|
|
||||||
rm("*.vsix")?;
|
|
||||||
run!("cmd.exe /c npm run package")?;
|
run!("cmd.exe /c npm run package")?;
|
||||||
ls("*.vsix")?.pop().unwrap()
|
|
||||||
};
|
|
||||||
|
|
||||||
let code = find_code(|bin| run!("cmd.exe /c {}.cmd --version", bin).is_ok())?;
|
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)?;
|
installed_extensions = run!("cmd.exe /c {}.cmd --list-extensions", code; echo = false)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
env,
|
env,
|
||||||
ffi::OsStr,
|
|
||||||
fs,
|
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::{Command, Stdio},
|
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<()> {
|
pub fn rm_rf(path: impl AsRef<Path>) -> Result<()> {
|
||||||
let path = path.as_ref();
|
let path = path.as_ref();
|
||||||
|
if !path.exists() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
if path.is_file() {
|
if path.is_file() {
|
||||||
fs2::remove_file(path)
|
fs2::remove_file(path)
|
||||||
} else {
|
} 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)]
|
#[doc(hidden)]
|
||||||
pub fn run_process(cmd: String, echo: bool) -> Result<String> {
|
pub fn run_process(cmd: String, echo: bool) -> Result<String> {
|
||||||
run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd))
|
run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd))
|
||||||
|
|
Loading…
Reference in a new issue