group 'com.eopeter.fluttermapboxnavigation'
version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = '1.7.10'
    ext.android_gradle_version = '7.4.2'
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username = "mapbox"
                password = project.hasProperty('MAPBOX_DOWNLOADS_TOKEN') ? project.property('MAPBOX_DOWNLOADS_TOKEN') : System.getenv('MAPBOX_DOWNLOADS_TOKEN')
                if (password == null || password == "") {
                    throw new GradleException("MAPBOX_DOWNLOADS_TOKEN isn't set. Set it to the project properties or to the enviroment variables.")
                }
            }
        }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:$android_gradle_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "com.mapbox.gradle.plugins:access-token:0.4.0"
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://plugins.gradle.org/m2' }
        maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username = "mapbox"
                password = project.hasProperty('MAPBOX_DOWNLOADS_TOKEN') ? project.property('MAPBOX_DOWNLOADS_TOKEN') : System.getenv('MAPBOX_DOWNLOADS_TOKEN')
                if (password == null || password == "") {
                    throw new GradleException("MAPBOX_DOWNLOADS_TOKEN isn't set. Set it to the project properties or to the enviroment variables.")
                }
            }
        }
    }
}

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

android {
    namespace 'com.eopeter.fluttermapboxnavigation'
    compileSdkVersion 33

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    lintOptions {
        disable 'InvalidPackage'
        abortOnError false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures{
        viewBinding = true
    }
}

dependencies {
    // Mapbox Navigation SDK
    implementation "com.mapbox.navigation:copilot:2.16.0"
    implementation "com.mapbox.navigation:ui-app:2.16.0"
    implementation "com.mapbox.navigation:ui-dropin:2.16.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation 'com.google.code.gson:gson:2.8.9'

    implementation "androidx.core:core-ktx:1.9.0"
    implementation "com.google.android.material:material:1.8.0"
    implementation "androidx.appcompat:appcompat:1.6.1"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.constraintlayout:constraintlayout:2.1.4"
    implementation "com.google.android.gms:play-services-location:21.0.1"
    debugImplementation "com.squareup.leakcanary:leakcanary-android:2.9.1"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
    implementation 'androidx.annotation:annotation:1.6.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
