Skip to content

Commit

Permalink
Use xtask for theme generation
Browse files Browse the repository at this point in the history
  • Loading branch information
osiewicz committed Jun 21, 2023
1 parent 6e4439b commit 9aa7a50
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --"
99 changes: 96 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ members = [
"crates/vim",
"crates/workspace",
"crates/welcome",
"crates/xtask",
"crates/zed",
]
default-members = ["crates/zed"]
Expand Down
14 changes: 0 additions & 14 deletions crates/theme/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,17 +1082,3 @@ pub struct Style {
pub border: Color,
pub foreground: Color,
}

#[cfg(test)]
mod tests {
use super::*;
use schemars::schema_for;

#[test]
fn export_schema() {
let theme = schema_for!(Theme);
let output = serde_json::to_string_pretty(&theme).unwrap();
std::fs::create_dir("schemas").ok();
std::fs::write("schemas/theme.json", output).ok();
}
}
12 changes: 12 additions & 0 deletions crates/xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "xtask"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = "4.0"
theme = {path = "../theme"}
serde_json.workspace = true
schemars.workspace = true
Empty file added crates/xtask/src/cli.rs
Empty file.
11 changes: 11 additions & 0 deletions crates/xtask/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
mod cli;

use schemars::schema_for;

use theme::Theme;
fn main() {
let theme = schema_for!(Theme);
let output = serde_json::to_string_pretty(&theme).unwrap();
std::fs::create_dir("schemas").ok();
std::fs::write("schemas/theme.json", output).ok();
}

0 comments on commit 9aa7a50

Please sign in to comment.