Skip to content

Commit f00e53d

Browse files
kotlin jar update
1 parent 50d3096 commit f00e53d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

language/kotlin/kotlin.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,24 @@ func Run(files []string, stdin string) (string, string, error, string) {
1010
workDir := filepath.Dir(files[0])
1111
fname := filepath.Base(files[0])
1212

13+
// need to include junit into classpath env variable along with any other .jar files
14+
// https://github.com/junit-team/junit4/wiki/Getting-started
15+
jarFileIncludes := "/usr/local/bin/JUNIT/junit-4.13.2.jar:/usr/local/bin/JUNIT/hamcrest-core-1.3.jar:/usr/local/bin/JUNIT/gson-2.10.1.jar:/usr/local/bin/JUNIT/okio-1.9.0.jar:/usr/local/bin/JUNIT/okhttp-3.9.1.jar:/usr/local/bin/JUNIT/approvaltests-4.1.jar:."
16+
1317
// files we need to compile
1418
// https://discuss.kotlinlang.org/t/kotlinc-example-with-separate-files/3389/4
15-
compileCommand := []string{"kotlinc", "-progressive", "-no-reflect"}
19+
compileCommand := []string{"kotlinc", "-progressive", "-no-reflect", "-cp", jarFileIncludes}
1620
for i := 0; i < len(files); i++ {
1721
compileCommand = append(compileCommand, strings.ReplaceAll(files[i], workDir + "/", ""))
1822
}
1923

2024
stdout, stderr, err, duration := cmd.Run(workDir, compileCommand...)
2125

22-
// remove java warning
23-
stderr = strings.Replace(stderr, "Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.\n", "", -1)
24-
2526
if err != nil || stderr != "" {
2627
return stdout, stderr, err, duration
2728
}
2829

29-
return cmd.RunStdin(workDir, stdin, "kotlin", className(fname))
30+
return cmd.RunStdin(workDir, stdin, "kotlin", "-cp", jarFileIncludes, className(fname))
3031
}
3132

3233
func className(fname string) string {

0 commit comments

Comments
 (0)