Skip to content
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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ jobs:

steps:
- uses: actions/checkout@v3

- uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 20
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 20

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Tests
run: ./gradlew check
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish

on:
workflow_dispatch:
inputs:
forceVersion:
description: 'Force version'
required: true
default: ''

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 20
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 20

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Release
if: github.ref == 'refs/heads/main'
id: release
run: |
./gradlew release \
-Prelease.customPassword=${{ github.token }} \
-Prelease.customUsername=${{ github.actor }} \
-Prelease.forceVersion=${{ github.event.inputs.forceVersion }}
echo "released_version=`./gradlew -q cV -Prelease.quiet`" >> $GITHUB_OUTPUT

- name: Publish to Maven Central
run: ./gradlew build publish
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}

- name: Create GitHub Release
if: github.ref == 'refs/heads/main'
run: gh release create "${{ steps.release.outputs.released_version }}" --generate-notes
env:
GH_TOKEN: ${{ github.token }}
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# simdjson-java
simdjson-java
=============
![Build Status](https://github.com/simdjson/simdjson-java/actions/workflows/ci.yml/badge.svg)
[![](https://maven-badges.herokuapp.com/maven-central/org.simdjson/simdjson-java/badge.svg)](https://central.sonatype.com/search?namespace=org.simdjson)
[![](https://img.shields.io/badge/License-Apache%202-blue.svg)](LICENSE)

A Java version of [simdjson](https://github.com/simdjson/simdjson) - a JSON parser using SIMD instructions,
based on the paper [Parsing Gigabytes of JSON per Second](https://arxiv.org/abs/1902.08318)
Expand All @@ -16,7 +20,7 @@ This implementation is still missing several features available in simdsjon. For
byte[] json = loadTwitterJson();

SimdJsonParser parser = new SimdJsonParser();
JsonValue jsonValue = simdJsonParser.parse(json, json.length);
JsonValue jsonValue = parser.parse(json, json.length);
Iterator<JsonValue> tweets = jsonValue.get("statuses").arrayIterator();
while (tweets.hasNext()) {
JsonValue tweet = tweets.next();
Expand All @@ -27,6 +31,28 @@ while (tweets.hasNext()) {
}
```

## Installation

The library is available in the [Maven Central Repository](https://mvnrepository.com/artifact/org.simdjson/simdjson-java).
To include it in your project, add the following dependency to the `build.gradle` file:
```groovy
implementation("org.simdjson:simdjson-java:0.1.0")
```

or to the `pom.xml` file:
```xml
<dependency>
<groupId>org.simdjson</groupId>
<artifactId>simdjson-java</artifactId>
<version>0.1.0</version>
</dependency>
```

Please remember about specifying the desired version.

Note that simdjson-java follows the [SemVer specification](https://semver.org/), which means, for example, that a major
version of zero indicates initial development, so the library's API should not be considered stable.

## Benchmarks

To run the JMH benchmarks, execute the following command:
Expand Down
72 changes: 71 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import me.champeau.jmh.JmhBytecodeGeneratorTask
import org.gradle.internal.os.OperatingSystem
import org.ajoberstar.grgit.Grgit
import java.time.Duration

plugins {
id 'java'
id 'scala'
id 'me.champeau.jmh' version '0.7.1'
id 'org.ajoberstar.grgit' version '5.2.0'
id 'pl.allegro.tech.build.axion-release' version '1.15.4'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id 'maven-publish'
id 'signing'
}

group = 'org.simdjson'
version = '0.0.1-SNAPSHOT'
version = scmVersion.version

scmVersion {
versionCreator('versionWithBranch')
}

repositories {
mavenCentral()
Expand All @@ -20,6 +29,8 @@ java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
}
withJavadocJar()
withSourcesJar()
}

ext {
Expand Down Expand Up @@ -105,6 +116,65 @@ jmh {
}
}

publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = project.name
description = 'A Java version of simdjson, a high-performance JSON parser utilizing SIMD instructions.'
url = 'https://github.com/simdjson/simdjson-java'
issueManagement {
system = 'GitHub Issue Tracking'
url = 'https://github.com/simdjson/simdjson-java/issues'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'piotrrzysko'
name = 'Piotr Rżysko'
email = 'piotr.rzysko@gmail.com'
}
}
scm {
url = 'https://github.com/simdjson/simdjson-java'
connection = 'scm:git@github.com:simdjson/simdjson-java.git'
developerConnection = 'scm:git@github.com:simdjson/simdjson-java.git'
}
}
}
}
}

if (System.getenv('GPG_KEY_ID')) {
signing {
useInMemoryPgpKeys(
System.getenv('GPG_KEY_ID'),
System.getenv('GPG_PRIVATE_KEY'),
System.getenv('GPG_PRIVATE_KEY_PASSWORD')
)
sign publishing.publications.mavenJava
}
}

nexusPublishing {
repositories {
sonatype {
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
snapshotRepositoryUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')
stagingProfileId = '3c0bbfe420699e'
username = System.getenv('SONATYPE_USERNAME')
password = System.getenv('SONATYPE_PASSWORD')
}
}
connectTimeout = Duration.ofMinutes(3)
clientTimeout = Duration.ofMinutes(3)
}

def getBooleanProperty(String name, boolean defaultValue) {
Boolean.valueOf((project.findProperty(name) ?: defaultValue) as String)
}
Expand Down