Skip to content

Commit

Permalink
Merge pull request #37 from erikeelde/library_release
Browse files Browse the repository at this point in the history
Libraries release
  • Loading branch information
erikeelde authored May 6, 2021
2 parents c8fa982 + 2f98b1c commit 9f9a0ec
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
run: ./gradlew check --exclude-task testReleaseUnitTest

- name: Publish application
run: ./gradlew :toggles-app:publish
run: ./gradlew :toggles-app:publishRelease
16 changes: 7 additions & 9 deletions .github/workflows/core-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ jobs:

- name: Setup environment
run: |
mkdir -p ~/.gradle
touch ~/.gradle/gradle.properties
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> ~/.gradle/gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=~/.gradle/secring.gpg" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> gradle.properties
echo "signing.secretKeyRingFile=../secring.gpg" >> gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > secring.gpg.b64
base64 -d secring.gpg.b64 > secring.gpg
- name: Publish core library
run: ./gradlew :toggles-core:publish --no-daemon --no-parallel
16 changes: 7 additions & 9 deletions .github/workflows/flow-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ jobs:

- name: Setup environment
run: |
mkdir -p ~/.gradle
touch ~/.gradle/gradle.properties
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> ~/.gradle/gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=~/.gradle/secring.gpg" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> gradle.properties
echo "signing.secretKeyRingFile=../secring.gpg" >> gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > secring.gpg.b64
base64 -d secring.gpg.b64 > secring.gpg
- name: Publish flow library
run: ./gradlew :toggles-flow:publish --no-daemon --no-parallel
16 changes: 7 additions & 9 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ jobs:

- name: Setup environment
run: |
mkdir -p ~/.gradle
touch ~/.gradle/gradle.properties
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> ~/.gradle/gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=~/.gradle/secring.gpg" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> gradle.properties
echo "signing.secretKeyRingFile=secring.gpg" >> gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > secring.gpg.b64
base64 -d secring.gpg.b64 > secring.gpg
- name: Publish core library
run: ./gradlew :toggles-prefs:publish --no-daemon --no-parallel
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/prefs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ jobs:

- name: Setup environment
run: |
mkdir -p ~/.gradle
touch ~/.gradle/gradle.properties
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> ~/.gradle/gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=~/.gradle/secring.gpg" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> ~/.gradle/gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> ~/.gradle/gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
echo "signing.keyId=${{secrets.SIGNING_KEYID}}" >> gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> gradle.properties
echo "signing.secretKeyRingFile=../secring.gpg" >> gradle.properties
echo "mavenCentralRepositoryUsername=${{secrets.MAVEN_CENTRAL_REPOSITORY_USERNAME}}" >> gradle.properties
echo "mavenCentralRepositoryPassword=${{secrets.MAVEN_CENTRAL_REPOSITORY_PASSWORD}}" >> gradle.properties
echo "${{secrets.SECRING_GPG_B64}}" > secring.gpg.b64
base64 -d secring.gpg.b64 > secring.gpg
- name: Publish prefs library
run: ./gradlew :toggles-prefs:publish --no-daemon --no-parallel
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Development tool to store app settings / feature toggles in an external application making in persist across clean data / reinstallations.

##

## Toggles app

