Skip to content

Commit

Permalink
Merge remote-tracking branch 'xerial/master' into sync
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/build-native.yml
#	.github/workflows/ci.yml
#	CHANGELOG
#	Makefile.common
#	VERSION
#	pom.xml
#	src/main/resources/org/sqlite/native/FreeBSD/aarch64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/FreeBSD/x86/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/FreeBSD/x86_64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux-Android/aarch64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux-Android/arm/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux-Android/x86/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux-Android/x86_64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux-Musl/aarch64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux-Musl/x86/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux-Musl/x86_64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux/aarch64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux/arm/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux/armv6/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux/armv7/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux/ppc64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux/x86/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Linux/x86_64/libsqlitejdbc.so
#	src/main/resources/org/sqlite/native/Windows/aarch64/sqlitejdbc.dll
#	src/main/resources/org/sqlite/native/Windows/armv7/sqlitejdbc.dll
#	src/main/resources/org/sqlite/native/Windows/x86/sqlitejdbc.dll
#	src/main/resources/org/sqlite/native/Windows/x86_64/sqlitejdbc.dll
  • Loading branch information
Willena committed Nov 18, 2023
2 parents f18ecbd + 8cd1fa1 commit 8c7e658
Show file tree
Hide file tree
Showing 49 changed files with 831 additions and 277 deletions.
74 changes: 42 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**.java'
- '**.xml'
- '**.so'
- '**.jnilib'
- '**.dylib'
- '**.dll'
- '.github/workflows/*.yml'
- 'VERSION'
Expand All @@ -19,7 +19,7 @@ on:
- '**.java'
- '**.xml'
- '**.so'
- '**.jnilib'
- '**.dylib'
- '**.dll'
- '.github/workflows/*.yml'
- 'VERSION'
Expand All @@ -30,7 +30,7 @@ jobs:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
Expand All @@ -45,15 +45,15 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ 11, 17, 19 ]
java: [ 11, 17, 20 ]
include:
- os: windows-latest
java: 19
java: 20
- os: macos-latest
java: 19
java: 20
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
Expand All @@ -79,22 +79,22 @@ jobs:
run: mvn --batch-mode --no-transfer-progress test

# test_graalvm:
# name: test ${{ matrix.os }} jdk${{ matrix.java }} GraalVM native-image
# name: test ${{ matrix.os }} jdk${{ matrix.java }} GraalVM native-image - ${{ matrix.profiles }}
# strategy:
# matrix:
# os: [ ubuntu-latest, windows-latest, macos-latest ]
# java: [ 11, 17 ]
# java: [ '17', '21' ]
# profiles: ['native', 'native,native-exported']
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - uses: graalvm/setup-graalvm@v1
# with:
# version: '22.3.0'
# java-version: ${{ matrix.java }}
# components: 'native-image'
# distribution: 'graalvm-community'
# github-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Test
# run: mvn --batch-mode --no-transfer-progress -P native test
# run: mvn --batch-mode --no-transfer-progress -P ${{ matrix.profiles }} integration-test

test_multiarch:
name: test ${{ matrix.arch }} ${{ matrix.distro }} jdk${{ matrix.java }}
Expand All @@ -119,7 +119,7 @@ jobs:
java: 11 # apt-get maven is 3.6.x, doesn't support Java 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2
name: Test
with:
Expand Down Expand Up @@ -171,11 +171,11 @@ jobs:
name: test external amalgamation
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 19
java-version: 20
java-package: jdk
cache: 'maven'
- run: brew install sqlite3
Expand All @@ -191,22 +191,25 @@ jobs:

