plugins {
    id "com.diffplug.spotless" version "7.1.0"
}
apply plugin: 'com.android.application'

android {
    defaultConfig {
        applicationId "org.mian.gitnex"
        minSdkVersion 26
        targetSdkVersion 36
        versionCode 1000
        versionName "10.0.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        compileSdk 35
    }
    flavorDimensions = ["default"]
    productFlavors {
        free {
            applicationId "org.mian.gitnex"
        }
        pro {
            applicationId "org.mian.gitnex.pro"
        }
    }
    buildFeatures {
        viewBinding true
        buildConfig true
    }
    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    dependenciesInfo {
        includeInApk = false
    }
    compileOptions {
        coreLibraryDesugaringEnabled true

        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_21
    }
    lint {
        abortOnError false
    }
    namespace 'org.mian.gitnex'
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

configurations {
    cleanedAnnotations
    compile.exclude group: 'org.jetbrains', module: 'annotations'
}

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'androidx.compose.material3:material3:1.3.2'
    implementation 'androidx.compose.material3:material3-window-size-class:1.3.2'
    implementation 'androidx.viewpager2:viewpager2:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
    implementation "androidx.legacy:legacy-support-v4:1.0.0"
    implementation "androidx.navigation:navigation-fragment:2.9.2"
    implementation "androidx.navigation:navigation-ui:2.9.2"
    implementation "androidx.lifecycle:lifecycle-viewmodel:2.9.2"
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.17'
    implementation 'com.google.code.gson:gson:2.13.1'
    implementation 'com.github.ramseth001:TextDrawable:1.1.3'
    implementation 'com.squareup.retrofit2:retrofit:3.0.0'
    implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
    implementation 'com.squareup.retrofit2:converter-scalars:3.0.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.17'
    implementation 'org.ocpsoft.prettytime:prettytime:5.0.7.Final'
    implementation "com.github.skydoves:colorpickerview:2.3.0"
    implementation "io.noties.markwon:core:4.6.2"
    implementation "io.noties.markwon:ext-latex:4.6.2"
    implementation "io.noties.markwon:ext-strikethrough:4.6.2"
    implementation "io.noties.markwon:ext-tables:4.6.2"
    implementation "io.noties.markwon:ext-tasklist:4.6.2"
    implementation "io.noties.markwon:html:4.6.2"
    implementation "io.noties.markwon:image:4.6.2"
    implementation "io.noties.markwon:linkify:4.6.2"
    implementation "io.noties.markwon:recycler:4.6.2"
    implementation "io.noties.markwon:recycler-table:4.6.2"
    implementation "io.noties.markwon:simple-ext:4.6.2"
    implementation "io.noties.markwon:image-glide:4.6.2"
    implementation "com.github.bumptech.glide:glide:4.16.0"
    implementation 'com.github.bumptech.glide:annotations:4.16.0'
    implementation "com.github.bumptech.glide:okhttp3-integration:4.16.0"
    annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
    implementation "com.caverock:androidsvg-aar:1.4"
    implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.29"
    implementation 'com.google.guava:guava:33.4.8-jre'
    //noinspection NewerVersionAvailable,GradleDependency
    implementation 'commons-io:commons-io:2.5'
    implementation 'org.apache.commons:commons-lang3:3.18.0'
    implementation "com.github.chrisbanes:PhotoView:2.3.0"
    implementation 'ch.acra:acra-mail:5.12.0'
    implementation 'ch.acra:acra-limiter:5.12.0'
    implementation 'ch.acra:acra-notification:5.12.0'
    implementation 'androidx.room:room-runtime:2.7.2'
    annotationProcessor 'androidx.room:room-compiler:2.7.2'
    implementation "androidx.work:work-runtime:2.10.2"
    implementation "io.mikael:urlbuilder:2.0.9"
    implementation "org.codeberg.gitnex-garage:emoji-java:v5.1.2"
    //noinspection GradleDependency
    coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5"
    implementation 'androidx.biometric:biometric:1.1.0'
    //noinspection GradleDependency
    implementation 'com.github.chrisvest:stormpot:2.4.2'
    implementation 'androidx.browser:browser:1.8.0'
    implementation 'com.google.android.flexbox:flexbox:3.0.0'
    implementation('org.codeberg.gitnex:tea4j-autodeploy:fa90c7d20a') {
        exclude module: 'org.apache.oltu.oauth2.common'
    }
    implementation 'io.github.amrdeveloper:codeview:1.3.9'

    constraints {
        it.implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0")
        it.implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0")
    }
}

spotless {
    java {
        target 'src/**/*.java'

        importOrder('android', 'androidx', 'com', 'junit', 'net', 'org', 'java', 'javax', '', '\\#')

        removeUnusedImports()
        googleJavaFormat().aosp()
        leadingSpacesToTabs()
        formatAnnotations()
    }
}
