/kcl-java

KCL Java SDK

Primary LanguageJavaApache License 2.0Apache-2.0

KCL Java SDK

Synchronized from the repo: https://github.com/kcl-lang/lib/tree/main/java

Installation

Refer to this to configure your Maven; set up your GitHub account and Token in the settings.xml.

Maven

In your project's pom.xml, configure our repository as follows:

<repositories>
    <repository>
        <id>github</id>
        <url>https://maven.pkg.github.com/kcl-lang/*</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

This way you'll be able to import the above dependency to use the SDK.

<dependency>
    <groupId>com.kcl</groupId>
    <artifactId>kcl-lib</artifactId>
    <version>0.8.6</version>
</dependency>

Write the code

import com.kcl.api.API;
import com.kcl.api.Spec.ExecProgram_Args;
import com.kcl.api.Spec.ExecProgram_Result;

public class ExecProgramTest {
    public static void main(String[] args) throws Exception {
        API api = new API();
        ExecProgram_Result result = api
                .execProgram(ExecProgram_Args.newBuilder().addKFilenameList("path/to/kcl.k").build());
        System.out.println(result.getYamlResult());
    }
}

Developing

  • Install Java 8+
  • Install cargo and Python (for Rust code building)
pnpm install

Building

make build

Testing

make test

Format

make fmt