# release:
# name: Deploy
# needs: [ lint, test, test_graalvm, test_multiarch, test_external_amalgamation, test_graalvm ]
# needs: [ lint, test, test_multiarch, test_external_amalgamation, test_graalvm ]
# if: github.repository_owner == 'xerial' && github.ref == 'refs/heads/master' # only perform on latest master
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# if: ${{ github.event_name == 'push' }}
# # a workflow dispatch indicates a release, we need the full git history to generate the changelog
# - uses: actions/checkout@v3
# if: ${{ github.event_name == 'workflow_dispatch' }}
# - name: Print inputs
# run: |
# echo "Perform release: ${{ inputs.perform_release }}"
# - uses: actions/checkout@v4
# if: github.event_name == 'push' || inputs.perform_release != true
# # when performing a release we need the full git history to generate the changelog
# - uses: actions/checkout@v4
# if: inputs.perform_release
# with:
# fetch-depth: 0
# - name: Set up Apache Maven Central
# uses: actions/setup-java@v3
# with: # running setup-java again overwrites the settings.xml
# distribution: 'temurin'
# java-version: '8'
# java-version: '11'
# java-package: jdk
# server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
# server-username: MAVEN_CENTRAL_USERNAME # env variable for username in deploy (1)
Expand All @@ -217,40 +220,47 @@ jobs:
# run: |
# echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | tee -a $GITHUB_ENV
# - name: Cancel action for non SNAPSHOT push
# if: ${{ github.event_name == 'push' && !endsWith(env.PROJECT_VERSION, '-SNAPSHOT')}}
# uses: andymckay/cancel-action@0.2
# # from that point, push means we deploy snapshot, workflow_dispatch means we perform a release
# if: github.event_name == 'push' && !endsWith(env.PROJECT_VERSION, '-SNAPSHOT')
# uses: andymckay/cancel-action@0.3
# # from that point, if inputs.perform_release is true we perform a release, else we deploy snapshot
# - name: Prepare release
# if: ${{ github.event_name == 'workflow_dispatch' }}
# if: inputs.perform_release
# run: |
# mvn --no-transfer-progress versions:set -DremoveSnapshot -DgenerateBackupPoms=false
# echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | tee -a $GITHUB_ENV
# RELEASE_VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
# echo "RELEASE_VERSION=${RELEASE_VERSION}" | tee -a $GITHUB_ENV
# sed -i -e "s/^\:project-version\:\ .*/:project-version: ${RELEASE_VERSION}/g" README.adoc
#
# - name: Build
# run: mvn --batch-mode --no-transfer-progress package -P release -DskipTests
#
# # The sonatype maven plugin will decide the right destination depending on whether the project is SNAPSHOT or not
# - name: Publish to Apache Maven Central
# if: github.event_name == 'push' || inputs.push_maven
# run: mvn --batch-mode --no-transfer-progress deploy -P release -DskipTests
# env:
# MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }} # must be the same env variable name as (1)
# MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} # must be the same env variable name as (2)
# MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} # must be the same env variable name as (3)
# - name: Release commit and push
# if: ${{ github.event_name == 'workflow_dispatch' }}
# if: inputs.perform_release
# uses: EndBug/add-and-commit@v9
# with:
# message: 'chore(release): ${{ env.RELEASE_VERSION }} [skip ci]'
# tag: '${{ env.RELEASE_VERSION }} --force'
# default_author: github_actions
# - name: Create Github release with JReleaser
# if: ${{ github.event_name == 'workflow_dispatch' }}
# if: inputs.perform_release
# env:
# JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# mvn --batch-mode --no-transfer-progress -DskipTests jreleaser:full-release
# - name: Prepare next snapshot
# if: ${{ github.event_name == 'workflow_dispatch' }}
# if: inputs.perform_release
# run: |
# mvn versions:set -DnextSnapshot -DgenerateBackupPoms=false
# - name: Next snapshot commit and push
# if: ${{ github.event_name == 'workflow_dispatch' }}
# if: inputs.perform_release
# uses: EndBug/add-and-commit@v9
# with:
# message: 'chore(release): prepare next snapshot [skip ci]'
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DOCKER_RUN_OPTS=--rm
MVN:=mvn
CODESIGN:=docker run $(DOCKER_RUN_OPTS) -v $$PWD:/workdir gotson/rcodesign sign
SRC:=src/main/java
JAVA_CLASSPATH:=$(TARGET)/classpath/slf4j-api.jar
SQLITE_OUT:=$(TARGET)/$(sqlite)-$(OS_NAME)-$(OS_ARCH)
SQLITE_OBJ?=$(SQLITE_OUT)/sqlite3.o
SQLITE_ARCHIVE:=$(TARGET)/$(sqlite)-amal.zip
Expand Down Expand Up @@ -46,16 +47,19 @@ $(SQLITE_UNPACKED): $(SQLITE_ARCHIVE)

