Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial FFI crate + Java bindings #2516

Merged
merged 16 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ jobs:
# For now, we only run Miri against known "fiddly" crates.
if: false
- name: Run Miri
run: cargo miri nextest run --no-fail-fast -p vortex-buffer
run: cargo miri nextest run --no-fail-fast -p vortex-buffer -p vortex-ffi

generated-files:
name: "Check generated proto/fbs files are up to date"
Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
"vortex-dtype",
"vortex-error",
"vortex-expr",
"vortex-ffi",
"vortex-file",
"vortex-flatbuffers",
"vortex-io",
Expand Down Expand Up @@ -176,6 +177,7 @@ vortex-dtype = { version = "0.25.2", path = "./vortex-dtype", default-features =
vortex-error = { version = "0.25.2", path = "./vortex-error" }
vortex-expr = { version = "0.25.2", path = "./vortex-expr" }
vortex-fastlanes = { version = "0.25.2", path = "./encodings/fastlanes" }
vortex-ffi = { version = "0.25.2", path = "./vortex-ffi" }
vortex-file = { version = "0.25.2", path = "./vortex-file", default-features = false }
vortex-flatbuffers = { version = "0.25.2", path = "./vortex-flatbuffers" }
vortex-fsst = { version = "0.25.2", path = "./encodings/fsst" }
Expand Down
12 changes: 12 additions & 0 deletions java/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

8 changes: 8 additions & 0 deletions java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# generated source directories
generated_src/
17 changes: 17 additions & 0 deletions java/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Java Bindings Development

Install a JDK 17 toolchain.

You can run tests like

```
./gradlew test
```

You can build a JAR file with

```
./gradlew jar
```

The JAR files will contain platform native code from `vortex-ffi` to operate on Vortex data.
90 changes: 90 additions & 0 deletions java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import net.ltgt.gradle.errorprone.errorprone

plugins {
id("com.diffplug.spotless") version "7.0.1"
id("com.palantir.consistent-versions") version "2.31.0"
id("com.palantir.git-version") version "3.1.0"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("net.ltgt.errorprone") version "4.1.0" apply false
id("org.inferred.processors") version "3.7.0" apply false
}

val gitVersion: groovy.lang.Closure<String> by extra
version = gitVersion()

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("MAVEN_CENTRAL_USER"))
password.set(System.getenv("MAVEN_CENTRAL_PASSWORD"))
}
}
}

allprojects {
apply(plugin = "com.diffplug.spotless")

group = "dev.vortex"
version = rootProject.version

repositories {
mavenCentral()
}

tasks.withType<Test> {
useJUnitPlatform()

maxHeapSize = "1G"

testLogging {
events("passed")
}
}

plugins.withType<JavaLibraryPlugin> {
apply(plugin = "net.ltgt.errorprone")
apply(plugin = "org.inferred.processors")

dependencies {
"errorprone"("com.google.errorprone:error_prone_core")
"errorprone"("com.jakewharton.nopen:nopen-checker")
"compileOnly"("com.jakewharton.nopen:nopen-annotations")
}

spotless {
java {
palantirJavaFormat()
licenseHeaderFile("${rootProject.projectDir}/.spotless/java-license-header.txt")
}
}

tasks.withType<JavaCompile> {
options.errorprone.disable("UnusedVariable")
options.release = 11

// Needed to make sure that the barista-annotations emits to the correct directory
options.generatedSourceOutputDirectory = projectDir.resolve("generated_src")
}

tasks.withType<Javadoc> {
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:-missing")
}

the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AMAZON)
}

tasks["check"].dependsOn("spotlessCheck")
}

spotless {
kotlinGradle {
ktlint()
}
}

tasks.register("format").get().dependsOn("spotlessApply")
}
10 changes: 10 additions & 0 deletions java/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#org.gradle.configuration-cache=true
org.gradle.parallel=true
org.gradle.caching=true

# extra JVM args needed to allow Spotless to access JDK private classes.
org.gradle.jvmargs =--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
12 changes: 12 additions & 0 deletions java/gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ff8d269e2495c538cfa04b4b52d22286/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/4dfe7aab2abf71db71537e9dca36c154/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ff8d269e2495c538cfa04b4b52d22286/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4dfe7aab2abf71db71537e9dca36c154/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9a7f49eb8ed1ea9722ebec95f4befa0e/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/2a0209399b0a7928a6e5fc680e1c0d35/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ff8d269e2495c538cfa04b4b52d22286/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4dfe7aab2abf71db71537e9dca36c154/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7a3c43a8ed30b293ba959c80ccf2a757/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/a5678544b69a5c533a76c11213c7b7ed/redirect
toolchainVersion=17
Binary file added java/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading