diff --git a/Makefile b/Makefile index 40602971..7a42f371 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ publish-remote-release: -PopensslAndroidLibRoot="$(OPENSSL_ANDROID_LIB_ROOT)" \ -PsqlcipherCFlags="$(SQLCIPHER_CFLAGS)" \ -PsqlcipherAndroidClientVersion="$(SQLCIPHER_ANDROID_VERSION)" \ - uploadArchives + android-database-sqlcipher:publish collect-nexus-info := \ read -p "Enter Nexus username:" nexusUsername; \ diff --git a/README.md b/README.md index f35aefc3..3dc500d0 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The latest AAR binary package information can be [here](https://www.zetetic.net/ ### Compatibility -SQLCipher for Android runs on Android 4.1–Android 12, for `armeabi-v7a`, `x86`, `x86_64`, and `arm64_v8a` architectures. +SQLCipher for Android runs on Android 4.1–Android 13, for `armeabi-v7a`, `x86`, `x86_64`, and `arm64_v8a` architectures. ### Contributions @@ -55,11 +55,11 @@ such as having the following line in your module's `build.gradle` `dependencies` closure: ```gradle -implementation "net.zetetic:android-database-sqlcipher:4.5.0" +implementation "net.zetetic:android-database-sqlcipher:4.5.2" implementation "androidx.sqlite:sqlite:2.0.1" ``` -(replacing `4.5.0` with the version you want) +(replacing `4.5.2` with the version you want) @@ -144,11 +144,12 @@ To complete the `make` command, the `ANDROID_NDK_HOME` environment variable must ``` SQLCIPHER_ROOT=/some/path/to/sqlcipher-folder \ OPENSSL_ROOT=/some/path/to/openssl-folder \ -SQLCIPHER_ANDROID_VERSION="4.5.0" \ +SQLCIPHER_CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2" \ +SQLCIPHER_ANDROID_VERSION="4.5.2" \ make build-release ``` -You may also optionally include `SQLCIPHER_CFLAGS` to override the default features SQLCipher core is compiled with. If `SQLCIPHER_CFLAGS` is defined, make sure `-DSQLITE_HAS_CODEC` is included in the list of flags. +You may specify other build flags/features within `SQLCIPHER_CFLAGS`, however, specifying `-DSQLITE_HAS_CODEC` and `-DSQLITE_TEMP_STORE` is necessary in the list of flags. ### License diff --git a/android-database-sqlcipher/build.gradle b/android-database-sqlcipher/build.gradle index 7ed66afd..e80aec7c 100644 --- a/android-database-sqlcipher/build.gradle +++ b/android-database-sqlcipher/build.gradle @@ -24,10 +24,12 @@ android { buildTypes { debug { debuggable true + buildConfigField("String", "VERSION_NAME", "\"${clientVersionNumber}\"") } release { debuggable false minifyEnabled false + buildConfigField("String", "VERSION_NAME", "\"${clientVersionNumber}\"") } } diff --git a/android-database-sqlcipher/maven.gradle b/android-database-sqlcipher/maven.gradle index 3d72a2cb..59389bc7 100644 --- a/android-database-sqlcipher/maven.gradle +++ b/android-database-sqlcipher/maven.gradle @@ -1,4 +1,4 @@ -apply plugin: "maven" +apply plugin: "maven-publish" apply plugin: "signing" import org.gradle.plugins.signing.Sign @@ -36,57 +36,56 @@ gradle.taskGraph.whenReady { taskGraph -> } } -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = mavenGroup - pom.artifactId = mavenArtifactId - pom.version = mavenVersionName - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - pom.project { - name mavenArtifactId - packaging mavenPackaging - description mavenPomDescription - url mavenPomUrl - - scm { - url mavenScmUrl - connection mavenScmConnection - developerConnection mavenScmDeveloperConnection - } +afterEvaluate { project -> + publishing { + publications { + mavenJava(MavenPublication) { + from components.release + groupId = mavenGroup + artifactId = mavenArtifactId + version = mavenVersionName + pom { + name = mavenArtifactId + description = mavenPomDescription + url = mavenPomUrl licenses { license { - url mavenLicenseUrl + url = mavenLicenseUrl } } - developers { developer { - name mavenDeveloperName - email mavenDeveloperEmail - organization mavenDeveloperOrganization - organizationUrl mavenDeveloperUrl + name = mavenDeveloperName + email = mavenDeveloperEmail } } + scm { + connection = mavenScmConnection + developerConnection = mavenScmDeveloperConnection + url = mavenScmUrl + } } } } + repositories { + maven { + def repoUrl = isReleaseBuild() + ? getReleaseRepositoryUrl() + : getSnapshotRepositoryUrl() + url = repoUrl + credentials { + username = getRepositoryUsername() + password = getRepositoryPassword() + } + } + } } signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives + required { isReleaseBuild() && gradle.taskGraph.hasTask("publish") } + sign publishing.publications.mavenJava } task androidSourcesJar(type: Jar) { diff --git a/android-database-sqlcipher/native.gradle b/android-database-sqlcipher/native.gradle index a9c36290..8a04803b 100644 --- a/android-database-sqlcipher/native.gradle +++ b/android-database-sqlcipher/native.gradle @@ -163,7 +163,7 @@ def executeNdkBuild(outputDir, androidMkDirectory, applicationMkFile, "ANDROID_NATIVE_ROOT_DIR": "${androidNativeRootDir}", "NDK_APP_PLATFORM" : "${androidVersion}"] environment(environmentVariables) - commandLine "${android.ndkDirectory}/ndk-build", "V=1", "${ndkBuildType}", + commandLine "ndk-build", "V=1", "${ndkBuildType}", "--environment-overrides", outputDirectory, "-C", androidMkDirectory, applicationFile } diff --git a/android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java b/android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java index 8bf94945..d368c46f 100644 --- a/android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java +++ b/android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java @@ -3180,12 +3180,15 @@ private static ArrayList> getAttachedDbs(SQLiteDatabase dbO } private Pair getResultFromPragma(String command) { + Pair result = new Pair(false, ""); Cursor cursor = rawQuery(command, new Object[]{}); - if(cursor == null) return new Pair(false, ""); - cursor.moveToFirst(); - String value = cursor.getString(0); + if(cursor == null) return result; + if(cursor.moveToFirst()){ + String value = cursor.getString(0); + result = new Pair(true, value); + } cursor.close(); - return new Pair(true, value); + return result; } diff --git a/build.gradle b/build.gradle index 45688c10..be596c39 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath "com.android.tools.build:gradle:3.4.1" + classpath 'com.android.tools.build:gradle:7.2.1' classpath "gradle.plugin.org.ec4j.gradle:editorconfig-gradle-plugin:0.0.3" } } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..2d8d1e4d --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffb59778..8e9cc23a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Fri Jul 08 11:01:47 CDT 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +zipStoreBase=GRADLE_USER_HOME