Skip to content

Commit

Permalink
Merge pull request #636 from supabase-community/move-chat-demo
Browse files Browse the repository at this point in the history
Move chat demo to root project & improve chat demo
  • Loading branch information
jan-tennert authored Jul 1, 2024
2 parents 5e08dec + ea11145 commit 2c3f973
Show file tree
Hide file tree
Showing 97 changed files with 236 additions and 3,519 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tests:

samples:
- changed-files:
- any-glob-to-any-file: samples/**
- any-glob-to-any-file: sample/**

serializers:
- changed-files:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: false
- name: Test supabase-kt
run: ./gradlew build test --stacktrace --configuration-cache --scan
run: ./gradlew -DLibrariesOnly=true build test --stacktrace --configuration-cache --scan
2 changes: 1 addition & 1 deletion .github/workflows/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/development' }}
- name: Analyze code using detekt
run: ./gradlew detektAll --stacktrace --configuration-cache
run: ./gradlew -DLibrariesOnly=true detektAll --stacktrace --configuration-cache
2 changes: 1 addition & 1 deletion .github/workflows/dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: true
- name: Build multi-module GH pages
run: ./gradlew dokkaHtmlMultiModule
run: ./gradlew -DLibrariesOnly=true dokkaHtmlMultiModule
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: true
- name: Publish
run: ./gradlew publishAllPublicationsToMavenCentral
run: ./gradlew -DLibrariesOnly=true publishAllPublicationsToMavenCentral
- name: Close and release
if: inputs.close_and_release
run: ./gradlew releaseRepository --configuration-cache
run: ./gradlew -DLibrariesOnly=true releaseRepository --configuration-cache
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: true
- name: Test supabase-kt
run: ./gradlew ${{ matrix.command }} --stacktrace --configuration-cache
run: ./gradlew -DLibrariesOnly=true ${{ matrix.command }} --stacktrace --configuration-cache
2 changes: 1 addition & 1 deletion GoTrue/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ kotlin {
}
}

configureAndroidTarget()
configureLibraryAndroidTarget()
2 changes: 1 addition & 1 deletion Postgrest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ kotlin {
}
}

configureAndroidTarget()
configureLibraryAndroidTarget()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ val iosMain by getting {

# Samples

- [Chat Demo (Desktop/Android/iOS/Browser)](https://github.com/supabase-community/supabase-kt/tree/master/demos/chat-demo-mpp)
- [Chat Demo (Desktop/Android/iOS/Browser)](/sample/chat-demo-mpp)
- [File Upload Demo (Desktop/Android)](https://github.com/supabase-community/supabase-kt/tree/master/demos/file-upload)
- [Android Native Google login & in-app OAuth (Android)](https://github.com/supabase-community/supabase-kt/tree/master/demos/android-login)
- [Multi-Factor Authentication (Desktop/Android/Browser)](https://github.com/supabase-community/supabase-kt/tree/master/demos/multi-factor-authentication)
Expand Down
2 changes: 1 addition & 1 deletion Realtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ kotlin {
}
}

configureAndroidTarget()
configureLibraryAndroidTarget()
2 changes: 1 addition & 1 deletion Storage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ kotlin {
}
}

configureAndroidTarget()
configureLibraryAndroidTarget()
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ kotlin {
}
}

configureAndroidTarget()
configureLibraryAndroidTarget()
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ dependencies {
implementation(libs.detekt.gradle)
implementation(libs.dokka.gradle)
implementation(libs.publishing.gradle)
implementation(libs.compose.gradle)
}
40 changes: 35 additions & 5 deletions buildSrc/src/main/kotlin/Android.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,54 @@
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get

fun Project.configureAndroidTarget() {
fun Project.configureLibraryAndroidTarget(
namespace: String? = null,
minSdk: Int = 21,
javaVersion: JavaVersion = JavaVersion.VERSION_1_8
) {
extensions.configure(LibraryExtension::class) {
compileSdk = 34
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
namespace = "${extra["base-group"].toString().replace("-", ".")}.${this@configureAndroidTarget.name.replace("-", "")}.library"
this.namespace = namespace ?: "${extra["base-group"].toString().replace("-", ".")}.${this@configureLibraryAndroidTarget.name.replace("-", "")}.library"
defaultConfig {
minSdk = 21
this.minSdk = minSdk
}
lint {
abortOnError = false
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
}
}

fun Project.configureApplicationAndroidTarget() {
extensions.configure(BaseAppModuleExtension::class) {
compileSdk = 34
defaultConfig {
applicationId = "io.github.jan.supabase.android"
minSdk = 26
versionCode = 1
versionName = "1.0-SNAPSHOT"
}
namespace = "io.github.jan.supabase.android"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
/*kotlinOptions {
jvmTarget = "11"
}*/
}
}
36 changes: 36 additions & 0 deletions buildSrc/src/main/kotlin/Sample.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.jetbrains.compose.desktop.DesktopExtension
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler

enum class SupabaseModule(val module: String) {
GOTRUE("gotrue-kt"),
STORAGE("storage-kt"),
REALTIME("realtime-kt"),
FUNCTIONS("functions-kt"),
POSTGREST("postgrest-kt"),
COMPOSE_AUTH("plugins:compose-auth"),
COMPOSE_AUTH_UI("plugins:compose-auth-ui"),
}

fun KotlinDependencyHandler.addModules(vararg modules: SupabaseModule) {
modules.forEach {
api(project(":${it.module}"))
}
}

fun Project.configureComposeDesktop(
name: String,
) {
extensions.configure(DesktopExtension::class) {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = name
packageVersion = "1.0.0"
}
}
}
}
46 changes: 0 additions & 46 deletions demos/chat-demo-mpp/.gitignore

This file was deleted.

37 changes: 0 additions & 37 deletions demos/chat-demo-mpp/android/build.gradle.kts

This file was deleted.

19 changes: 0 additions & 19 deletions demos/chat-demo-mpp/build.gradle.kts

This file was deleted.

9 changes: 0 additions & 9 deletions demos/chat-demo-mpp/buildSrc/build.gradle.kts

This file was deleted.

8 changes: 0 additions & 8 deletions demos/chat-demo-mpp/buildSrc/src/main/kotlin/Versions.kt

This file was deleted.

39 changes: 0 additions & 39 deletions demos/chat-demo-mpp/desktop/build.gradle.kts

This file was deleted.

6 changes: 0 additions & 6 deletions demos/chat-demo-mpp/gradle.properties

This file was deleted.

Loading

0 comments on commit 2c3f973

Please sign in to comment.