File tree 4 files changed +27
-11
lines changed
4 files changed +27
-11
lines changed Original file line number Diff line number Diff line change 90
90
java/target/classes/native
91
91
92
92
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
96
94
97
95
permissions :
98
96
contents : read
@@ -128,10 +126,13 @@ jobs:
128
126
name : kcl-lib-osx-aarch_64
129
127
path : java/native
130
128
131
- - name : Package Java artifact
132
- working-directory : java
129
+ - name : Run tests and package in CentOS 7 container
133
130
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
+ "
135
136
136
137
- name : Upload artifact
137
138
uses : actions/upload-artifact@v3
Original file line number Diff line number Diff line change @@ -18,6 +18,6 @@ serde = { version = "1", features = ["derive"] }
18
18
once_cell = " 1.19.0"
19
19
lazy_static = " 1.4.0"
20
20
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 5
5
import java .io .InputStream ;
6
6
import java .io .UncheckedIOException ;
7
7
import java .util .Map ;
8
+ import java .nio .charset .StandardCharsets ;
8
9
import java .nio .file .Files ;
9
10
import java .nio .file .StandardCopyOption ;
10
11
@@ -651,15 +652,17 @@ public GetVersion_Result getVersion(GetVersion_Args args) throws Exception {
651
652
private byte [] call (String name , byte [] args ) throws Exception {
652
653
byte [] result = callNative (name .getBytes (), args );
653
654
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 ());
655
657
}
656
658
return result ;
657
659
}
658
660
659
661
private byte [] callLoadPackageWithCache (byte [] args ) throws Exception {
660
662
byte [] result = loadPackageWithCache (args );
661
663
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 ());
663
666
}
664
667
return result ;
665
668
}
Original file line number Diff line number Diff line change @@ -19,4 +19,16 @@ public void testExecProgramApi() throws Exception {
19
19
ExecProgram_Result result = apiInstance .execProgram (args );
20
20
Assert .assertEquals (result .getYamlResult (), "app:\n " + " replicas: 2" );
21
21
}
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
+ }
22
34
}
You can’t perform that action at this time.
0 commit comments