Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 28 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,32 @@ This repository contains two approaches to Swift/Java interoperability.
- Swift library (`SwiftJava`) and bindings generator that allows a Swift program to make use of Java libraries by wrapping Java classes in corresponding Swift types, allowing Swift to directly call any wrapped Java API.
- The `swift-java` tool which offers automated ways to import or "extract" bindings to sources or libraries in either language. The results are bindings for Swift or Java.

## :construction: Early Development :construction:
## Dependencies

### Required JDK versions

Note that this project consists of multiple modules which currently have different Swift and Java runtime requirements.

You'll need to install the necessary JDK version locally. On macOS for example, you can install the JDK with [homebrew](https://brew.sh) using:

```bash
$ brew install openjdk
# and create a symlink into /Library/Java/JavaVirtualMachines
$ sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

**:construction: This project is in early development, please keep this in mind as you try out the project and do provide feedback about any issues you encounter. :construction:**
# or if you have a distribution as cask it will be installed into /Library/Java/JavaVirtualMachines
$ brew install --cask corretto
```

There is no guarantee about API stability of this package, neither in the Java or Swift parts, until the project releases a stable 1.0 release; APIs may change without prior notice.
Alternatively, you can use a JDK manager like [sdkman](https://sdkman.io/install/) and set your `JAVA_HOME` environment variable:

```bash
$ export JAVA_HOME="$(sdk home java current)"
```

### :construction: Self-publish support Java libraries (SwiftKit)
## Self-publish supporting Java libraries

While we work out how to provide the necessary support libraries for the Java side of Java code generated by `swift-java jextract`,
you will currently need to publish them locally and depend on them this way;
Swift-java relies on supporting libraries that are under active development and not yet published to Maven Central. To use the project, you'll need to self-publish these libraries locally so your Java project can depend on them.

To publish the libraries to your local maven repository (`$HOME/.m2`), you can run:

Expand All @@ -34,29 +50,6 @@ repositories {

We anticipate simplifying this in the future.

## Dependencies

### Required JDK versions

This project consists of different modules which have different Swift and Java runtime requirements.

On macOS for example, you can install the JDK with [homebrew](https://brew.sh) using

```bash
$ brew install openjdk
# and create a symlink into /Library/Java/JavaVirtualMachines
$ sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

# or if you have a distribution as cask it will be installed into /Library/Java/JavaVirtualMachines
$ brew install --cask corretto
```

or you can use a JDK manager like [sdkman](https://sdkman.io/install/) and set your `JAVA_HOME` environment variable

```bash
$ export JAVA_HOME="$(sdk home java current)"
```

## SwiftJava macros

SwiftJava is a Swift library offering macros which simplify writing JNI code "by hand" but also calling Java code from Swift.
Expand Down Expand Up @@ -231,3 +224,9 @@ xcrun docc preview Sources/SwiftJavaDocumentation/Documentation.docc
# Monitoring /Users/ktoso/code/swift-java/Sources/SwiftJavaDocumentation/Documentation.docc for changes...

```

## Project Status

**This project is under active development. We welcome feedback about any issues you encounter.**

There is no guarantee about API stability until the project reaches a 1.0 release.
Loading