/*
 * Copyright (c) 2017 Nam Nguyen, nam@ene.im
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
  ext.kotlin_version = '1.3.72'
  repositories {
    google()
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    jcenter()
    maven { url 'https://oss.jfrog.org/artifactory/plugins-release' }
  }

  dependencies {
    //noinspection GradleDependency
    classpath 'com.android.tools.build:gradle:3.6.3'
    classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:1.0.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
    classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.9.4"

    classpath 'io.fabric.tools:gradle:1.31.2'
  }
}

ext {
  androidVersion = 29
  minSupportSDKVersion = 16
  demoMinSDK = 21
  supportLibraryVersion = '29.0.0'
  constrainLayoutVersion = '1.1.3'
  archLibraryVersion = '1.1.1'
  exoPlayer2Version = '2.11.2'
  googleApiClient = '1.30.1'
  glide = '4.11.0'
  leackCanary = '1.6.3'
}

allprojects {
  repositories {
    google()
    mavenCentral()
    jcenter()
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' }
    maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
  }

  /* configurations {
    doc {
      transitive false
    }
  } */

  project.ext {
    releaseRepoName = 'Toro'
    releaseUserOrg = 'eneimlabs'
    releaseGroupId = 'im.ene.toro3'
    releaseVersion = '3.8.0.2011003'
    releaseVersionCode = 310000002 /* just incremental version code */
    releaseWebsite = 'https://github.com/eneim/toro'
    releaseLicense = ['Apache-2.0']

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]

    developerId = 'eneim'
    developerName = 'Nam Nguyen Hoai'
    developerEmail = 'nam@ene.im'

    siteUrl = 'https://github.com/eneim/toro'
    gitUrl = 'https://github.com/eneim/toro.git'
    issueTracker = 'https://github.com/eneim/toro/issues'
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

// copy from https://github.com/chrisbanes/tivi
// read from gradle.properties for a value, or use default instead.
String propOrDef(String propertyName, String defaultValue) {
  def propertyValue = project.properties[propertyName]
  return propertyValue != null ? propertyValue : defaultValue
}