touch $@

$(JAVA_CLASSPATH):
@mkdir -p $(@D)
curl -L -f -o$@ https://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar

$(TARGET)/common-lib/org/sqlite/%.class: src/main/java/org/sqlite/%.java
@mkdir -p $(@D)
$(JAVAC) -source 1.6 -target 1.6 -sourcepath $(SRC) -d $(TARGET)/common-lib $<

jni-header: $(TARGET)/common-lib/NativeDB.h

$(TARGET)/common-lib/NativeDB.h: src/main/java/org/sqlite/core/NativeDB.java
$(TARGET)/common-lib/NativeDB.h: src/main/java/org/sqlite/core/NativeDB.java $(JAVA_CLASSPATH)
@mkdir -p $(TARGET)/common-lib
$(JAVAC) -d $(TARGET)/common-lib -sourcepath $(SRC) -h $(TARGET)/common-lib src/main/java/org/sqlite/core/NativeDB.java
$(JAVAC) -cp $(JAVA_CLASSPATH) -d $(TARGET)/common-lib -sourcepath $(SRC) -h $(TARGET)/common-lib src/main/java/org/sqlite/core/NativeDB.java
mv target/common-lib/org_sqlite_core_NativeDB.h target/common-lib/NativeDB.h

test:
Expand Down Expand Up @@ -242,10 +246,10 @@ sparcv9:
$(MAKE) native OS_NAME=SunOS OS_ARCH=sparcv9

mac64-signed: mac64
$(CODESIGN) src/main/resources/org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib
$(CODESIGN) src/main/resources/org/sqlite/native/Mac/x86_64/libsqlitejdbc.dylib

mac-arm64-signed: mac-arm64
$(CODESIGN) src/main/resources/org/sqlite/native/Mac/aarch64/libsqlitejdbc.jnilib
$(CODESIGN) src/main/resources/org/sqlite/native/Mac/aarch64/libsqlitejdbc.dylib

package: native-all
rm -rf target/dependency-maven-plugin-markers
Expand Down
26 changes: 15 additions & 11 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ JAVAC := "$(JAVA_HOME)/bin/javac"
JAVAH := "$(JAVA_HOME)/bin/javah"

TARGET := target
SRC:=src/main/java
OSINFO_CLASS := org.sqlite.util.OSInfo
OSINFO_PROG := lib/org/sqlite/util/OSInfo.class
JAVA_CLASSPATH:=$(TARGET)/classpath/slf4j-api.jar

## building OSInfo.java
ifeq ("$(wildcard $(OSINFO_PROG))","")
$(info Building OSInfo tool)
$(shell $(JAVAC) -cp src/main/java -d lib src/main/java/org/sqlite/util/OSInfo.java)
$(shell mkdir -p $(TARGET)/classpath)
$(shell curl -L -f -o$(JAVA_CLASSPATH) https://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar)
$(shell $(JAVAC) -cp $(JAVA_CLASSPATH) -sourcepath $(SRC) -d lib src/main/java/org/sqlite/util/OSInfo.java)
endif

ifndef OS_NAME
OS_NAME := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --os)
OS_NAME := $(shell $(JAVA) -cp lib:$(JAVA_CLASSPATH) $(OSINFO_CLASS) --os)
endif
ifndef OS_ARCH
OS_ARCH := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --arch)
OS_ARCH := $(shell $(JAVA) -cp lib:$(JAVA_CLASSPATH) $(OSINFO_CLASS) --arch)
endif

