apply plugin: 'com.android.library'

android {
  compileSdkVersion 26
  buildToolsVersion '27.0.3'

  task ndkBuild(type: Exec, description: 'run ndk-build') {
    if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
      workingDir 'src/main/jni'
      commandLine 'ndk-build.cmd', '-j', Runtime.runtime.availableProcessors()
    } else {
      workingDir 'src/main/jni'
      commandLine "$ndkDir/ndk-build", '-j', Runtime.runtime.availableProcessors()
    }
  }

  tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn(ndkBuild)
  }

  defaultConfig {
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    vectorDrawables.useSupportLibrary = true
    ndk {
      moduleName "photoprocessing"
    }
  }
  sourceSets.main {
    jni.srcDirs = []
    jniLibs.srcDir 'src/main/libs'
  }

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

dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')
  implementation 'com.android.support.constraint:constraint-layout:1.1.0'
  implementation 'com.android.support:support-v4:26.1.0'
  testImplementation 'junit:junit:4.12'
  testImplementation "org.robolectric:robolectric:3.3.2"
  implementation "com.android.support:design:26.1.0"
  implementation 'com.android.support:appcompat-v7:26.1.0'
  api 'com.github.bumptech.glide:glide:4.6.1'
  implementation 'com.android.support:recyclerview-v7:26.1.0'
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
