File tree Expand file tree Collapse file tree 4 files changed +27
-11
lines changed
Expand file tree Collapse file tree 4 files changed +27
-11
lines changed Original file line number Diff line number Diff line change 9090 java/target/classes/native
9191
9292 build-centos7 :
93- runs-on : ubuntu-latest
94- container :
95- image : " kcllang/kcl-java-builder-centos7:0.1.0"
93+ runs-on : ubuntu-20.04
9694
9795 permissions :
9896 contents : read
@@ -128,10 +126,13 @@ jobs:
128126 name : kcl-lib-osx-aarch_64
129127 path : java/native
130128
131- - name : Package Java artifact
132- working-directory : java
129+ - name : Run tests and package in CentOS 7 container
133130 run : |
134- rustup default stable && mvn package -DskipTests=true -Dcargo-build.profile=release
131+ docker run --rm -v ${{ github.workspace }}/java:/work kcllang/kcl-java-builder-centos7:0.1.0 bash -c "
132+ cd /work &&
133+ rustup default stable &&
134+ mvn package -DskipTests=true -Dcargo-build.profile=release
135+ "
135136
136137 - name : Upload artifact
137138 uses : actions/upload-artifact@v3
Original file line number Diff line number Diff line change @@ -18,6 +18,6 @@ serde = { version = "1", features = ["derive"] }
1818once_cell = " 1.19.0"
1919lazy_static = " 1.4.0"
2020
21- kclvm-parser = { git = " https://github.com/kcl-lang/kcl" , version = " 0.10.8 " }
22- kclvm-sema = { git = " https://github.com/kcl-lang/kcl" , version = " 0.10.8 " }
23- kclvm-api = { git = " https://github.com/kcl-lang/kcl" , version = " 0.10.8 " }
21+ kclvm-parser = { git = " https://github.com/kcl-lang/kcl" , version = " 0.11.0-alpha.1 " }
22+ kclvm-sema = { git = " https://github.com/kcl-lang/kcl" , version = " 0.11.0-alpha.1 " }
23+ kclvm-api = { git = " https://github.com/kcl-lang/kcl" , version = " 0.11.0-alpha.1 " }
Original file line number Diff line number Diff line change 55import java .io .InputStream ;
66import java .io .UncheckedIOException ;
77import java .util .Map ;
8+ import java .nio .charset .StandardCharsets ;
89import java .nio .file .Files ;
910import java .nio .file .StandardCopyOption ;
1011
@@ -651,15 +652,17 @@ public GetVersion_Result getVersion(GetVersion_Args args) throws Exception {
651652 private byte [] call (String name , byte [] args ) throws Exception {
652653 byte [] result = callNative (name .getBytes (), args );
653654 if (result != null && startsWith (result , ERROR_PREFIX )) {
654- throw new java .lang .Error (result .toString ().substring (ERROR_PREFIX .length ()).trim ());
655+ String resultString = new String (result , StandardCharsets .UTF_8 );
656+ throw new Exception (resultString .substring (ERROR_PREFIX .length ()).trim ());
655657 }
656658 return result ;
657659 }
658660
659661 private byte [] callLoadPackageWithCache (byte [] args ) throws Exception {
660662 byte [] result = loadPackageWithCache (args );
661663 if (result != null && startsWith (result , ERROR_PREFIX )) {
662- throw new java .lang .Error (result .toString ().substring (ERROR_PREFIX .length ()).trim ());
664+ String resultString = new String (result , StandardCharsets .UTF_8 );
665+ throw new Exception (resultString .substring (ERROR_PREFIX .length ()).trim ());
663666 }
664667 return result ;
665668 }
Original file line number Diff line number Diff line change @@ -19,4 +19,16 @@ public void testExecProgramApi() throws Exception {
1919 ExecProgram_Result result = apiInstance .execProgram (args );
2020 Assert .assertEquals (result .getYamlResult (), "app:\n " + " replicas: 2" );
2121 }
22+
23+ @ Test
24+ public void testExecProgramApiInvalid () {
25+ try {
26+ ExecProgram_Args args = ExecProgram_Args .newBuilder ().build ();
27+
28+ API apiInstance = new API ();
29+ apiInstance .execProgram (args );
30+ } catch (Exception e ) {
31+ Assert .assertEquals (e .getMessage (), "No input KCL files or paths" );
32+ }
33+ }
2234}
You can’t perform that action at this time.
0 commit comments