# Windows uses different path separators
Expand Down Expand Up @@ -60,7 +64,7 @@ ifeq (,$(findstring $(strip $(target)),$(known_targets)))
target := Default
endif

$(info Will build using target: $(target) (detected os: $(OS_NAME) arch: $(OS_ARCH)))
$(info Will build using target: $(target) (detected os: $(OS_NAME), arch: $(OS_ARCH)))

# cross-compilation toolchain prefix (e.g. "arm-linux-gnueabi-")
CROSS_PREFIX :=
Expand Down Expand Up @@ -138,28 +142,28 @@ Linux-Musl-aarch64_SQLITE_FLAGS :=
Linux-Android-arm_CC := $(CROSS_PREFIX)clang
Linux-Android-arm_STRIP := $(CROSS_ROOT)/bin/llvm-strip
Linux-Android-arm_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -I$(CROSS_ROOT)/sysroot/usr/include -Os -fPIC -fvisibility=hidden -fPIE -pie -lm -lc -landroid -ldl -llog
Linux-Android-arm_LINKFLAGS := $(Default_LINKFLAGS)
Linux-Android-arm_LINKFLAGS := $(Default_LINKFLAGS) -Wl,-soname,libsqlitejdbc.so
Linux-Android-arm_LIBNAME := libsqlitejdbc.so
Linux-Android-arm_SQLITE_FLAGS :=

Linux-Android-aarch64_CC := $(CROSS_PREFIX)clang
Linux-Android-aarch64_STRIP := $(CROSS_ROOT)/bin/llvm-strip
Linux-Android-aarch64_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -I$(CROSS_ROOT)/sysroot/usr/include -Os -fPIC -fvisibility=hidden -fPIE -pie -lm -lc -landroid -ldl -llog
Linux-Android-aarch64_LINKFLAGS := $(Default_LINKFLAGS)
Linux-Android-aarch64_LINKFLAGS := $(Default_LINKFLAGS) -Wl,-soname,libsqlitejdbc.so
Linux-Android-aarch64_LIBNAME := libsqlitejdbc.so
Linux-Android-aarch64_SQLITE_FLAGS :=

Linux-Android-x86_CC := $(CROSS_PREFIX)clang
Linux-Android-x86_STRIP := $(CROSS_ROOT)/bin/llvm-strip
Linux-Android-x86_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -I$(CROSS_ROOT)/sysroot/usr/include -Os -fPIC -fvisibility=hidden -fPIE -pie -lm -lc -landroid -ldl -llog -msse4.2 -maes
Linux-Android-x86_LINKFLAGS := $(Default_LINKFLAGS)
Linux-Android-x86_LINKFLAGS := $(Default_LINKFLAGS) -Wl,-soname,libsqlitejdbc.so
Linux-Android-x86_LIBNAME := libsqlitejdbc.so
Linux-Android-x86_SQLITE_FLAGS :=

Linux-Android-x86_64_CC := $(CROSS_PREFIX)clang
Linux-Android-x86_64_STRIP := $(CROSS_ROOT)/bin/llvm-strip
Linux-Android-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -I$(CROSS_ROOT)/sysroot/usr/include -Os -fPIC -fvisibility=hidden -fPIE -pie -lm -lc -landroid -ldl -llog -msse4.2 -maes
Linux-Android-x86_64_LINKFLAGS := $(Default_LINKFLAGS)
Linux-Android-x86_64_LINKFLAGS := $(Default_LINKFLAGS) -Wl,-soname,libsqlitejdbc.so
Linux-Android-x86_64_LIBNAME := libsqlitejdbc.so
Linux-Android-x86_64_SQLITE_FLAGS :=

Expand Down Expand Up @@ -216,7 +220,7 @@ Mac-x86_CC := gcc
Mac-x86_STRIP := strip -x
Mac-x86_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden -msse4.2 -maes
Mac-x86_LINKFLAGS := -dynamiclib
Mac-x86_LIBNAME := libsqlitejdbc.jnilib
Mac-x86_LIBNAME := libsqlitejdbc.dylib
Mac-x86_SQLITE_FLAGS := -DSQLITE_ENABLE_LOCKING_STYLE=0

