plugins {
    id "net.ltgt.errorprone" version "0.0.13"
}

new RoboJavaModulePlugin(
        deploy: true
).apply(project)

apply plugin: ShadowsPlugin

shadows {
    packageName "org.robolectric.shadows.httpclient"
}

configurations {
    earlyRuntime
}

dependencies {
    // Project dependencies
    compileOnly project(":shadows:framework")

    // Compile dependencies
    earlyRuntime "org.apache.httpcomponents:httpcore:4.0.1"
    compile "org.apache.httpcomponents:httpclient:4.0.3"
    compileOnly(AndroidSdk.LOLLIPOP_MR1.coordinates) { force = true }

    // Testing dependencies
    testCompile project(":robolectric")
    testCompile "junit:junit:4.12"
    testCompile "org.assertj:assertj-core:3.8.0"
    testCompile "org.mockito:mockito-core:2.5.4"
    testRuntime AndroidSdk.LOLLIPOP_MR1.coordinates
}

// httpcore needs to come before android-all on runtime classpath; the gradle IntelliJ plugin
//   needs the compileClasspath order patched too (bug?)
sourceSets.main.compileClasspath = configurations.earlyRuntime + sourceSets.main.compileClasspath
sourceSets.main.runtimeClasspath = configurations.earlyRuntime + sourceSets.main.runtimeClasspath

sourceSets.test.compileClasspath = configurations.earlyRuntime + sourceSets.test.compileClasspath
sourceSets.test.runtimeClasspath = configurations.earlyRuntime + sourceSets.test.runtimeClasspath