Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Generate themes before compiling the 'assets' crate

Max Brunsfeldef837232bc60
diff --git a/crates/assets/build.rs b/crates/assets/build.rs
new file mode 100644
index 00000000000..8500b246224
--- /dev/null
+++ b/crates/assets/build.rs
@@ -0,0 +1,29 @@
+use std::process::Command;
+
+fn main() {
+ let output = Command::new("npm")
+ .current_dir("../../styles")
+ .args(["install", "--no-save"])
+ .output()
+ .expect("failed to run npm");
+ if !output.status.success() {
+ panic!(
+ "failed to install theme dependencies {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ }
+
+ let output = Command::new("npm")
+ .current_dir("../../styles")
+ .args(["run", "build"])
+ .output()
+ .expect("failed to run npm");
+ if !output.status.success() {
+ panic!(
+ "build script failed {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ }
+
+ println!("cargo:rerun-if-changed=../../styles/src");
+}
diff --git a/crates/zed/build.rs b/crates/zed/build.rs
index 9caa7776db4..1f30e7ded2b 100644
--- a/crates/zed/build.rs
+++ b/crates/zed/build.rs
@@ -1,5 +1,3 @@
-use std::process::Command;
-
fn main() {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.15.7");
@@ -26,30 +24,4 @@ fn main() {
// Register exported Objective-C selectors, protocols, etc
println!("cargo:rustc-link-arg=-Wl,-ObjC");
-
- let output = Command::new("npm")
- .current_dir("../../styles")
- .args(["install", "--no-save"])
- .output()
- .expect("failed to run npm");
- if !output.status.success() {
- panic!(
- "failed to install theme dependencies {}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
-
- let output = Command::new("npm")
- .current_dir("../../styles")
- .args(["run", "build"])
- .output()
- .expect("failed to run npm");
- if !output.status.success() {
- panic!(
- "build script failed {}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
-
- println!("cargo:rerun-if-changed=../../styles/src");
}