Skip to content
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/Android-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI Android

on:
push:
branches:
- master
pull_request:
branches:
- trust

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Env
run: env
- name: NDK search
run: find /usr/local/lib/android -iname ndk-build 2>/dev/null
- name: Search for ndk_locator_record.json before
run: find . -name ndk_locator_record.json 2>/dev/null
- name: Make init
run: make init
- name: Status
run: git status
- name: Build with Gradle
run: export ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk-bundle && ./gradlew clean check android-database-sqlcipher:bundleReleaseAar -PdebugBuild=false --stacktrace
- name: Search for ndk_locator_record.json after
run: find . -name ndk_locator_record.json 2>/dev/null
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
58 changes: 58 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
language: android

branches:
only:
- master
- trust

sudo: true

jdk:
- oraclejdk8

dist : trusty # otherwise you run into /home/travis/.travis/functions: line 104: sdkmanager: command not found

env:
- TERM=dumb

global:
- PATH=$ANDROID_HOME:$ANDROID_HOME/platform-tools:$PATH

android:
components:
- tools
- platform-tools
- android-28

install:
- echo $ANDROID_HOME # We assume this is correctly set when setting path
- sdkmanager --list || true # Look at the packages
- echo yes | sdkmanager "tools" # Ensure tools is updated
- echo y | sdkmanager 'ndk-bundle' 1>/dev/null
- echo y | sdkmanager 'cmake;3.6.4111459' 1>/dev/null
- echo y | sdkmanager 'lldb;3.0' 1>/dev/null

before_script:
- wget --quiet https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
- unzip -q android-ndk-r20b-linux-x86_64.zip
- export ANDROID_NDK_ROOT=`pwd`/android-ndk-r20b
- export ANDROID_NDK_HOME=$ANDROID_NDK_ROOT
- PATH=${PATH}:$ANDROID_NDK_ROOT

script:
- make init
- git status
- ./gradlew clean check android-database-sqlcipher:bundleReleaseAar -PdebugBuild=false --stacktrace

after_success:
# try to upload version and ignore any errors
- ./gradlew bintrayUpload || echo "Version seems to exists already"

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ format:
$(GRADLE) editorconfigFormat

build-debug: check
$(GRADLE) android-database-sqlcipher:bundleDebugAar \
-PdebugBuild=true
TERM=dumb $(GRADLE) android-database-sqlcipher:bundleDebugAar \
-PdebugBuild=true --stacktrace

build-release:
$(GRADLE) android-database-sqlcipher:bundleReleaseAar \
Expand Down
101 changes: 99 additions & 2 deletions android-database-sqlcipher/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
apply plugin: "com.android.library"
apply plugin: "org.ec4j.editorconfig"
apply from: "native.gradle"
apply from: "maven.gradle"
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

