8000 Conditionally build OpenSSL, fix clean · passy/android-database-sqlcipher@f5fa3bd · GitHub
[go: up one dir, main page]

Skip to content

Commit f5fa3bd

Browse files
Conditionally build OpenSSL, fix clean
1 parent 19c97ff commit f5fa3bd

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

android-database-sqlcipher/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@ android {
2626
}
2727
}
2828

29-
task distclean(dependsOn: [clean, cleanSQLCipher, cleanOpenSSL]) {
30-
description "Clean up build, SQLCipher, and OpenSSL artifacts"
31-
}
32-
3329
clean.dependsOn cleanNative
3430

35-
preBuild.dependsOn buildAmalgamation
31+
preBuild.dependsOn([buildOpenSSL, buildAmalgamation])
3632

3733
afterEvaluate {
3834
android.libraryVariants.all { variant ->

android-database-sqlcipher/native.gradle

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
task buildOpenSSL (type:Exec) {
2-
workingDir "${projectDir}"
3-
commandLine "./build-openssl-libraries.sh"
1+
task buildOpenSSL () {
2+
onlyIf {
3+
def armNativeFile = new File("${androidNativeRootDir}/armeabi/libcrypto.a")
4+
return !armNativeFile.exists()
5+
}
6+
doLast {
7+
exec {
8+
workingDir "${projectDir}"
9+
commandLine "./build-openssl-libraries.sh"
10+
}
11+
}
412
}
513

614
task buildAmalgamation () {
@@ -60,13 +68,17 @@ task cleanNative() {
6068
description "Clean the native (JNI) build artifacts"
6169
doLast {
6270
logger.info "Cleaning native build artifacts"
63-
exec {
64-
workingDir "${projectDir}/src/main"
65-
commandLine "rm", "-rf", "libs32", "lib64", "obj"
71+
["libs32", "libs64", "obj"].each {
72+
new File("${projectDir}/src/main/${it}").deleteDir()
6673
}
74+
new File("${androidNativeRootDir}/").deleteDir()
6775
}
6876
}
6977

78+
task distclean(dependsOn: [clean, cleanSQLCipher, cleanOpenSSL]) {
79+
description "Clean build, SQLCipher, and OpenSSL artifacts"
80+
}
81+
7082
def gitClean(directory) {
7183
logger.info "Cleaning directory:${directory}"
7284
exec {

build.gradle

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:2.3.3'
9-
10-
// NOTE: Do not place your application dependencies here; they belong
11-
// in the individual module build.gradle files
129
}
1310
}
1411

@@ -21,6 +18,7 @@ allprojects {
2118
ext {
2219
clientVersionNumber = "3.5.7"
2320
nativeRootOutputDir = "${projectDir}/${name}/src/main"
21+
androidNativeRootDir = "${nativeRootOutputDir}/external/android-libs"
2422
sqlcipherDir = "${projectDir}/${name}/src/main/external/sqlcipher"
2523
opensslDir = "${projectDir}/${name}/src/main/external/openssl"
2624
sqlcipherCFlags = "-DSQLITE_HAS_CODEC " +
@@ -44,9 +42,6 @@ ext {
4442
"-DSQLCIPHER_CRYPTO_OPENSSL"
4543
}
4644

47-
// task clean(type: Delete, dependsOn: [cleanOpenSSL, cleanSQLCipher]) {
48-
// delete rootProject.buildDir
49-
// }
5045
task clean(type: Delete) {
5146
delete rootProject.buildDir
5247
}

0 commit comments

Comments
 (0)
0