-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xtask: add
prep-lsp
command to replace copy-lsp
and `copy-lsp-rel…
…ease`
- Loading branch information
1 parent
5ae9736
commit bf5dfc8
Showing
6 changed files
with
54 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
mod copy_lsp; | ||
mod copy_lsp_release; | ||
mod prep_lsp; | ||
mod package; | ||
mod install; | ||
|
||
pub use copy_lsp::copy_lsp; | ||
pub use copy_lsp_release::copy_lsp_release; | ||
pub use prep_lsp::prep_lsp; | ||
pub use package::package; | ||
pub use install::install; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::path::PathBuf; | ||
use xshell::{Shell, cmd}; | ||
|
||
|
||
const LSP_DST: &str = "./editors/vscode/server/bin"; | ||
|
||
pub fn prep_lsp(release: bool, target: Option<String>) -> anyhow::Result<()> { | ||
let sh = Shell::new()?; | ||
|
||
let mut build = cmd!(sh, "cargo build --package witcherscript-lsp"); | ||
|
||
let mut lsp_src = PathBuf::from("./target"); | ||
if let Some(target) = target { | ||
build = build.arg("--target").arg(&target); | ||
lsp_src.push(target); | ||
} | ||
|
||
if release { | ||
build = build.arg("--release"); | ||
lsp_src.push("release"); | ||
} else { | ||
lsp_src.push("debug"); | ||
} | ||
|
||
lsp_src.push("witcherscript-lsp"); | ||
|
||
if cfg!(windows) { | ||
lsp_src.set_extension("exe"); | ||
} | ||
|
||
println!("Building the LSP..."); | ||
build.run()?; | ||
|
||
|
||
// make sure destination folder exists | ||
sh.create_dir(LSP_DST)?; | ||
|
||
sh.copy_file(lsp_src, LSP_DST)?; | ||
println!("Copied LSP into {}", LSP_DST); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters