buildscript {
    ext.kotlin_version = "2.2.10"
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:8.10.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

plugins {
    id 'com.diffplug.spotless' version '7.0.3'
    id 'org.equalitie.ouisync.convention'
}

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
    }
}

group = "org.equalitie.ouisync.dart"
version = "1.0-SNAPSHOT"

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

android {
    if (project.android.hasProperty("namespace")) {
        namespace = "org.equalitie.ouisync.dart"
    }

    compileSdk = 35

    sourceSets {
        main.java.srcDirs += "src/main/kotlin"
        test.java.srcDirs += "src/test/kotlin"
    }

    defaultConfig {
        minSdk = 23
        targetSdk = 35
    }

    kotlin {
        jvmToolchain(17)
    }

    buildTypes {
        debug {
            android.packagingOptions.doNotStrip '**.so'
        }
        profile {
        }
    }

    dependencies {
        debugImplementation   'ie.equalit.ouinet:ouisync-android-debug:+'
        releaseImplementation 'ie.equalit.ouinet:ouisync-android:+'

        implementation        'ie.equalit.ouinet:ouisync-session:+'

        debugImplementation   'ie.equalit.ouinet:ouisync-service-debug:+'
        releaseImplementation 'ie.equalit.ouinet:ouisync-service:+'

        implementation        'androidx.lifecycle:lifecycle-runtime-ktx:2.9.4'

        testImplementation    'org.jetbrains.kotlin:kotlin-test'
        testImplementation    'org.mockito:mockito-core:5.10.0'
    }

    testOptions {
        unitTests.all {
            useJUnitPlatform()

            testLogging {
               events "passed", "skipped", "failed", "standardOut", "standardError"
               outputs.upToDateWhen {false}
               showStandardStreams = true
            }
        }
    }
}

spotless {
    kotlin {
        target("**/*.kt")
        ktfmt()
        ktlint()
    }
}
