Skip to content

Commit

Permalink
feat: multiplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jul 10, 2023
1 parent fd999da commit 0076552
Show file tree
Hide file tree
Showing 180 changed files with 4,290 additions and 3,342 deletions.
1 change: 1 addition & 0 deletions _assets/snapshot-1686629593092.json

Large diffs are not rendered by default.

75 changes: 44 additions & 31 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import com.android.build.gradle.internal.cxx.json.jsonStringOf
import java.text.SimpleDateFormat
import java.util.Locale

plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-parcelize")
id("kotlin-kapt")
id("org.jetbrains.kotlin.plugin.serialization")
id("org.jetbrains.kotlin.android")
kotlin("android")
kotlin("plugin.serialization")
id("com.google.devtools.ksp")
id("dev.rikka.tools.refine")
}


@Suppress("UnstableApiUsage")
android {
namespace = "li.songe.gkd"
Expand All @@ -26,12 +31,17 @@ android {
useSupportLibrary = true
}

kapt {
arguments {
// room 依赖每次构建的产物来执行自动迁移
arg("room.schemaLocation", "$projectDir/schemas")
javaCompileOptions {
annotationProcessorOptions {
arguments += mapOf(
"room.schemaLocation" to "$projectDir/schemas",
"room.incremental" to "true"
)
}
}
val nowTime = System.currentTimeMillis()
buildConfigField("Long", "BUILD_TIME", jsonStringOf(nowTime) + "L")
buildConfigField("String", "BUILD_DATE", jsonStringOf(SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZ", Locale.SIMPLIFIED_CHINESE).format(nowTime)))
}

lint {
Expand All @@ -47,18 +57,8 @@ android {
}
}

kotlin {
sourceSets.debug {
kotlin.srcDir("build/generated/ksp/debug/kotlin")
}
sourceSets.release {
kotlin.srcDir("build/generated/ksp/release/kotlin")
}
}

buildTypes {
release {
manifestPlaceholders += mapOf()
isMinifyEnabled = false
setProguardFiles(
listOf(
Expand All @@ -67,31 +67,31 @@ android {
)
)
signingConfig = signingConfigs.getByName("release")
manifestPlaceholders["appName"] = "搞快点"
manifestPlaceholders["appName"] = "GKD"
}
debug {
applicationIdSuffix = ".debug"
signingConfig = signingConfigs.getByName("release")
manifestPlaceholders["appName"] = "搞快点-dev"
manifestPlaceholders["appName"] = "GKD-debug"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

}
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
jvmTarget = JavaVersion.VERSION_17.majorVersion
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
buildFeatures {
buildConfig = true
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
kotlinCompilerExtensionVersion = libs.versions.compose.compilerVersion.get()
}
packagingOptions {
packaging {
resources {
// Due to https://github.com/Kotlin/kotlinx.coroutines/issues/2023
excludes += "META-INF/INDEX.LIST"
Expand All @@ -106,16 +106,20 @@ android {
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-debug")
}
}

// ksp
sourceSets.configureEach {
kotlin.srcDir("$buildDir/generated/ksp/$name/kotlin/")
}
}


dependencies {
implementation(project(mapOf("path" to ":selector_core")))
implementation(project(mapOf("path" to ":router")))

implementation(project(mapOf("path" to ":selector")))
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.localbroadcastmanager)

implementation(libs.compose.ui)
implementation(libs.compose.material)
Expand All @@ -128,28 +132,32 @@ dependencies {
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso)


compileOnly(project(mapOf("path" to ":hidden_api")))
implementation(libs.rikka.shizuku.api)
implementation(libs.rikka.shizuku.provider)
implementation(libs.lsposed.hiddenapibypass)

implementation(libs.tencent.bugly)
implementation(libs.tencent.mmkv)

implementation(libs.androidx.room.runtime)
kapt(libs.androidx.room.compiler)
implementation(libs.androidx.room.ktx)
ksp(libs.androidx.room.compiler)

implementation(libs.ktor.server.core)
implementation(libs.ktor.server.netty)
implementation(libs.ktor.server.cors)
implementation(libs.ktor.server.content.negotiation)

implementation(libs.ktor.client.core)
implementation(libs.ktor.client.cio)
implementation(libs.ktor.client.android)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)

implementation(libs.google.accompanist.drawablepainter)
implementation(libs.google.accompanist.placeholder.material)
implementation(libs.google.accompanist.systemuicontroller)

implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.collections.immutable)
Expand All @@ -160,4 +168,9 @@ dependencies {
implementation(libs.others.zxing.android.embedded)
implementation(libs.others.floating.bubble.view)

implementation(libs.destinations.core)
implementation(libs.destinations.animations)
ksp(libs.destinations.ksp)


}
108 changes: 106 additions & 2 deletions app/schemas/li.songe.gkd.db.AppDatabase/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "2083d8585fffd897fde3733958e356f8",
"identityHash": "f3feda76127233f3416d7570fca1615f",
"entities": [
{
"tableName": "subs_item",
Expand Down Expand Up @@ -149,12 +149,116 @@
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "snapshot",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `app_id` TEXT, `activity_id` TEXT, `app_name` TEXT, `app_version_code` INTEGER, `app_version_name` TEXT, `screen_height` INTEGER NOT NULL, `screen_width` INTEGER NOT NULL, `is_landscape` INTEGER NOT NULL, `device` TEXT NOT NULL, `model` TEXT NOT NULL, `manufacturer` TEXT NOT NULL, `brand` TEXT NOT NULL, `sdk_int` INTEGER NOT NULL, `release` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "appId",
"columnName": "app_id",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "activityId",
"columnName": "activity_id",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "appName",
"columnName": "app_name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "appVersionCode",
"columnName": "app_version_code",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "appVersionName",
"columnName": "app_version_name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "screenHeight",
"columnName": "screen_height",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "screenWidth",
"columnName": "screen_width",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isLandscape",
"columnName": "is_landscape",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "device",
"columnName": "device",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "model",
"columnName": "model",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "manufacturer",
"columnName": "manufacturer",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "brand",
"columnName": "brand",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sdkInt",
"columnName": "sdk_int",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "release",
"columnName": "release",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2083d8585fffd897fde3733958e356f8')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f3feda76127233f3416d7570fca1615f')"
]
}
}
Loading

0 comments on commit 0076552

Please sign in to comment.