Skip to content

Commit

Permalink
Update SQLite to v3.41.2 (#179)
Browse files Browse the repository at this point in the history
* Update to 3.41.2 and Readme corrections
* Update dependencies and cleanup

Co-authored-by: Nikhil Purushe <[email protected]>
  • Loading branch information
SteinerOk and npurushe authored May 20, 2023
1 parent 679b34e commit ec3e07c
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 64 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
with:
fetch-depth: 1

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: "11"
java-version: "17"
distribution: "adopt"

- name: Run Android tests
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
==========

## 3.42.0
- [SQLite 3.42.0](https://www.sqlite.org/releaselog/3_42_0.html)
- [SQLite 3.41.2](https://www.sqlite.org/releaselog/3_41_2.html)

## 3.41.1
- [SQLite 3.41.1](https://www.sqlite.org/releaselog/3_41_1.html)
- [SQLite 3.41.0](https://www.sqlite.org/releaselog/3_41_0.html)
Expand Down
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
![Build Status](https://github.com/requery/sqlite-android/actions/workflows/ci.yml/badge.svg)
[![Download](https://jitpack.io/v/requery/sqlite-android.svg)](https://jitpack.io/#requery/sqlite-android)

This is an Android specific distribution of the latest versions of SQLite. It contains the latest
SQLite version and the Android specific database APIs derived from AOSP packaged as an AAR
library distributed on jitpack.
This is an Android specific distribution of the latest versions of SQLite.
It contains the latest SQLite version and the Android specific database APIs
derived from AOSP packaged as an AAR library distributed on jitpack.

Why?
----
Expand All @@ -15,9 +15,9 @@ Why?
- **Up-to-date**

Even the latest version of Android is several versions behind the latest version of SQLite.
Theses versions do not have the bug fixes, performance improvements, or new features present in
These versions do not have the bug fixes, performance improvements, or new features present in
current versions of SQLite. This problem is worse the older the version of the OS the device has.
Using this library you can keep up to date with the latest versions of SQLite and provide a
Using this library, you can keep up to date with the latest versions of SQLite and provide a
consistent version across OS versions and devices.

Use new SQLite features:
Expand All @@ -32,9 +32,11 @@ Use new SQLite features:
Usage
-----

Follow the guidelines from [jitpack.io](https://jitpack.io) to add the JitPack repository to your build file if you have not.
Follow the guidelines from [jitpack.io](https://jitpack.io) to add the JitPack repository
to your build file if you have not.

Typically, this means an edit to your `build.gradle` file to add a new `repository` definition in the `allprojects` block, like this:
Typically, this means an edit to your `build.gradle` file to add a new `repository` definition
in the `allprojects` block, like this:

```gradle
allprojects {
Expand All @@ -49,7 +51,7 @@ Then add the sqlite-android artifact from this repository as a dependency:

```gradle
dependencies {
implementation 'com.github.requery:sqlite-android:3.41.1'
implementation 'com.github.requery:sqlite-android:3.42.0'
}
```
Then change usages of `android.database.sqlite.SQLiteDatabase` to
Expand All @@ -61,7 +63,7 @@ depended on `android.database.sqlite.SQLiteDatabase` equivalent APIs are provide

If you expose `Cursor` instances across processes you should wrap the returned cursors in a
[CrossProcessCursorWrapper](http://developer.android.com/reference/android/database/CrossProcessCursorWrapper.html)
for performance reasons the cursors are not cross process by default.
for performance reasons the cursors are not a cross process by default.

### Support library compatibility

Expand All @@ -83,8 +85,8 @@ The native library is built for the following CPU architectures:
- `x86` ~1.7 MB
- `x86_64` ~1.8 MB

However you may not want to include all binaries in your apk. You can exclude certain variants by
using `packagingOptions`:
However, you may not want to include all binaries in your apk.
You can exclude certain variants by using `packagingOptions`:

```gradle
android {
Expand All @@ -97,36 +99,36 @@ android {
}
```

The size of the artifacts with only the armeabi-v7a binary is **~1.2 MB**. In general you can use
armeabi-v7a on the majority of Android devices including Intel Atom which provides a native
translation layer, however performance under the translation layer is worse than using the x86
binary.
The size of the artifacts with only the armeabi-v7a binary is **~1.2 MB**.
In general, you can use armeabi-v7a on the majority of Android devices including Intel Atom
which provides a native translation layer, however, performance under the translation layer
is worse than using the x86 binary.

Note that starting August 1, 2019, your apps published on Google Play will [need to support 64-bit architectures](https://developer.android.com/distribute/best-practices/develop/64-bit).

Requirements
------------

The min SDK level is API level 14 (Ice Cream Sandwich).
The min SDK level is API level 19 (KitKat).

Versioning
----------

The library is versioned after the version of SQLite it contains. For changes specific to just the
wrapper API a revision number is added e.g. 3.41.1-X, where X is the revision number.
wrapper API a revision number is added e.g. 3.42.0-X, where X is the revision number.

Acknowledgements
----------------
This project is based on the AOSP code and the [Android SQLite bindings](https://www.sqlite.org/android/doc/trunk/www/index.wiki)
No official distributions are made from the Android SQLite bindings it and it has not been updated
No official distributions are made from the Android SQLite bindings it, and it has not been updated
in a while, this project starts there and makes significant changes:

Changes
-------

- **Fast read performance:** The original SQLite bindings filled the CursorWindow using it's
- **Fast read performance:** The original SQLite bindings filled the CursorWindow using its
Java methods from native C++. This was because there is no access to the native CursorWindow
native API from the NDK. Unfortunately this slowed read performance significantly (roughly 2x
native API from the NDK. Unfortunately, this slowed read performance significantly (roughly 2x
worse vs the android database API) because of extra JNI roundtrips. This has been rewritten
without the JNI to Java calls (so more like the original AOSP code) and also using a local memory
CursorWindow.
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins {
id 'com.android.library' version '7.4.2' apply false
id 'de.undercouch.download' version '5.3.1' apply false
id "com.android.library" version "8.0.1" apply false
id "de.undercouch.download" version "5.4.0" apply false
}
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
android.useAndroidX=true
android.disableAutomaticComponentCreation=true

# Disabling unused build features
android.defaults.buildfeatures.aidl=false
Expand All @@ -24,4 +23,4 @@ POM_DEVELOPER_ID=TODO
POM_DEVELOPER_NAME=TODO
POM_DEVELOPER_URL=TODO
POM_INCEPTION_YEAR=TODO
VERSION_NAME=3.41.1-SNAPSHOT
VERSION_NAME=3.42.0-SNAPSHOT
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
68 changes: 31 additions & 37 deletions sqlite-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id 'de.undercouch.download'
id 'com.android.library'
id 'com.vanniktech.maven.publish' version '0.24.0'
id "de.undercouch.download"
id "com.android.library"
id "com.vanniktech.maven.publish" version "0.25.2"
}

android {
buildToolsVersion "33.0.2"
ndkVersion '25.2.9519653'
compileSdkVersion 33
buildToolsVersion = "33.0.2"
ndkVersion "25.2.9519653"

compileSdk 33

namespace "io.requery.android.sqlite"

defaultConfig {
minSdkVersion 19
versionName VERSION_NAME

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
consumerProguardFiles 'proguard-rules.pro'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "proguard-rules.pro"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

Expand All @@ -41,64 +42,57 @@ android {

externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
path "src/main/jni/Android.mk"
}
}
}

dependencies {
api 'androidx.core:core:1.9.0'
api 'androidx.sqlite:sqlite:2.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
api("androidx.core:core:1.10.1")
api("androidx.sqlite:sqlite:2.3.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test:core:1.5.0")
androidTestImplementation("androidx.test:runner:1.5.2")
androidTestImplementation("androidx.test:rules:1.5.0")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
}

ext {
sqliteDistributionUrl = 'https://www.sqlite.org/2023/sqlite-amalgamation-3410100.zip'
sqliteDistributionUrl = "https://www.sqlite.org/2023/sqlite-amalgamation-3420000.zip"
}

task downloadSqlite(type: Download) {
tasks.register("downloadSqlite", Download) {
src project.sqliteDistributionUrl
dest 'src/main/jni/sqlite.zip'
dest "src/main/jni/sqlite.zip"
}

task installSqlite(dependsOn: downloadSqlite, type: Copy) {
tasks.register("installSqlite", Copy) {
dependsOn downloadSqlite
from zipTree(downloadSqlite.dest).matching {
include '*/sqlite3.*'
include "*/sqlite3.*"
eachFile { it.setPath(it.getName()) }
}
into 'src/main/jni/sqlite'
into "src/main/jni/sqlite"
}

preBuild.dependsOn installSqlite

task javadoc(type: Javadoc) {
tasks.register("javadoc", Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
android.libraryVariants.configureEach { variant ->
if (variant.name == "release") {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}
exclude '**/R.html', '**/R.*.html', '**/index.html'
exclude "**/R.html", "**/R.*.html", "**/index.html"
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
options.addBooleanOption("html5", true)
}

failOnError false
}

// https://issuetracker.google.com/issues/207403732
tasks.whenTaskAdded { task ->
if (task.name.startsWith("configureNdkBuildDebug")
|| task.name.startsWith("configureNdkBuildRelease")) {
task.dependsOn preBuild
}
}

mavenPublishing {
publishToMavenCentral(SonatypeHost.DEFAULT, /* automaticRelease */ true)
signAllPublications()
Expand Down

0 comments on commit ec3e07c

Please sign in to comment.