ext {
bintrayRepo = 'maven'
bintrayName = 'android-database-sqlcipher'

publishedGroupId = 'info.hannes.android'
libraryName = 'database-sqlcipher'
artifact = 'android-database-sqlcipher'

libraryDescription = 'Android SQLite API based on SQLCipher'

siteUrl = 'https://github.com/hannesa2/android-database-sqlcipher'
gitUrl = 'https://github.com/hannesa2/android-database-sqlcipher.git'

libraryVersion = '4.4.2.0'

developerId = 'hannesa2'
developerName = 'Hannes Achleitner'
developerEmail = 'hannes.software@gmx.at'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

android {

Expand All @@ -14,6 +39,15 @@ android {
versionCode 1
versionName "${clientVersionNumber}"
archivesBaseName = "${archivesBaseName}-${versionName}"


buildConfigField "String", "GIT_COMMIT_SHA1", "\"" + getLatestGitHash() + "\""
buildConfigField "String", "GIT_COMMIT_URL", "\"" + getGitCommitUrl() + "\""
buildConfigField "String", "GIT_REPO_URL", "\"" + getGitRepoUrl() + "\""
buildConfigField "String", "GIT_TAG_URL", "\"" + getGitRepoUrl() + "/tags" + "\""
buildConfigField "String", "TRAVIS_BUILD_ID", "\"" + getTravisBuildId() + "\""
buildConfigField "String", "TRAVIS_BUILD_URL", "\"" + getTravisBuildUrl() + "\""
buildConfigField "String", "JITPACK_BUILD_URL", "\"" + getJitpackBuildUrl() + "\""
}

editorconfig {
Expand All @@ -38,7 +72,7 @@ android {
}

dependencies {
implementation "androidx.sqlite:sqlite:2.0.1"
implementation "androidx.sqlite:sqlite:2.1.0"
}

editorconfig {
Expand All @@ -54,3 +88,66 @@ android {
preBuild.dependsOn([buildOpenSSL, buildAmalgamation, copyAmalgamation, buildNative])
buildNative.mustRunAfter(copyAmalgamation)
}

private static def getGitCommitCount() {
try {
return 'git rev-list --first-parent --count HEAD'.execute().text.trim() as Integer
}
catch (ignored) {
return 0
}
}

private static def getLatestGitHash() {
try {
return 'git rev-parse --short HEAD'.execute().text.trim()
}
catch (ignored) {
return null
}
}

static def getCreateTime() {
def process = "date +%F".execute()
return process.text.toString().trim()
}

static private def getVersionName() {
println "Version: " + getCreateTime() + "." + getGitCommitCount() + "-" + getLatestGitHash()
return getCreateTime() + "." + getGitCommitCount() + "-" + getLatestGitHash()
}

static def getGitCommitUrl() {
return getGitRepoUrl() + "/commit/" + getLatestGitHash()
}

static def getGitRepoUrl() {
def process = "git remote get-url origin --push".execute()
return process.text.toString().replace(".git", "").trim()
}

static def getTravisBuildId() {
return System.getenv("TRAVIS_BUILD_ID")
}

static def getTravisBuildUrl() {
if (System.getenv("CI_SERVER")) {
return getTravisBuildId()
} else {
println "buildID:" + "https://travis-ci.org/" + System.getenv("TRAVIS_REPO_SLUG") + "/builds/" + getTravisBuildId()
println "TRAVIS_BUILD_DIR:" + System.getenv("TRAVIS_BUILD_DIR")
println "TRAVIS_BUILD_ID:" + System.getenv("TRAVIS_BUILD_ID")
println "TRAVIS_BUILD_NUMBER:" + System.getenv("TRAVIS_BUILD_NUMBER")
println "TRAVIS_COMMIT:" + System.getenv("TRAVIS_COMMIT")
println "TRAVIS_COMMIT_MESSAGE:" + System.getenv("TRAVIS_COMMIT_MESSAGE")
println "TRAVIS_COMMIT_RANGE:" + System.getenv("TRAVIS_COMMIT_RANGE")
println "TRAVIS_JOB_ID:" + System.getenv("TRAVIS_JOB_ID")
println "TRAVIS_JOB_NUMBER:" + System.getenv("TRAVIS_JOB_NUMBER")
return "https://travis-ci.org/" + System.getenv("TRAVIS_REPO_SLUG") + "/builds/" + getTravisBuildId()
}
}

static def getJitpackBuildUrl() {
def process = ("git describe --exact-match " + getLatestGitHash() + " 2>/dev/null | echo noTag").execute()
return getGitRepoUrl().replace("https://github.com", "https://jitpack.io/com/github") + "/" + process.text.toString().replace("noTag", "").trim() + "/build.log"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,7 @@ public void run() {
rekey(password);
}
shouldCloseConnection = false;
} else {
} else if (!ex.getMessage().contains("not an error")) {
throw ex;
}
if(keyMaterial != null && keyMaterial.length > 0) {
Expand Down Expand Up @@ -2674,7 +2674,7 @@ private void keyDatabase(SQLiteDatabaseHook databaseHook, Runnable keyOperation)
}
} catch (RuntimeException e) {
if(BuildConfig.DEBUG){
Log.e(TAG, e.getMessage(), e);
Log.w(TAG, e.getMessage(), e);
}
throw e;
}
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ buildscript {
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.4.1"
classpath "com.android.tools.build:gradle:4.1.2"
classpath "gradle.plugin.org.ec4j.gradle:editorconfig-gradle-plugin:0.0.3"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
}
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
53 changes: 33 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -66,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Loading