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

buildscript {
  repositories {
    google()
    jcenter()
    maven { url 'https://dl.bintray.com/android/android-tools/' }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    classpath 'com.google.gms:google-services:3.2.1'
    classpath 'de.undercouch:gradle-download-task:2.0.0'
  }
}

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion '28.0.3'
            }
        }
    }
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "28.0.0"
            }
        }
    }
}

allprojects {
  repositories {
    // For non-detach
    maven {
      url "$rootDir/maven"
    }
    // For old expoviews to work
    maven {
      url "$rootDir/versioned-abis/expoview-abi25_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi26_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi27_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi28_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi29_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi30_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi31_0_0/maven"
    }
    // For detach
    maven {
      url "$rootDir/../node_modules/expokit/maven"
    }
    maven {
      // We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
      url "$rootDir/maven-test"
    }
    google()
    jcenter()
    maven {
      // Local Maven repo containing AARs with JSC built for Android
      url "$rootDir/../node_modules/jsc-android/dist"
    }
    flatDir {
      dirs 'libs'
      // dirs project(':expoview').file('libs')
    }
    maven { url "https://google.bintray.com/exoplayer" }
    maven { url "https://jitpack.io" }

    // Want this last so that we never end up with a stale cache
    mavenLocal()
  }
}

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