Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions android-database-sqlcipher/build-openssl-libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ OPENSSL=openssl-$3

(cd src/main/external/${OPENSSL};

if [ ! ${MINIMUM_ANDROID_SDK_VERSION} ]; then
if [[ ! ${MINIMUM_ANDROID_SDK_VERSION} ]]; then
echo "MINIMUM_ANDROID_SDK_VERSION was not provided, include and rerun"
exit 1
fi

if [ ! ${MINIMUM_ANDROID_64_BIT_SDK_VERSION} ]; then
if [[ ! ${MINIMUM_ANDROID_64_BIT_SDK_VERSION} ]]; then
echo "MINIMUM_ANDROID_64_BIT_SDK_VERSION was not provided, include and rerun"
exit 1
fi

if [ ! ${ANDROID_NDK_ROOT} ]; then
if [[ ! ${ANDROID_NDK_ROOT} ]]; then
echo "ANDROID_NDK_ROOT environment variable not set, set and rerun"
exit 1
fi
Expand Down
40 changes: 20 additions & 20 deletions android-database-sqlcipher/native.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
task buildOpenSSL () {
task buildOpenSSL() {
onlyIf {
def armNativeFile = new File("${androidNativeRootDir}/armeabi/libcrypto.a")
return !armNativeFile.exists()
Expand All @@ -7,14 +7,14 @@ task buildOpenSSL () {
exec {
workingDir "${projectDir}"
commandLine "./build-openssl-libraries.sh",
"${minimumAndroidSdkVersion}",
"${minimumAndroid64BitSdkVersion}",
"${opensslVersion}"
"${minimumAndroidSdkVersion}",
"${minimumAndroid64BitSdkVersion}",
"${opensslVersion}"
}
}
}

task buildAmalgamation () {
task buildAmalgamation() {
onlyIf {
def amalgamation = new File("${projectDir}/src/main/external/sqlcipher/sqlite3.c")
return !amalgamation.exists()
Expand All @@ -28,7 +28,7 @@ task buildAmalgamation () {
exec {
workingDir "${projectDir}/src/main/external/sqlcipher"
environment("CFLAGS", "${sqlcipherCFlags}")
commandLine "make", "sqlite3.c"
commandLine "make", "sqlite3.c"
}
}
}
Expand All @@ -40,14 +40,14 @@ task buildNative() {
"${nativeRootOutputDir}/libs32",
file("src/main/cpp").absolutePath,
file("src/main/cpp/Application32.mk").absolutePath,
"${sqlcipherCFlags}", "${otherSqlcipherCFlags}",
"${minimumAndroidSdkVersion}")
"${sqlcipherCFlags}", "${otherSqlcipherCFlags}",
"${minimumAndroidSdkVersion}")
executeNdkBuild(
"${nativeRootOutputDir}/libs64",
file("src/main/cpp").absolutePath,
file("src/main/cpp/Application64.mk").absolutePath,
"${sqlcipherCFlags}", "${otherSqlcipherCFlags}",
"${minimumAndroid64BitSdkVersion}")
"${sqlcipherCFlags}", "${otherSqlcipherCFlags}",
"${minimumAndroid64BitSdkVersion}")
exec {
workingDir "${nativeRootOutputDir}"
commandLine "mkdir", "-p", "libs"
Expand All @@ -66,7 +66,7 @@ task cleanOpenSSL() {
doLast {
logger.info "Cleaning OpenSSL source"
File file = new File("${opensslDir}")
if(file.exists()){
if (file.exists()) {
file.deleteDir()
}
}
Expand All @@ -79,8 +79,8 @@ task cleanSQLCipher() {
gitClean("${sqlcipherDir}")
File amalgamationSource = new File("${sqlcipherDir}/sqlite3.c")
File amalgamationHeader = new File("${sqlcipherDir}/sqlite3.h")
if(amalgamationSource.exists()) amalgamationSource.delete()
if(amalgamationHeader.exists()) amalgamationHeader.delete()
if (amalgamationSource.exists()) amalgamationSource.delete()
if (amalgamationHeader.exists()) amalgamationHeader.delete()
}
}

Expand All @@ -90,7 +90,7 @@ task cleanNative() {
logger.info "Cleaning native build artifacts"
["libs", "libs32", "libs64", "obj"].each {
File file = new File("${projectDir}/src/main/${it}")
if(file.exists()){
if (file.exists()) {
file.deleteDir()
}
}
Expand Down Expand Up @@ -122,15 +122,15 @@ def executeNdkBuild(outputDir, androidMkDirectory, applicationMkFile,
exec {
def outputDirectory = "NDK_LIBS_OUT=${outputDir}"
def applicationFile = "NDK_APPLICATION_MK=${applicationMkFile}"
def environmentVariables = ["SQLCIPHER_CFLAGS": "${cflags}",
"OPENSSL_DIR": "${opensslDir}",
"SQLCIPHER_DIR": "${sqlcipherDir}",
def environmentVariables = ["SQLCIPHER_CFLAGS" : "${cflags}",
"OPENSSL_DIR" : "${opensslDir}",
"SQLCIPHER_DIR" : "${sqlcipherDir}",
"SQLCIPHER_OTHER_CFLAGS" : "${otherSqlcipherCFlags}",
"ANDROID_NATIVE_ROOT_DIR": "${androidNativeRootDir}",
"NDK_APP_PLATFORM": "${androidVersion}"]
"NDK_APP_PLATFORM" : "${androidVersion}"]
environment(environmentVariables)
commandLine "ndk-build", "${ndkBuildType}",
"--environment-overrides", outputDirectory,
"-C", androidMkDirectory, applicationFile
"--environment-overrides", outputDirectory,
"-C", androidMkDirectory, applicationFile
}
}