├── .gitmodules ├── library ├── src │ ├── main │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── kotlin │ │ └── org │ │ └── rocksdb │ │ └── RocksDBBasicTest.kt ├── proguard-rules.pro ├── CMakeLists.txt └── build.gradle.kts ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── settings.gradle ├── snappy ├── CMakeLists.txt ├── build.gradle.kts └── downloadSnappy.sh ├── .gitignore ├── lz4 ├── downloadLz4.sh ├── CMakeLists.txt └── build.gradle.kts ├── gradle.properties ├── README.md ├── bz2 ├── downloadBz2.sh ├── CMakeLists.txt └── build.gradle.kts ├── zstd ├── downloadZstd.sh └── build.gradle.kts ├── gradlew.bat ├── gradlew └── LICENSE /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "rocksdb"] 2 | path = rocksdb 3 | url=git@github.com:marykdb/rocksdb.git 4 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marykdb/rocksdb-android/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':bz2' 2 | include ':lz4' 3 | include ':snappy' 4 | include ':zstd' 5 | include ':library' 6 | rootProject.name='rocksdb-android' 7 | -------------------------------------------------------------------------------- /snappy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.10) 2 | 3 | add_subdirectory(snappy-1.2.1 snappy) 4 | 5 | file(COPY ${CMAKE_BINARY_DIR}/snappy/snappy-stubs-public.h DESTINATION ${CMAKE_SOURCE_DIR}/include) 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | library/build 16 | lz4/lz4 17 | lz4/build 18 | /snappy/snappy-*/ 19 | /snappy/*.tar.gz 20 | /snappy/build/ 21 | /snappy/include/ 22 | /bz2/bzip2-*/ 23 | /bz2/build/ 24 | /zstd/zstd-*/ 25 | /zstd/build/ 26 | -------------------------------------------------------------------------------- /lz4/downloadLz4.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | LZ4_TARGET_DIRECTORY="lz4" 4 | LZ4_VERSION=$1 5 | 6 | if [ ! -d "${LZ4_TARGET_DIRECTORY}/lz4-${LZ4_VERSION}" ]; then 7 | echo "Downloading lz4 ${LZ4_VERSION} into $LZ4_TARGET_DIRECTORY ..." 8 | mkdir -p "$LZ4_TARGET_DIRECTORY" 9 | curl -s -L "https://github.com/lz4/lz4/archive/refs/tags/v${LZ4_VERSION}.tar.gz" | tar -C "$LZ4_TARGET_DIRECTORY" -xz 10 | else 11 | echo "lz4 ${LZ4_VERSION} has already been downloaded!" 12 | fi 13 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | kotlin.code.style=official 11 | 12 | android.useAndroidX=true -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /lz4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(LZ4 C) 2 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library") 3 | include(CPack) 4 | 5 | cmake_minimum_required (VERSION 3.10) 6 | INCLUDE (CheckTypeSize) 7 | check_type_size("void *" SIZEOF_VOID_P) 8 | IF(${SIZEOF_VOID_P} STREQUAL "8") 9 | set (CMAKE_SYSTEM_PROCESSOR "64bit") 10 | MESSAGE(STATUS "64 bit architecture detected, size of void * is " ${SIZEOF_VOID_P}) 11 | ENDIF() 12 | 13 | IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") 14 | SET(GNU_COMPATIBLE_COMPILER 1) 15 | ENDIF() 16 | 17 | if(GNU_COMPATIBLE_COMPILER) 18 | if(UNIX AND BUILD_LIBS) 19 | add_definitions(-fPIC) 20 | endif() 21 | endif() 22 | 23 | set(LZ4_SRCS_LIB ${LZ4_PATH}lz4.c ${LZ4_PATH}lz4hc.c ${LZ4_PATH}lz4.h ${LZ4_PATH}lz4hc.h ${LZ4_PATH}lz4frame.c ${LZ4_PATH}lz4frame.h ${LZ4_PATH}xxhash.c) 24 | 25 | add_library(liblz4 SHARED ${LZ4_SRCS_LIB}) 26 | 27 | set_target_properties(liblz4 PROPERTIES 28 | OUTPUT_NAME lz4 29 | SOVERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}" 30 | ) 31 | 32 | INCLUDE_DIRECTORIES (${LZ4_PATH}) 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0) 2 | [![Download](https://img.shields.io/maven-central/v/io.maryk.rocksdb/rocksdb-android)](https://central.sonatype.com/artifact/io.maryk.rocksdb/rocksdb-android) 3 | 4 | # RocksDB for Android 5 | 6 | RocksDB is a high-performance key-value database developed and maintained by Facebook. This library provides an Android-compatible version of RocksDB, which exposes the same Java interface as the 7 | regular RocksDB Java release. 8 | 9 | ## Getting Started 10 | 11 | To use RocksDB in your Android project, add the following dependency to your build.gradle file: 12 | 13 | Gradle: 14 | ```kts 15 | implementation("io.maryk.rocksdb:rocksdb-android:10.4.2") 16 | ``` 17 | 18 | ## Reference 19 | * [RocksJava Basics](https://github.com/facebook/rocksdb/wiki/RocksJava-Basics) 20 | * [API](https://github.com/facebook/rocksdb/tree/master/java/src/main/java/org/rocksdb) 21 | 22 | ## License 23 | 24 | This project is licensed under the Apache License, Version 2.0 - see the [LICENSE file](LICENSE) for details. 25 | -------------------------------------------------------------------------------- /bz2/downloadBz2.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # downloadBz2.sh: Downloads bzip2 tarball and verifies its SHA checksum 4 | 5 | BZIP2_VERSION="$1" 6 | EXPECTED_SHA="$2" # Provide the expected SHA as the second argument 7 | 8 | if [ -z "$BZIP2_VERSION" ] || [ -z "$EXPECTED_SHA" ]; then 9 | echo "Usage: $0 " 10 | exit 1 11 | fi 12 | 13 | TARGET_DIR="bzip2-${BZIP2_VERSION}" 14 | 15 | if [ ! -d "${TARGET_DIR}" ]; then 16 | echo "Downloading bzip2 ${BZIP2_VERSION} ..." 17 | TMP_FILE=$(mktemp) 18 | URL="http://sourceware.org/pub/bzip2/bzip2-${BZIP2_VERSION}.tar.gz" 19 | curl -s -L "$URL" -o "$TMP_FILE" 20 | 21 | echo "Verifying bzip2-${BZIP2_VERSION}..." 22 | sha256_actual="$(shasum -a 256 "${TMP_FILE}" | awk '{print $1}')" 23 | if [[ "${EXPECTED_SHA}" != "${sha256_actual}" ]]; then 24 | echo "Error: tarball checksum mismatch!" >&2 25 | echo " expected: ${EXPECTED_SHA}" >&2 26 | echo " actual: ${sha256_actual}" >&2 27 | exit 1 28 | fi 29 | 30 | tar -C "./" -xzf "$TMP_FILE" 31 | rm "$TMP_FILE" 32 | echo "bzip2 ${BZIP2_VERSION} downloaded and extracted successfully!" 33 | else 34 | echo "bzip2 ${BZIP2_VERSION} has already been downloaded!" 35 | fi 36 | -------------------------------------------------------------------------------- /zstd/downloadZstd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # downloadZstd.sh: Downloads zstd tarball and verifies its SHA checksum 4 | 5 | ZSTD_VERSION="$1" 6 | EXPECTED_SHA="$2" # Provide the expected SHA as the second argument 7 | 8 | if [ -z "$ZSTD_VERSION" ] || [ -z "$EXPECTED_SHA" ]; then 9 | echo "Usage: $0 " 10 | exit 1 11 | fi 12 | 13 | TARGET_DIR="zstd-${ZSTD_VERSION}" 14 | 15 | if [ ! -d "${TARGET_DIR}" ]; then 16 | echo "Downloading zstd ${ZSTD_VERSION} ..." 17 | TMP_FILE=$(mktemp) 18 | URL="https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz" 19 | curl -s -L "$URL" -o "$TMP_FILE" 20 | 21 | echo "Verifying zstd-${ZSTD_VERSION}..." 22 | sha256_actual="$(shasum -a 256 "${TMP_FILE}" | awk '{print $1}')" 23 | if [[ "${EXPECTED_SHA}" != "${sha256_actual}" ]]; then 24 | echo "Error: tarball checksum mismatch!" >&2 25 | echo " expected: ${EXPECTED_SHA}" >&2 26 | echo " actual: ${sha256_actual}" >&2 27 | exit 1 28 | fi 29 | 30 | tar -C "./" -xzf "$TMP_FILE" 31 | rm "$TMP_FILE" 32 | echo "zstd ${ZSTD_VERSION} downloaded and extracted successfully!" 33 | else 34 | echo "zstd ${ZSTD_VERSION} has already been downloaded!" 35 | fi 36 | -------------------------------------------------------------------------------- /lz4/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | plugins { 4 | id("com.android.library") 5 | } 6 | 7 | val lz4Version = "1.10.0" 8 | 9 | group = "io.maryk.lz4" 10 | version = lz4Version 11 | 12 | val lz4Home = projectDir.resolve("lz4/lz4-$lz4Version") 13 | 14 | android { 15 | namespace = "lz4" 16 | compileSdk = 36 17 | defaultConfig { 18 | minSdk = 21 19 | externalNativeBuild { 20 | cmake { 21 | targets.add("liblz4") 22 | arguments.add("-DLZ4_PATH=${lz4Home.absolutePath}/lib/") 23 | } 24 | } 25 | } 26 | buildTypes { 27 | getByName("release") { 28 | isMinifyEnabled = false 29 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") 30 | } 31 | } 32 | externalNativeBuild { 33 | cmake { 34 | path = File("$projectDir/CMakeLists.txt") 35 | version = "3.31.3" 36 | } 37 | } 38 | } 39 | 40 | val downloadLz4 by tasks.creating(Exec::class) { 41 | workingDir = projectDir 42 | commandLine("./downloadLz4.sh", lz4Version) 43 | } 44 | 45 | tasks.withType { 46 | dependsOn(downloadLz4) 47 | } 48 | -------------------------------------------------------------------------------- /bz2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(bzip2_shared C) 3 | 4 | # If BZ2_PATH is defined, assume it points to the bzip2 lib folder. 5 | # The actual bzip2 source files are located in the parent directory of BZ2_PATH. 6 | if(DEFINED BZ2_PATH) 7 | set(BZIP2_ROOT ${BZ2_PATH}) 8 | else() 9 | set(BZIP2_ROOT ${CMAKE_SOURCE_DIR}) 10 | endif() 11 | 12 | message(STATUS "BZIP2_ROOT set to ${BZIP2_ROOT}") 13 | 14 | # List of source files relative to BZIP2_ROOT 15 | set(SOURCES 16 | ${BZIP2_ROOT}/blocksort.c 17 | ${BZIP2_ROOT}/huffman.c 18 | ${BZIP2_ROOT}/crctable.c 19 | ${BZIP2_ROOT}/randtable.c 20 | ${BZIP2_ROOT}/compress.c 21 | ${BZIP2_ROOT}/decompress.c 22 | ${BZIP2_ROOT}/bzlib.c 23 | ) 24 | 25 | # Create a shared library named 'bz2' (resulting in libbz2.so on Unix-like systems) 26 | add_library(bz2 SHARED ${SOURCES}) 27 | 28 | # Set compiler options matching the Makefile: 29 | target_compile_options(bz2 PRIVATE -Wall -Winline -O2 -g) 30 | target_compile_definitions(bz2 PRIVATE _FILE_OFFSET_BITS=64) 31 | 32 | # Set the output name to 'bz2' 33 | set_target_properties(bz2 PROPERTIES OUTPUT_NAME "bz2") 34 | 35 | # Installation rules (optional) 36 | install(TARGETS bz2 37 | LIBRARY DESTINATION lib 38 | ARCHIVE DESTINATION lib) 39 | -------------------------------------------------------------------------------- /bz2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | plugins { 4 | id("com.android.library") 5 | } 6 | 7 | val bz2Version = "1.0.8" 8 | val bz2Sha = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269" 9 | 10 | group = "io.maryk.bz2" 11 | version = bz2Version 12 | 13 | val bz2Home = projectDir.resolve("bzip2-$bz2Version") 14 | 15 | android { 16 | namespace = "bz2" 17 | compileSdk = 36 18 | defaultConfig { 19 | minSdk = 21 20 | externalNativeBuild { 21 | cmake { 22 | targets.add("bz2") 23 | arguments.add("-DBZ2_PATH=${bz2Home.absolutePath}") 24 | } 25 | } 26 | } 27 | buildTypes { 28 | getByName("release") { 29 | isMinifyEnabled = false 30 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") 31 | } 32 | } 33 | externalNativeBuild { 34 | cmake { 35 | path = File("$projectDir/CMakeLists.txt") 36 | version = "3.31.3" 37 | } 38 | } 39 | } 40 | 41 | val downloadBz2 by tasks.creating(Exec::class) { 42 | workingDir = projectDir 43 | commandLine("./downloadBz2.sh", bz2Version, bz2Sha) 44 | } 45 | 46 | tasks.withType { 47 | dependsOn(downloadBz2) 48 | } 49 | -------------------------------------------------------------------------------- /zstd/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | plugins { 4 | id("com.android.library") 5 | } 6 | 7 | val zstdVersion = "1.5.7" 8 | val zstdSha = "eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3" 9 | 10 | group = "io.maryk.zstd" 11 | version = zstdVersion 12 | 13 | val zstdHome = projectDir.resolve("zstd-$zstdVersion") 14 | 15 | android { 16 | namespace = "zstd" 17 | compileSdk = 36 18 | defaultConfig { 19 | minSdk = 21 20 | externalNativeBuild { 21 | cmake { 22 | targets.add("libzstd_shared") 23 | arguments.add("-DZSTD_BUILD_SHARED=ON") 24 | } 25 | } 26 | } 27 | buildTypes { 28 | getByName("release") { 29 | isMinifyEnabled = false 30 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") 31 | } 32 | } 33 | externalNativeBuild { 34 | cmake { 35 | path = File("$projectDir/zstd-${zstdVersion}/build/cmake/CMakeLists.txt") 36 | version = "3.31.3" 37 | } 38 | } 39 | } 40 | 41 | val downloadZstd by tasks.creating(Exec::class) { 42 | workingDir = projectDir 43 | commandLine("./downloadZstd.sh", zstdVersion, zstdSha) 44 | } 45 | 46 | tasks.withType { 47 | dependsOn(downloadZstd) 48 | } 49 | -------------------------------------------------------------------------------- /snappy/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | plugins { 4 | id("com.android.library") 5 | } 6 | 7 | group = "io.maryk.snappy" 8 | version = "1.2.1" 9 | 10 | android { 11 | namespace = "snappy" 12 | compileSdk = 36 13 | defaultConfig { 14 | minSdk = 21 15 | externalNativeBuild { 16 | cmake { 17 | targets.add("snappy") 18 | arguments.addAll(listOf( 19 | "-DSNAPPY_BUILD_BENCHMARKS=OFF", 20 | "-DBUILD_SHARED_LIBS=1", 21 | "-DSNAPPY_HAVE_NEON=OFF", 22 | "-DSNAPPY_BUILD_TESTS=OFF", 23 | "-Wno-dev", 24 | )) 25 | } 26 | } 27 | } 28 | buildTypes { 29 | getByName("release") { 30 | isMinifyEnabled = false 31 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") 32 | } 33 | } 34 | externalNativeBuild { 35 | cmake { 36 | path = File("CMakeLists.txt") 37 | version = "3.31.3" 38 | } 39 | } 40 | } 41 | 42 | val downloadSnappy by tasks.creating(Exec::class) { 43 | workingDir = projectDir 44 | commandLine("./downloadSnappy.sh", version) 45 | } 46 | 47 | tasks.withType { 48 | dependsOn(downloadSnappy) 49 | } 50 | -------------------------------------------------------------------------------- /snappy/downloadSnappy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | DEFAULT_SNAPPY_VER="1.2.1" 6 | DEFAULT_SNAPPY_SHA256="736aeb64d86566d2236ddffa2865ee5d7a82d26c9016b36218fcc27ea4f09f86" 7 | DEFAULT_SNAPPY_DOWNLOAD_BASE="https://github.com/google/snappy/archive" 8 | 9 | SNAPPY_VER="${SNAPPY_VER:-$DEFAULT_SNAPPY_VER}" 10 | SNAPPY_SHA256="${SNAPPY_SHA256:-$DEFAULT_SNAPPY_SHA256}" 11 | SNAPPY_DOWNLOAD_BASE="${SNAPPY_DOWNLOAD_BASE:-$DEFAULT_SNAPPY_DOWNLOAD_BASE}" 12 | 13 | tarball="${SNAPPY_VER}.tar.gz" 14 | target_path="snappy-${SNAPPY_VER}" 15 | 16 | if [ -d "${target_path}" ]; then 17 | echo "snappy ${SNAPPY_VER} has already been downloaded!" 18 | exit 0 19 | fi 20 | 21 | echo "Downloading snappy-${SNAPPY_VER}..." 22 | if curl --silent --fail --location -o "${tarball}" "${SNAPPY_DOWNLOAD_BASE}/${tarball}"; then 23 | echo "Verifying snappy-${SNAPPY_VER}..." 24 | sha256_actual="$(shasum -a 256 "${tarball}" | awk '{print $1}')" 25 | if [[ "${SNAPPY_SHA256}" != "${sha256_actual}" ]]; then 26 | echo "Error: ${tarball} checksum mismatch!" >&2 27 | echo " expected: ${SNAPPY_SHA256}" >&2 28 | echo " actual: ${sha256_actual}" >&2 29 | exit 1 30 | fi 31 | else 32 | echo "Error downloading snappy-${SNAPPY_VER}!" >&2 33 | exit 1 34 | fi 35 | 36 | tar xzf "${tarball}" -C "./" > /dev/null 37 | echo "snappy ${SNAPPY_VER} downloaded and extracted successfully!" 38 | -------------------------------------------------------------------------------- /library/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(RocksDBWithDependencies) 3 | 4 | set(lz4_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../lz4/lz4/lz4-1.10.0/lib") 5 | set(lz4_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../lz4/lz4/lz4-1.10.0") 6 | set(lz4_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../lz4/build/intermediates/library_and_local_jars_jni/release/copyReleaseJniLibsProjectAndLocalJars/jni/${ANDROID_ABI}/liblz4.so") 7 | 8 | set(Snappy_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../snappy/snappy-1.2.1") 9 | set(Snappy_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../snappy/snappy-1.2.1") 10 | set(Snappy_DIR "${Snappy_ROOT_DIR}") 11 | set(Snappy_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../snappy/build/intermediates/library_and_local_jars_jni/release/copyReleaseJniLibsProjectAndLocalJars/jni/${ANDROID_ABI}/libsnappy.so") 12 | 13 | set(BZIP2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../bz2/bzip2-1.0.8") 14 | set(BZIP2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../bz2/build/intermediates/library_and_local_jars_jni/release/copyReleaseJniLibsProjectAndLocalJars/jni/${ANDROID_ABI}/libbz2.so") 15 | 16 | set(ZSTD_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../zstd/zstd-1.5.7/lib") 17 | set(ZSTD_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../zstd/build/intermediates/library_and_local_jars_jni/release/copyReleaseJniLibsProjectAndLocalJars/jni/${ANDROID_ABI}/libzstd.so") 18 | 19 | include_directories(${lz4_ROOT_DIR}/lib) 20 | include_directories(${Snappy_ROOT_DIR}) 21 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../snappy/include) 22 | 23 | # Include the RocksDB project 24 | add_subdirectory(../rocksdb rocksdb-build) 25 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /library/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | plugins { 4 | id("com.android.library") 5 | id("kotlin-android") 6 | id("com.vanniktech.maven.publish") version "0.34.0" 7 | } 8 | 9 | group = "io.maryk.rocksdb" 10 | version = "10.4.2" 11 | 12 | android { 13 | namespace = "org.rocksdb" 14 | compileSdk = 36 15 | defaultConfig { 16 | minSdk = 21 17 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 18 | externalNativeBuild { 19 | cmake { 20 | arguments.addAll( 21 | arrayOf( 22 | "-DWITH_GFLAGS=NO", 23 | "-DCMAKE_SYSTEM_NAME=Android", 24 | "-DCMAKE_POSITION_INDEPENDENT_CODE=ON", 25 | "-DWITH_TESTS=OFF", 26 | "-DANDROID_STL=c++_shared", 27 | "-DPORTABLE=ON", 28 | "-DWITH_ZLIB=ON", 29 | "-DWITH_LZ4=ON", 30 | "-DWITH_ZSTD=ON", 31 | "-DWITH_SNAPPY=ON", 32 | "-DWITH_BZ2=ON", 33 | "-DWITH_TESTS=OFF", 34 | "-DWITH_TOOLS=OFF", 35 | "-DWITH_JNI=ON", 36 | "-Wno-error" 37 | ) 38 | ) 39 | targets.add("rocksdbjni") 40 | } 41 | } 42 | } 43 | buildTypes { 44 | getByName("release") { 45 | isMinifyEnabled = false 46 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") 47 | } 48 | } 49 | externalNativeBuild { 50 | cmake { 51 | path = File("$projectDir/CMakeLists.txt") 52 | version = "3.31.3" 53 | } 54 | } 55 | compileOptions { 56 | sourceCompatibility = JavaVersion.VERSION_1_8 57 | targetCompatibility = JavaVersion.VERSION_1_8 58 | } 59 | kotlinOptions { 60 | jvmTarget = "1.8" 61 | } 62 | sourceSets { 63 | this["main"].run { 64 | java.srcDirs("../rocksdb/java/src/main/java") 65 | } 66 | this["androidTest"].run { 67 | java.srcDirs("src/androidTest/kotlin") 68 | } 69 | } 70 | } 71 | 72 | dependencies { 73 | androidTestImplementation("androidx.test:runner:1.6.2") 74 | androidTestImplementation("androidx.test.ext:junit:1.2.1") 75 | } 76 | 77 | tasks.whenTaskAdded { 78 | if(name.startsWith("configureCMake")) { 79 | dependsOn(":lz4:copyReleaseJniLibsProjectAndLocalJars") 80 | dependsOn(":snappy:copyReleaseJniLibsProjectAndLocalJars") 81 | dependsOn(":bz2:copyReleaseJniLibsProjectAndLocalJars") 82 | dependsOn(":zstd:copyReleaseJniLibsProjectAndLocalJars") 83 | } 84 | } 85 | 86 | mavenPublishing { 87 | publishToMavenCentral() 88 | signAllPublications() 89 | } 90 | 91 | mavenPublishing { 92 | coordinates(artifactId = "rocksdb-android") 93 | 94 | pom { 95 | name.set("rocksdb-android") 96 | description.set("Android RocksDB library") 97 | inceptionYear.set("2019") 98 | url.set("https://github.com/marykdb/rocksdb-android") 99 | licenses { 100 | license { 101 | name.set("The Apache License, Version 2.0") 102 | url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") 103 | distribution.set("https://www.apache.org/licenses/LICENSE-2.0.txt") 104 | } 105 | } 106 | 107 | developers { 108 | developer { 109 | id.set("jurmous") 110 | name.set("Jurriaan Mous") 111 | url.set("https://github.com/jurmous/") 112 | } 113 | } 114 | 115 | scm { 116 | url.set("https://github.com/marykdb/rocksdb-android") 117 | connection.set("scm:git:git://github.com/marykdb/rocksdb-android.git") 118 | developerConnection.set("scm:git:ssh://git@github.com/marykdb/rocksdb-android.git") 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /library/src/androidTest/kotlin/org/rocksdb/RocksDBBasicTest.kt: -------------------------------------------------------------------------------- 1 | package org.rocksdb 2 | 3 | import androidx.test.ext.junit.runners.AndroidJUnit4 4 | import org.junit.Assert.assertEquals 5 | import org.junit.Test 6 | import org.junit.runner.RunWith 7 | import java.nio.file.Files 8 | 9 | @ExperimentalStdlibApi 10 | @RunWith(AndroidJUnit4::class) 11 | class RocksDBBasicTest { 12 | @Test 13 | fun openDBWriteAndReadValue() { 14 | val dir = Files.createTempDirectory("rocksdb") 15 | val db = RocksDB.open(dir.toUri().path) 16 | assertEquals(CompressionType.SNAPPY_COMPRESSION, db.options.compressionType()) 17 | assertEquals(dir.toUri().path, db.name) 18 | db.put("key".encodeToByteArray(), "value".encodeToByteArray()) 19 | assertEquals("value", db.get("key".encodeToByteArray()).decodeToString()) 20 | } 21 | 22 | @Test 23 | fun openDBWriteAndReadValueLZ4() { 24 | val dir = Files.createTempDirectory("rocksdb-lz4") 25 | val options = Options().apply { 26 | setCreateIfMissing(true) 27 | setCompressionType(CompressionType.LZ4_COMPRESSION) 28 | } 29 | val db = RocksDB.open(options, dir.toUri().path) 30 | assertEquals(dir.toUri().path, db.name) 31 | db.put("key".encodeToByteArray(), "value".encodeToByteArray()) 32 | assertEquals("value", db.get("key".encodeToByteArray()).decodeToString()) 33 | } 34 | 35 | 36 | @Test 37 | fun openDBWriteAndReadValueLZ4HC() { 38 | val dir = Files.createTempDirectory("rocksdb-lz4hc") 39 | val options = Options().apply { 40 | setCreateIfMissing(true) 41 | setCompressionType(CompressionType.LZ4HC_COMPRESSION) 42 | } 43 | val db = RocksDB.open(options, dir.toUri().path) 44 | assertEquals(dir.toUri().path, db.name) 45 | db.put("key".encodeToByteArray(), "value".encodeToByteArray()) 46 | assertEquals("value", db.get("key".encodeToByteArray()).decodeToString()) 47 | } 48 | @Test 49 | fun openDBWriteAndReadValueZLib() { 50 | val dir = Files.createTempDirectory("rocksdb-zlib") 51 | val options = Options().apply { 52 | setCreateIfMissing(true) 53 | setCompressionType(CompressionType.ZLIB_COMPRESSION) 54 | } 55 | val db = RocksDB.open(options, dir.toUri().path) 56 | assertEquals(dir.toUri().path, db.name) 57 | db.put("key".encodeToByteArray(), "value".encodeToByteArray()) 58 | assertEquals("value", db.get("key".encodeToByteArray()).decodeToString()) 59 | } 60 | 61 | @Test 62 | fun openDBWriteAndReadValueSnappy() { 63 | val dir = Files.createTempDirectory("rocksdb-snappy") 64 | val options = Options().apply { 65 | setCreateIfMissing(true) 66 | setCompressionType(CompressionType.SNAPPY_COMPRESSION) 67 | } 68 | val db = RocksDB.open(options, dir.toUri().path) 69 | assertEquals(dir.toUri().path, db.name) 70 | db.put("key".encodeToByteArray(), "value".encodeToByteArray()) 71 | assertEquals("value", db.get("key".encodeToByteArray()).decodeToString()) 72 | } 73 | 74 | @Test 75 | fun openDBWriteAndReadValueBz2() { 76 | val dir = Files.createTempDirectory("rocksdb-bz2") 77 | val options = Options().apply { 78 | setCreateIfMissing(true) 79 | setCompressionType(CompressionType.BZLIB2_COMPRESSION) 80 | } 81 | val db = RocksDB.open(options, dir.toUri().path) 82 | assertEquals(dir.toUri().path, db.name) 83 | db.put("key".encodeToByteArray(), "value".encodeToByteArray()) 84 | assertEquals("value", db.get("key".encodeToByteArray()).decodeToString()) 85 | } 86 | 87 | @Test 88 | fun openDBWriteAndReadValueZstd() { 89 | val dir = Files.createTempDirectory("rocksdb-zstd") 90 | val options = Options().apply { 91 | setCreateIfMissing(true) 92 | setCompressionType(CompressionType.ZSTD_COMPRESSION) 93 | } 94 | val db = RocksDB.open(options, dir.toUri().path) 95 | assertEquals(dir.toUri().path, db.name) 96 | db.put("key".encodeToByteArray(), "value".encodeToByteArray()) 97 | assertEquals("value", db.get("key".encodeToByteArray()).decodeToString()) 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.wrapper.GradleWrapperMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2019 Jurriaan Mous 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------