Skip to content

Commit 3ed460d

Browse files
authored
Merge pull request #52 from kcl-lang/release-084
chore: bump kcl lib to 0.8.4
2 parents 588082b + d92166d commit 3ed460d

File tree

26 files changed

+2959
-1985
lines changed

26 files changed

+2959
-1985
lines changed

Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kcl-lang"
3-
version = "0.8.3"
3+
version = "0.8.4"
44
edition = "2021"
55
readme = "README.md"
66
documentation = "kcl-lang.io"
@@ -10,10 +10,5 @@ license = "Apache-2.0"
1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1111

1212
[dependencies]
13-
prost = "0.11.8"
14-
prost-types = "0.11.8"
15-
serde_json = "1"
1613
anyhow = "1"
17-
serde = { version = "1", features = ["derive"] }
18-
libloading = "0.7.3"
19-
tempfile = "3.5.0"
14+
kclvm-api = { git = "https://github.com/kcl-lang/kcl", version = "0.8.4" }

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# KCL Artifact Library for SDKs
2-
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Flib.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Flib?ref=badge_shield)
3-
42

53
This repo mainly includes the binding of the low-level API and spec of the [KCL language core](https://github.com/kcl-lang/kcl), and the SDKs of various languages are based on this to encapsulate higher-level APIs.
64

75
## Rust
86

97
```shell
10-
cargo add --git https://github.com/kcl-lang/lib kcl-lang
8+
cargo add --git https://github.com/kcl-lang/lib
119
```
1210

1311
Write the Code
@@ -17,7 +15,7 @@ use kcl_lang::*;
1715
use anyhow::Result;
1816

1917
fn main() -> Result<()> {
20-
let api = API::new()?;
18+
let api = API::default();
2119
let args = &ExecProgramArgs {
2220
k_filename_list: vec!["main.k".to_string()],
2321
k_code_list: vec!["a = 1".to_string()],
@@ -71,6 +69,6 @@ result = api.exec_program(args)
7169
print(result.yaml_result)
7270
```
7371

74-
7572
## License
76-
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Flib.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Flib?ref=badge_large)
73+
74+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Flib.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Flib?ref=badge_large)

install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"runtime"
99
)
1010

11-
const KCLVM_VERSION = "v0.8.3"
11+
const KCLVM_VERSION = "v0.8.4"
1212

1313
func findPath(name string) string {
1414
if path, err := exec.LookPath(name); err == nil {

java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.kcl</groupId>
88
<artifactId>kcl-lib</artifactId>
9-
<version>0.8.3</version>
9+
<version>0.8.4</version>
1010
<name>KCL Arifact Library for Java</name>
1111
<description>
1212
KCL is an open-source constraint-based record and functional language mainly

java/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use anyhow::Result;
1212
use jni::objects::{JByteArray, JClass, JObject};
1313
use jni::sys::jbyteArray;
1414
use jni::JNIEnv;
15-
use kcl_lang::API;
15+
use kcl_lang::call;
1616
use kclvm_api::gpyrpc::LoadPackageArgs;
1717
use kclvm_api::service::KclvmServiceImpl;
1818
use kclvm_parser::KCLModuleCache;
@@ -23,7 +23,6 @@ use prost::Message;
2323
use std::sync::Mutex;
2424

2525
lazy_static! {
26-
static ref API_INSTANCE: Mutex<OnceCell<API>> = Mutex::new(OnceCell::new());
2726
static ref MODULE_CACHE: Mutex<OnceCell<KCLModuleCache>> = Mutex::new(OnceCell::new());
2827
static ref SCOPE_CACHE: Mutex<OnceCell<KCLScopeCache>> = Mutex::new(OnceCell::new());
2928
}
@@ -54,11 +53,9 @@ pub extern "system" fn Java_com_kcl_api_API_loadPackageWithCache(
5453
}
5554

5655
fn intern_call_native(env: &mut JNIEnv, name: JByteArray, args: JByteArray) -> Result<jbyteArray> {
57-
let binding = API_INSTANCE.lock().unwrap();
58-
let api = binding.get_or_init(|| kcl_lang::API::new().expect("Failed to create API instance"));
5956
let name = env.convert_byte_array(name)?;
6057
let args = env.convert_byte_array(args)?;
61-
let result = api.call_native(&name, &args)?;
58+
let result = call(&name, &args)?;
6259
let j_byte_array = env.byte_array_from_slice(&result)?;
6360
Ok(j_byte_array.into_raw())
6461
}

0 commit comments

Comments
 (0)