/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * 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.
 */
plugins {
  id 'com.android.application'
  id 'org.jetbrains.kotlin.android'
  alias libs.plugins.roborazzi
  alias libs.plugins.compose.compiler
}

android {
  compileSdk 36
  namespace "com.example.android.wearable.oauth.devicegrant"

  defaultConfig {
    applicationId "com.example.android.wearable.oauth.devicegrant"
    minSdk 26
    targetSdk 34
    versionCode 1
    versionName "1.0"
  }

  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_17
    targetCompatibility JavaVersion.VERSION_17
  }

  kotlinOptions {
    jvmTarget = JavaVersion.VERSION_17.majorVersion
  }
  buildFeatures {
    compose true
  }
  composeOptions {
    kotlinCompilerExtensionVersion libs.versions.compose.compiler.get()
  }
  testOptions {
    unitTests {
      includeAndroidResources true
    }
  }
}

dependencies {
  def composeBom = platform(libs.androidx.compose.bom)

  // General compose dependencies
  implementation composeBom
  implementation(libs.wear.compose.foundation)

  // For integration between Wear Compose and Androidx Navigation libraries
  implementation(libs.wear.compose.navigation)

  // For Wear preview annotations
  implementation libs.compose.ui.tooling.preview
  implementation(libs.androidx.compose.ui.tooling)

  // Horologist dependencies
  implementation(libs.horologist.compose.layout)

  // Standard android dependencies
  implementation projects.util
  implementation(libs.kotlin.stdlib)
  implementation(libs.androidx.appcompat)
  implementation(libs.androidx.lifecycle.viewmodel.ktx)
  implementation(libs.androidx.fragment.ktx)
  implementation(libs.androidx.wear)
  implementation(libs.wear.remote.interactions)
  implementation(libs.playservices.wearable)

  implementation libs.androidx.ui.test.manifest

  implementation(libs.wear.compose.material3)

  // Needed by Roborazzi
  implementation(libs.androidx.core.ktx)

  // Testing
  testImplementation libs.androidx.ui.test.junit4
  testImplementation libs.junit
  testImplementation libs.robolectric
  testImplementation libs.roborazzi
  testImplementation libs.roborazzi.compose
  testImplementation libs.roborazzi.rule
  testImplementation(libs.horologist.roboscreenshots) {
    exclude(group: "com.github.QuickBirdEng.kotlin-snapshot-testing")
  }

  debugImplementation libs.compose.ui.tooling
  debugImplementation libs.androidx.ui.test.manifest
  debugImplementation composeBom
}