Toggles can be downloaded on [play store](https://play.google.com/store/apps/details?id=se.eelde.toggles).
Expand All @@ -13,13 +11,25 @@ Stores settings / toggles behind a content provider.

This is a development tools meant to facilitate feature switching in an external app so that configurations will be retained across clear data / uninstalls.

2 premade libraries to talk to the toggles application. "Prefs" and "Flow":
2 premade libraries to talk to the toggles application. "Prefs" and "Flow" - Backed by a common core library:

## Toggles-flow library
Exposes switches from toggles using a kotlin flow.
```
implementation("se.eelde.toggles:toggles-flow:0.0.1")
```

## Toggles-prefs library
One-shot fetch of a toggle. Similar API as androids SharedPreferences.
```
implementation("se.eelde.toggles:toggles-prefs:0.0.1")
```

## Toggles-core library
Base library exposing common bit to help communicating with the toggles application via the provider. Generally shouldn't be needed unless implementing your own library.
```
implementation("se.eelde.toggles:toggles-core:0.0.2")
```

#### Previously known as wrench
The idea dates way back to and was inspired by the now removed [Dash Clock Widget](https://play.google.com/store/apps/details?id=net.nurik.roman.dashclock) as well as the still maintained [muzei](https://play.google.com/store/apps/details?id=net.nurik.roman.muzei).
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ allprojects {
google()
mavenCentral()
jcenter()
maven("https://s01.oss.sonatype.org/service/local/repositories/seeelde-1001/content")
}
}

Expand Down
13 changes: 8 additions & 5 deletions toggles-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ android {
applicationId = "se.eelde.toggles"
minSdk = 21
targetSdk = 30
versionCode = 5
versionName = "1.01.01"
versionCode = 6
versionName = "1.01.02"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -202,9 +202,12 @@ dependencies {
implementation("androidx.navigation:navigation-ui-ktx:2.3.5")

implementation("com.izettle.wrench:wrench-core:0.3")
implementation(project(":toggles-core"))
implementation(project(":toggles-prefs"))
implementation(project(":toggles-flow"))
// implementation(project(":toggles-core"))
// implementation(project(":toggles-prefs"))
// implementation(project(":toggles-flow"))
implementation("se.eelde.toggles:toggles-core:0.0.2")
implementation("se.eelde.toggles:toggles-flow:0.0.1")
implementation("se.eelde.toggles:toggles-prefs:0.0.1")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3")

Expand Down
1 change: 0 additions & 1 deletion toggles-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ kotlin {
}

dependencies {
implementation("androidx.core:core-ktx:1.3.2")
testImplementation("junit:junit:4.13.2")
implementation("androidx.annotation:annotation:1.2.0")
}
2 changes: 1 addition & 1 deletion toggles-core/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
POM_ARTIFACT_ID=toggles-core
POM_NAME=Toggles Core
VERSION_NAME=0.0.2-SNAPSHOT
VERSION_NAME=0.0.3-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import android.content.ContentValues
import android.database.Cursor
import android.net.Uri
import androidx.annotation.StringDef
import androidx.core.database.getLongOrNull
import androidx.core.database.getStringOrNull

class ColumnNames {
object Toggle {
Expand Down Expand Up @@ -85,15 +83,29 @@ data class Toggle(
@JvmStatic
fun fromCursor(cursor: Cursor): Toggle {
return Toggle(
id = cursor.getLongOrNull(cursor.getColumnIndexOrThrow(ColumnNames.Toggle.COL_ID))!!,
type = cursor.getStringOrNull(cursor.getColumnIndexOrThrow(ColumnNames.Toggle.COL_TYPE))!!,
key = cursor.getStringOrNull(cursor.getColumnIndexOrThrow(ColumnNames.Toggle.COL_KEY))!!,
value = cursor.getStringOrNull(cursor.getColumnIndexOrThrow(ColumnNames.Toggle.COL_VALUE))
id = cursor.getLongOrThrow(ColumnNames.Toggle.COL_ID),
type = cursor.getStringOrThrow(ColumnNames.Toggle.COL_TYPE),
key = cursor.getStringOrThrow(ColumnNames.Toggle.COL_KEY),
value = cursor.getStringOrNull(ColumnNames.Toggle.COL_VALUE)
)
}
}
}

private fun Cursor.getStringOrThrow(columnName: String): String = getStringOrNull(columnName)!!

private fun Cursor.getStringOrNull(columnName: String): String? {
val index = getColumnIndexOrThrow(columnName)
return if (isNull(index)) null else getString(index)
}

private fun Cursor.getLongOrThrow(columnName: String): Long = getLongOrNull(columnName)!!

private fun Cursor.getLongOrNull(columnName: String): Long? {
val index = getColumnIndexOrThrow(columnName)
return if (isNull(index)) null else getLong(index)
}

object TogglesProviderContract {
private const val TOGGLES_AUTHORITY = BuildConfig.TOGGLES_AUTHORITY
private const val TOGGLES_API_VERSION_QUERY_PARAM = "API_VERSION"
Expand Down
8 changes: 2 additions & 6 deletions toggles-flow/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ kotlin {
explicitApi()
}

repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
}

dependencies {
testImplementation("junit:junit:4.13.2")

Expand All @@ -59,8 +55,8 @@ dependencies {
testImplementation("androidx.test.ext:junit:1.1.2")
testImplementation("org.robolectric:robolectric:4.5.1")

//implementation("se.eelde.toggles:toggles-core:0.0.1")
implementation("se.eelde.toggles:toggles-core:0.0.2-SNAPSHOT")
implementation("se.eelde.toggles:toggles-core:0.0.2")
//implementation("se.eelde.toggles:toggles-core:0.0.2-SNAPSHOT")
//implementation(project(":toggles-core"))
implementation("androidx.annotation:annotation:1.2.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3")
Expand Down
2 changes: 1 addition & 1 deletion toggles-flow/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
POM_ARTIFACT_ID=toggles-flow
POM_NAME=Toggles Flow
VERSION_NAME=0.0.1-SNAPSHOT
VERSION_NAME=0.0.2-SNAPSHOT
8 changes: 2 additions & 6 deletions toggles-prefs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ kotlin {
explicitApi()
}

repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
}

dependencies {
testImplementation("junit:junit:4.13.2")

Expand All @@ -56,8 +52,8 @@ dependencies {
testImplementation("androidx.test.ext:junit:1.1.2")
testImplementation("org.robolectric:robolectric:4.5.1")

//implementation("se.eelde.toggles:toggles-core:0.0.1")
implementation("se.eelde.toggles:toggles-core:0.0.2-SNAPSHOT")
implementation("se.eelde.toggles:toggles-core:0.0.2")
//implementation("se.eelde.toggles:toggles-core:0.0.2-SNAPSHOT")
//implementation(project(":toggles-core"))
implementation("androidx.annotation:annotation:1.2.0")
}
2 changes: 1 addition & 1 deletion toggles-prefs/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
POM_ARTIFACT_ID=toggles-prefs
POM_NAME=Toggles Prefs
VERSION_NAME=0.0.1-SNAPSHOT
VERSION_NAME=0.0.2-SNAPSHOT
8 changes: 4 additions & 4 deletions toggles-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ dependencies {
implementation("androidx.navigation:navigation-fragment-ktx:2.3.5")
implementation("androidx.navigation:navigation-ui-ktx:2.3.5")

implementation(project(":toggles-prefs"))
implementation(project(":toggles-flow"))
// implementation("se.eelde.toggles:toggles-flow:0.0.1-SNAPSHOT")
// implementation("se.eelde.toggles:toggles-prefs:0.0.1-SNAPSHOT")
// implementation(project(":toggles-prefs"))
// implementation(project(":toggles-flow"))
implementation("se.eelde.toggles:toggles-flow:0.0.1")
implementation("se.eelde.toggles:toggles-prefs:0.0.1")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3")

Expand Down

0 comments on commit 9f9a0ec

Please sign in to comment.