From 43b99ae569485a536ff6b29d8657a4b309965f5b Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Tue, 30 Mar 2021 09:35:05 +0100 Subject: [PATCH] Instructions for integrating Selekt. Signed-off-by: Kenneth J. Shackleton --- .github/workflows/publish-documentation.yml | 3 ++ README.md | 25 ++------------- build.gradle.kts | 10 +++--- buildSrc/src/main/kotlin/SelektExtensions.kt | 4 +-- docs/getting_started.md | 24 ++++++++++++++ docs/index.md | 33 +++++++++++++++++++- gradle.properties | 2 +- 7 files changed, 69 insertions(+), 32 deletions(-) diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index c08fe99df9..b28fa2e82a 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -39,9 +39,12 @@ jobs: run: | export ANDROID_NDK_HOME="${ANDROID_HOME}/ndk/21.3.6528147" ./gradlew :AndroidLib:dokkaGfm :ApiLib:dokkaGfm + - name: 'Set version' + run: echo "VERSION=$(grep -hnr 'versionName' gradle.properties | sed 's/.*=//')" >> $GITHUB_ENV - name: 'Mkdocs' run: | git fetch origin gh-pages:gh-pages sed -i 's//${{ env.YEAR }}/g' docs/*.md sed -i 's//${{ env.YEAR }}/g' mkdocs.yml + sed -i 's//${{ env.VERSION }}/g' docs/*.md mkdocs gh-deploy -m 'Automatic mkdocs deployment.' diff --git a/README.md b/README.md index d0920856c1..b3a6c0975d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Coverage Status](https://codecov.io/gh/bloomberg/selekt/branch/main/graph/badge.svg)](https://codecov.io/gh/bloomberg/selekt) [![Apache 2.0](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE) +[![Maven Central](https://img.shields.io/maven-central/v/com.bloomberg/selekt-android.svg)](https://search.maven.org/artifact/com.bloomberg/selekt-android) Selekt is a Kotlin and familiar Android wrapper over [SQLCipher](https://www.zetetic.net/sqlcipher/), an SQLite extension that provides 256-bit AES encryption of database files. Selekt realises the maximum concurrency offered by SQLite3. @@ -22,29 +23,7 @@ Selekt sits somewhere between the two: Selekt also uses SQLCipher to encrypt dat ## Quick Start -### Creating a database with an open helper - -```kt -object MyOpenHelperCallback : ISQLiteOpenHelper.Callback { - override fun onCreate(database: SQLiteDatabase) { - database.exec("CREATE TABLE 'Foo' (bar INT)") - } - - override fun onUpgrade(database: SQLiteDatabase, oldVersion: Int, newVersion: Int) = Unit -} - -fun deriveKey(): ByteArray? = TODO("Optional key, must be exactly 32-bytes long.") - -val databaseHelper = SQLiteOpenHelper( - context = context.applicationContext, - configuration = ISQLiteOpenHelper.Configuration( - callback = MyOpenHelperCallback, - key = deriveKey(), - name = "sample" - ), - version = 3 -) -``` +Please refer to the [main documentation](https://bloomberg.github.io/selekt/getting_started/). ## Contributions diff --git a/build.gradle.kts b/build.gradle.kts index 79f45b321a..dd29d3e78c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -66,27 +66,27 @@ subprojects { subprojects { configurations.all { resolutionStrategy.dependencySubstitution { - substitute(module("com.bloomberg.selekt:selekt-android")).apply { + substitute(module("com.bloomberg:selekt-android")).apply { with(project(":AndroidLib")) @Suppress("UnstableApiUsage") because("we work with an unreleased version") } - substitute(module("com.bloomberg.selekt:selekt-annotations")).apply { + substitute(module("com.bloomberg:selekt-annotations")).apply { with(project(":Annotations")) @Suppress("UnstableApiUsage") because("we work with an unreleased version") } - substitute(module("com.bloomberg.selekt:selekt-api")).apply { + substitute(module("com.bloomberg:selekt-api")).apply { with(project(":ApiLib")) @Suppress("UnstableApiUsage") because("we work with an unreleased version") } - substitute(module("com.bloomberg.selekt:selekt-java")).apply { + substitute(module("com.bloomberg:selekt-java")).apply { with(project(":Lib")) @Suppress("UnstableApiUsage") because("we work with an unreleased version") } - substitute(module("com.bloomberg.selekt:selekt-sqlite3")).apply { + substitute(module("com.bloomberg:selekt-sqlite3")).apply { with(project(":SQLite3")) @Suppress("UnstableApiUsage") because("we work with an unreleased version") diff --git a/buildSrc/src/main/kotlin/SelektExtensions.kt b/buildSrc/src/main/kotlin/SelektExtensions.kt index 5c597e0989..d1603a6ee8 100644 --- a/buildSrc/src/main/kotlin/SelektExtensions.kt +++ b/buildSrc/src/main/kotlin/SelektExtensions.kt @@ -31,7 +31,7 @@ fun DependencyHandler.kotlinX(module: String, version: String? = null): Any = "org.jetbrains.kotlinx:kotlinx-$module${version?.let { ":$version" } ?: ""}" fun DependencyHandler.selekt(module: String, version: String? = null): Any = - "com.bloomberg.selekt:selekt-$module${version?.let { ":$version" } ?: ""}" + "com.bloomberg:selekt-$module${version?.let { ":$version" } ?: ""}" val NamedDomainObjectContainer.debug: T get() = requireNotNull(getByName("debug")) @@ -128,5 +128,5 @@ fun MavenPom.commonInitialisation(project: Project) { tag.set(project.gitCommit()) url.set("https://github.com/bloomberg/Selekt") } - url.set("https://github.com/bloomberg/selekt") + url.set("https://bloomberg.github.io/selekt/") } diff --git a/docs/getting_started.md b/docs/getting_started.md index c9eed44b91..4109178f08 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -1,5 +1,29 @@ ## Integration +### Gradle + +=== "Kotlin" + ``` kotlin + repositories { + mavenCentral() + } + + dependencies { + implementation("com.bloomberg:selekt-android:") + } + ``` + +=== "Groovy" + ``` groovy + repositories { + mavenCentral() + } + + dependencies { + implementation('com.bloomberg:selekt-android:') + } + ``` + ## Getting a database ### Using an open helper diff --git a/docs/index.md b/docs/index.md index 7357df9fab..cbf468f072 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,8 @@ Selekt is a Kotlin and familiar Android wrapper over SQLCipher, an SQLite extension that provides 256-bit AES encryption of database files. Selekt realises the maximum concurrency offered by SQLite3. -## License +## Licenses + +### Selekt ``` Copyright Bloomberg Finance L.P. @@ -17,3 +19,32 @@ 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. ``` + +### SQLCipher + +``` +Copyright (c) 2008, ZETETIC LLC +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the ZETETIC LLC nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` diff --git a/gradle.properties b/gradle.properties index f3cfbdd8eb..afdc0f2cd8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -selekt.versionName=0.12.1 +selekt.versionName=0.12.2 org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx2048m -XX:MaxPermSize=1024m