HPUX-ia64_32_CC := cc
Expand All @@ -234,7 +238,7 @@ ifeq ($(wildcard MAC_SDK),)
endif
Mac-x86_64_CCFLAGS := -I$(MAC_SDK)/System/Library/Frameworks/JavaVM.framework/Headers -Ilib/inc_mac -Os -fPIC -mmacosx-version-min=10.6 -fvisibility=hidden -msse4.2 -maes -Wno-implicit-function-declaration
Mac-x86_64_LINKFLAGS := -dynamiclib -framework Security
Mac-x86_64_LIBNAME := libsqlitejdbc.jnilib
Mac-x86_64_LIBNAME := libsqlitejdbc.dylib
Mac-x86_64_SQLITE_FLAGS :=

# Use a CROSS_PREFIX as the cross-triple clang is not available in crossbuild, see https://github.com/multiarch/crossbuild/blob/ad79cc84b6fb3fb1d09bc4a78719ef26f23bab85/Dockerfile#L134
Expand All @@ -244,7 +248,7 @@ Mac-aarch64_STRIP := $(CROSS_PREFIX)strip -x
MAC_SDK := /usr/osxcross/SDK/MacOSX11.3.sdk
Mac-aarch64_CCFLAGS := -I$(MAC_SDK)/System/Library/Frameworks/JavaVM.framework/Headers -Ilib/inc_mac -Os -fPIC -mmacosx-version-min=10.9 -fvisibility=hidden -Wno-implicit-function-declaration
Mac-aarch64_LINKFLAGS := -dynamiclib -framework Security
Mac-aarch64_LIBNAME := libsqlitejdbc.jnilib
Mac-aarch64_LIBNAME := libsqlitejdbc.dylib
Mac-aarch64_SQLITE_FLAGS :=

Windows-x86_CC := $(CROSS_PREFIX)gcc
Expand Down
6 changes: 3 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Bring back Linux armv6 support (#628)
* FreeBSD x86 and x86_64 (#639)
* Dropped DragonFlyBSD support (#641)
* Other Intenal Fixes
* Other Internal Fixes
* Add reflect-config, jni-config and native-image.properties to graalvm native image compilation (#631)
* Fix multipleClassLoader test when directory is renamed (#647)
* CI tests for Windows and MacOS (#645)
Expand Down Expand Up @@ -40,7 +40,7 @@
* Enable SQLITE_MAX_MMAP_SIZE compile option again.
* Fixes issues when using Arm Cortex A8, A9 (32-bit architecture)
* 2020-07-15: sqlite-jdbc-3.32.3.1
* Remove SQLITE_MAX_MMAP_SIZE compile option, which might be causing performance issuess.
* Remove SQLITE_MAX_MMAP_SIZE compile option, which might be causing performance issues.
* 2020-06-18: sqlite-jdbc-3.32.3
* Fix multiple CVE reported issues https://github.com/xerial/sqlite-jdbc/issues/501
* 2020-05-04: sqlite-jdbc-3.31.1
Expand Down Expand Up @@ -183,7 +183,7 @@
If you have already downloaded 3.6.4, please obtain the latest one on the download page.
* 2008 October 16th: sqlite-jdbc-3.6.4 released.
* Changes from SQLite 3.6.3: <https://www.sqlite.org/releaselog/3_6_4.html>
* `R*-Tree` index and `UPDATE/DELTE` syntax with `LIMIT` clause are available from this build.
* `R*-Tree` index and `UPDATE/DELETE` syntax with `LIMIT` clause are available from this build.
* 2008 October 14th: sqlite-jdbc-3.6.3 released. Compatible with SQLite 3.6.3.
* 2008 September 18th: sqlite-jdbc-3.6.2 released. Compatible with SQLite 3.6.2
and contains pure-java and native versions.
Expand Down
Loading

0 comments on commit 8c7e658

Please sign in to comment.