Skip to content

Commit

Permalink
Merge pull request #69 from kennethshackleton/readme-dependency
Browse files Browse the repository at this point in the history
Instructions for integrating Selekt.
  • Loading branch information
kennethshackleton authored Apr 9, 2021
2 parents ac63bc0 + 43b99ae commit 4199e25
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/<year>/${{ env.YEAR }}/g' docs/*.md
sed -i 's/<year>/${{ env.YEAR }}/g' mkdocs.yml
sed -i 's/<version>/${{ env.VERSION }}/g' docs/*.md
mkdocs gh-deploy -m 'Automatic mkdocs deployment.'
25 changes: 2 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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

Expand Down
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/SelektExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T> NamedDomainObjectContainer<T>.debug: T get() = requireNotNull(getByName("debug"))

Expand Down Expand Up @@ -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/")
}
24 changes: 24 additions & 0 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
## Integration

### Gradle

=== "Kotlin"
``` kotlin
repositories {
mavenCentral()
}

dependencies {
implementation("com.bloomberg:selekt-android:<version>")
}
```

=== "Groovy"
``` groovy
repositories {
mavenCentral()
}

dependencies {
implementation('com.bloomberg:selekt-android:<version>')
}
```

## Getting a database

### Using an open helper
Expand Down
33 changes: 32 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -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 <year> Bloomberg Finance L.P.
Expand All @@ -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.
```
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 4199e25

Please sign in to comment.