/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you 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.
 */

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    useLibrary 'org.apache.http.legacy'
    sourceSets.main.java {
        srcDir '../src'
        exclude 'org/apache/thrift/transport/TSaslClientTransport.java'
        exclude 'org/apache/thrift/transport/TSaslServerTransport.java'
        exclude 'org/apache/thrift/transport/TSaslTransport.java'
    }
}

repositories {
    mavenCentral()
}
dependencies {
    compile 'org.slf4j:slf4j-api:1.7.13'
    compile 'javax.servlet:servlet-api:2.5'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
}

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}
