|
| 1 | +import org.jetbrains.compose.desktop.application.dsl.TargetFormat |
| 2 | +import org.jetbrains.kotlin.gradle.dsl.JvmTarget |
| 3 | + |
| 4 | +plugins { |
| 5 | + alias(libs.plugins.kotlinMultiplatform) |
| 6 | + alias(libs.plugins.androidApplication) |
| 7 | + alias(libs.plugins.composeMultiplatform) |
| 8 | + alias(libs.plugins.composeCompiler) |
| 9 | + |
| 10 | + // Add Kotlin serialization plugin for Koog API support |
| 11 | + kotlin("plugin.serialization") version "2.2.0" |
| 12 | +} |
| 13 | + |
| 14 | +kotlin { |
| 15 | + androidTarget { |
| 16 | + compilerOptions { |
| 17 | + jvmTarget.set(JvmTarget.JVM_17) |
| 18 | + } |
| 19 | + } |
| 20 | + |
| 21 | + sourceSets { |
| 22 | + androidMain.dependencies { |
| 23 | + implementation(compose.preview) |
| 24 | + implementation(libs.androidx.activity.compose) |
| 25 | + } |
| 26 | + commonMain.dependencies { |
| 27 | + implementation(compose.runtime) |
| 28 | + implementation(compose.foundation) |
| 29 | + implementation(compose.material3) |
| 30 | + implementation(compose.ui) |
| 31 | + implementation(libs.androidx.material.icons.core) |
| 32 | + implementation(compose.components.resources) |
| 33 | + implementation(compose.components.uiToolingPreview) |
| 34 | + implementation(libs.androidx.lifecycle.viewmodelCompose) |
| 35 | + implementation(libs.androidx.lifecycle.runtimeCompose) |
| 36 | + implementation(libs.opentelemetry.logback.appender.x.x) |
| 37 | + implementation(libs.slf4j.api) |
| 38 | + implementation(libs.logback.android) |
| 39 | + } |
| 40 | + commonTest.dependencies { |
| 41 | + implementation(libs.kotlin.test) |
| 42 | + } |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +android { |
| 47 | + namespace = "com.example.koog_example" |
| 48 | + compileSdk = libs.versions.android.compileSdk.get().toInt() |
| 49 | + |
| 50 | + defaultConfig { |
| 51 | + applicationId = "com.example.koog_example" |
| 52 | + minSdk = libs.versions.android.minSdk.get().toInt() |
| 53 | + targetSdk = libs.versions.android.targetSdk.get().toInt() |
| 54 | + versionCode = 1 |
| 55 | + versionName = "1.0" |
| 56 | + |
| 57 | + // 環境変数から読み込んでBuildConfigに埋め込む |
| 58 | + buildConfigField("String", "AWS_ACCESS_KEY_ID", "\"${System.getenv("AWS_ACCESS_KEY_ID") ?: ""}\"") |
| 59 | + buildConfigField("String", "AWS_SECRET_ACCESS_KEY", "\"${System.getenv("AWS_SECRET_ACCESS_KEY") ?: ""}\"") |
| 60 | + buildConfigField("String", "AWS_SESSION_TOKEN", "\"${System.getenv("AWS_SESSION_TOKEN") ?: ""}\"") |
| 61 | + buildConfigField("String", "AWS_REGION", "\"${System.getenv("AWS_REGION") ?: "us-west-2"}\"") |
| 62 | + |
| 63 | + buildConfigField("String", "OTLP_BACKEND", "\"${System.getenv("OTLP_BACKEND") ?: ""}\"") |
| 64 | + buildConfigField("String", "OTLP_ENDPOINT", "\"${System.getenv("OTLP_ENDPOINT") ?: "http://10.0.2.2:4318/v1/traces"}\"") |
| 65 | + buildConfigField("String", "OTLP_HEADERS", "\"${System.getenv("LANGFUSE_API_KEY") ?: ""}\"") |
| 66 | + } |
| 67 | + packaging { |
| 68 | + resources { |
| 69 | + excludes += "/META-INF/{AL2.0,LGPL2.1}" |
| 70 | + } |
| 71 | + dex { |
| 72 | + useLegacyPackaging = false |
| 73 | + } |
| 74 | + } |
| 75 | + buildTypes { |
| 76 | + getByName("release") { |
| 77 | + isMinifyEnabled = true |
| 78 | + // 検証コードなのでproguard設定はしない |
| 79 | + } |
| 80 | + getByName("debug") { |
| 81 | + applicationIdSuffix = ".debug" |
| 82 | + isDebuggable = true |
| 83 | + } |
| 84 | + } |
| 85 | + compileOptions { |
| 86 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 87 | + targetCompatibility = JavaVersion.VERSION_17 |
| 88 | + } |
| 89 | + |
| 90 | + buildFeatures { |
| 91 | + buildConfig = true |
| 92 | + } |
| 93 | +} |
| 94 | + |
| 95 | +dependencies { |
| 96 | + debugImplementation(compose.uiTooling) |
| 97 | + implementation(libs.koog.agents) |
| 98 | + implementation(libs.opentelemetry.exporter.otlp) |
| 99 | + implementation(libs.opentelemetry.exporter.logging) |
| 100 | +} |
| 101 | + |
| 102 | +repositories { |
| 103 | + google() |
| 104 | + // Use Maven Central for resolving dependencies. |
| 105 | + mavenCentral() |
| 106 | + // Add JetBrains repository for Koog framework |
| 107 | + maven { |
| 108 | + url = uri("https://packages.jetbrains.team/maven/p/grazi/grazie-platform-public") |
| 109 | + } |
| 110 | +} |
| 111 | + |
| 112 | +configurations.all { |
| 113 | + // FIXME exclude netty from Koog dependencies? |
| 114 | + exclude(group = "io.netty", module = "*") |
| 115 | + exclude(group = "org.apache.httpcomponents.httpclient5", module = "*") |
| 116 | + exclude(group = "org.apache.httpcomponents.core5", module = "*") |
| 117 | +} |
0 commit comments