Skip to content

Commit

Permalink
Merge pull request #247 from calcit-lang/force-build
Browse files Browse the repository at this point in the history
add force build; handle cjk displaying
  • Loading branch information
csvwolf authored Jun 27, 2024
2 parents 9b9f080 + a4f4d56 commit 7dae7b4
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 13 deletions.
31 changes: 28 additions & 3 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "calcit"
version = "0.8.58"
version = "0.8.59"
authors = ["jiyinyiyong <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -20,7 +20,7 @@ exclude = [
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cirru_edn = "0.6.10"
cirru_edn = "0.6.11"
# cirru_edn = { path = "/Users/chenyong/repo/cirru/edn.rs" }
cirru_parser = "0.1.31"
# cirru_parser = { path = "/Users/chenyong/repo/cirru/parser.rs" }
Expand Down
2 changes: 2 additions & 0 deletions calcit/test-string.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
assert= (str-spaced nil nil |c 12) "|c 12"
assert= (str-spaced |a nil |c 12 nil) "|a c 12"
assert= (str 1 2 3) |123
assert= "|(:: :a |世界 \"|海 洋\")"
str $ :: :a |世界 "|海 洋"
assert=
type-of $ &str 1
, :string
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@calcit/procs",
"version": "0.8.58",
"version": "0.8.59",
"main": "./lib/calcit.procs.mjs",
"devDependencies": {
"@types/node": "^20.11.28",
Expand Down
19 changes: 15 additions & 4 deletions src/bin/calcit_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ fn handle_path(modules_dir: PathBuf, version: Arc<str>, options: CliArgs, org_an
// split with / into (org,folder)

let folder_path = modules_dir.join(folder);
let build_file = folder_path.join("build.sh");
if folder_path.exists() {
// println!("module {} exists", folder);
// check branch
Expand All @@ -150,6 +151,13 @@ fn handle_path(modules_dir: PathBuf, version: Arc<str>, options: CliArgs, org_an
dim_println(format!("↺ pulling {} at version {}", gray(&org_and_folder), gray(&version)));
git_pull(&folder_path, &branch)?;
dim_println(format!("pulled {} at {}", gray(folder), gray(&version)));

// if there's a build.sh file in the folder, run it
if build_file.exists() {
let build_msg = call_build_script(&folder_path)?;
dim_println(format!("ran build script for {}", gray(&org_and_folder)));
dim_println(build_msg);
}
}
}
return Ok(());
Expand Down Expand Up @@ -177,7 +185,6 @@ fn handle_path(modules_dir: PathBuf, version: Arc<str>, options: CliArgs, org_an
}
}

let build_file = folder_path.join("build.sh");
// if there's a build.sh file in the folder, run it
if build_file.exists() {
let build_msg = call_build_script(&folder_path)?;
Expand All @@ -196,7 +203,6 @@ fn handle_path(modules_dir: PathBuf, version: Arc<str>, options: CliArgs, org_an
dim_println(format!("downloaded {} at version {}", gray(&org_and_folder), gray(&version)));

if !options.ci {
let build_file = folder_path.join("build.sh");
// if there's a build.sh file in the folder, run it
if build_file.exists() {
let build_msg = call_build_script(&folder_path)?;
Expand Down Expand Up @@ -265,8 +271,13 @@ fn gray(msg: &str) -> ColoredString {
}

fn indent4(msg: &str) -> String {
let ret = msg.lines().map(|line| format!(" {}", line)).collect::<Vec<String>>().join("\n");
format!("\n{}\n", ret.trim())
let ret = msg
.trim()
.lines()
.map(|line| format!(" {}", line))
.collect::<Vec<String>>()
.join("\n");
format!("\n{}\n", ret)
}

/// calcit dynamic libs uses a `build.sh` script to build Rust `.so` files
Expand Down
13 changes: 11 additions & 2 deletions src/calcit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,16 @@ impl fmt::Display for Calcit {
if is_simple_str(s) {
write!(f, "|{s}")
} else {
write!(f, "\"|{}\"", s.escape_default())
// write!(f, "\"|{}\"", s.escape_default())
write!(f, "\"|")?;
for c in s.chars() {
if cirru_edn::is_simple_char(c) {
write!(f, "{}", c)?;
} else {
write!(f, "{}", c.escape_default())?;
}
}
write!(f, "\"")
}
} // TODO, escaping choices
Calcit::Thunk(thunk) => match thunk {
Expand Down Expand Up @@ -281,7 +290,7 @@ impl fmt::Display for Calcit {

fn is_simple_str(tok: &str) -> bool {
for c in tok.chars() {
if !matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '?' | '!' | '|') {
if !cirru_edn::is_simple_char(c) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ts-src/js-tuple.mts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class CalcitTuple {
if (i > 0) {
content += " ";
}
content += toString(args[i], false, disableJsDataWarning);
content += toString(args[i], true, disableJsDataWarning);
}
if (this.klass instanceof CalcitRecord) {
return `(%:: ${content} (:class ${this.klass.name.value}))`;
Expand Down

0 comments on commit 7dae7b4

Please sign in to comment.