// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.KSP_VERSION = '2.1.20-2.0.0'
    ext.KOTLIN = '2.1.20'
    ext.versions = [
            'androidXTestCore'       : '1.4.0',
            'androidXTestRules'      : '1.4.0',
            'assertJ'                : '3.16.1',
            'compose'                : '1.6.7',
            'composeActivity'        : '1.9.0',
            'composeConstraintLayout': '1.0.1',
            'composeNavigation'      : '2.7.7',
            'detekt'                 : '1.23.6',
            'espresso'               : '3.2.0',
            'gradle'                 : '8.9.1',
            'junit'                  : '4.13.2',
            'junitImplementation'    : '1.1.2',
            'kotlinCompileTesting'   : '0.8.0',
            'kotlinPoet'             : '1.12.0',
            'ksp'                    : "$KSP_VERSION",
            'ktx'                    : '1.1.0',
            'lifecycle'              : '2.6.2',
            'paparazzi'              : '2.0.0-alpha02',
            'picasso'                : '2.8',
            'appcompat'              : '1.6.1',
            'testRunner'             : '1.4.0',
            'testParameterInjector'  : '1.8',
            'googleTruth'            : '1.1.3',
            'material'               : '1.4.0',
            'mavenPublish'           : '0.34.0',
            'mdcComposeThemeAdapter' : '1.0.2',
            'strikt'                 : '0.33.0',
            'xprocessing'            : '2.7.0',
            'corektx'                : '1.7.0',
            'shot'                   : '6.0.0'
    ]
    ext.deps = [
            'compose'                : [
                    'activityCompose'   : "androidx.activity:activity-compose:${versions.composeActivity}",
                    'composeNavigation' : "androidx.navigation:navigation-compose:${versions.composeNavigation}",
                    'composeRuntime'    : "androidx.compose.runtime:runtime:${versions.compose}",
                    'constraintLayout'  : "androidx.constraintlayout:constraintlayout-compose:${versions.composeConstraintLayout}",
                    'core'              : "androidx.compose.ui:ui:${versions.compose}",
                    'foundation'        : "androidx.compose.foundation:foundation:${versions.compose}",
                    'tooling'           : "androidx.compose.ui:ui-tooling:${versions.compose}",
                    'toolingPreview'    : "androidx.compose.ui:ui-tooling-preview:${versions.compose}",
                    'layout'            : "androidx.compose.foundation:foundation-layout:${versions.compose}",
                    'material'          : "androidx.compose.material:material:${versions.compose}",
                    'savedInstanceState': "androidx.compose.runtime:runtime-saveable:${versions.compose}",
                    'uiTest'            : "androidx.compose.ui:ui-test-junit4:${versions.compose}",
                    'uiLiveData'        : "androidx.compose.runtime:runtime-livedata:${versions.compose}"
            ],
            'kotlinCompileTesting'   : "dev.zacsweers.kctfork:core:${versions.kotlinCompileTesting}",
            'kotlinCompileTestingKsp': "dev.zacsweers.kctfork:ksp:${versions.kotlinCompileTesting}",
            'kotlinPoet'             : "com.squareup:kotlinpoet:${versions.kotlinPoet}",
            'kotlinJavaPoetInterop'  : "com.squareup:kotlinpoet-javapoet:${versions.kotlinPoet}",
            'kotlinXMetadata'        : "org.jetbrains.kotlin:kotlin-metadata-jvm:$KOTLIN",
            'ksp'                    : "com.google.devtools.ksp:symbol-processing-api:${versions.ksp}",
            'imageLoading'           : [
                    'picasso': "com.squareup.picasso:picasso:${versions.picasso}"
            ],
            'support'                : [
                    'appCompat'          : "androidx.appcompat:appcompat:${versions.appcompat}",
                    'ktx'                : "androidx.core:core-ktx:${versions.corektx}",
                    'lifecycleComposeViewModel' : "androidx.lifecycle:lifecycle-viewmodel-compose:${versions.lifecycle}",
                    'lifecycleComposeRuntime' : "androidx.lifecycle:lifecycle-runtime-compose:${versions.lifecycle}",
            ],
            'test'                   : [
                    'androidXTestCore'     : "androidx.test:core:${versions.androidXTestCore}",
                    'androidXTestRules'    : "androidx.test:rules:${versions.androidXTestRules}",
                    'assertJ'              : "org.assertj:assertj-core:${versions.assertJ}",
                    'googleTruth'          : "com.google.truth:truth:${versions.googleTruth}",
                    'junit'                : "junit:junit:${versions.junit}",
                    'junitImplementation'  : "androidx.test.ext:junit:${versions.junitImplementation}",
                    'androidxTestRunner'   : "androidx.test:runner:${versions.testRunner}",
                    'strikt'               : "io.strikt:strikt-core:${versions.strikt}",
                    'shotAndroid'          : "com.karumi:shot-android:${versions.shot}",
                    'testParameterInjector': "com.google.testparameterinjector:test-parameter-injector:${versions.testParameterInjector}",
                    'paparazzi'            : "app.cash.paparazzi:paparazzi:${versions.paparazzi}"
            ],
            'material'               : [
                    'material'              : "com.google.android.material:material:${versions.material}",
                    'mdcComposeThemeAdapter': "com.google.android.material:compose-theme-adapter:${versions.mdcComposeThemeAdapter}"
            ],
            'xprocessing'            : "androidx.room:room-compiler-processing:${versions.xprocessing}",
            'xprocessingTesting'     : "androidx.room:room-compiler-processing-testing:${versions.xprocessing}",
    ]
    ext.MAVEN_PUBLISH_VERSION = versions.mavenPublish
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:${versions.gradle}"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN"
        classpath "com.karumi:shot:${versions.shot}"
        classpath "com.vanniktech:gradle-maven-publish-plugin:${versions.mavenPublish}"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id "io.gitlab.arturbosch.detekt" version "1.23.6"
    id "com.google.devtools.ksp" version "$KSP_VERSION"
    id "com.vanniktech.maven.publish" version "$MAVEN_PUBLISH_VERSION"
    id "org.jetbrains.kotlin.plugin.compose" version "$KOTLIN"
}

allprojects {
    apply from: "$rootDir/detekt/detekt.gradle"
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:${versions.detekt}"
    }
}