Home | History | Annotate | Download | only in platform
      1 buildscript {
      2     repositories {
      3         mavenCentral()
      4         mavenLocal()
      5         jcenter()
      6     }
      7     dependencies {
      8         classpath 'com.android.tools.build:gradle:2.2.3' // jcenter has the latest
      9         classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
     10     }
     11 }
     12 
     13 description = 'Conscrypt: Android Platform'
     14 
     15 ext {
     16     androidHome = "$System.env.ANDROID_HOME"
     17     androidSdkInstalled = file("$androidHome").exists()
     18     androidVersionCode = 1
     19     androidVersionName = "$version"
     20     androidMinSdkVersion = 24
     21     androidTargetSdkVersion = 25
     22     androidBuildToolsVersion = "25.0.0"
     23 }
     24 
     25 if (androidSdkInstalled) {
     26     apply plugin: 'com.android.library'
     27 
     28     android {
     29         compileSdkVersion androidTargetSdkVersion
     30         buildToolsVersion androidBuildToolsVersion
     31 
     32         compileOptions {
     33             sourceCompatibility androidMinJavaVersion;
     34             targetCompatibility androidMinJavaVersion
     35         }
     36 
     37         defaultConfig {
     38             minSdkVersion androidMinSdkVersion
     39             targetSdkVersion androidTargetSdkVersion
     40             versionCode androidVersionCode
     41             versionName androidVersionName
     42 
     43             testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     44 
     45             consumerProguardFiles 'proguard-rules.pro'
     46 
     47             externalNativeBuild {
     48                 cmake {
     49                     arguments '-DANDROID=True',
     50                             '-DANDROID_STL=c++_static',
     51                             "-DBORINGSSL_HOME=$boringsslHome"
     52                     cFlags '-fvisibility=hidden',
     53                             '-DBORINGSSL_SHARED_LIBRARY',
     54                             '-DBORINGSSL_IMPLEMENTATION',
     55                             '-DOPENSSL_SMALL',
     56                             '-D_XOPEN_SOURCE=700',
     57                             '-Wno-unused-parameter'
     58                 }
     59             }
     60             ndk {
     61                 abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
     62             }
     63         }
     64         buildTypes {
     65             release {
     66                 minifyEnabled false
     67                 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
     68             }
     69         }
     70         sourceSets {
     71             main {
     72                 java {
     73                     srcDirs = [
     74                             "${rootDir}/common/src/main/java",
     75                             "src/main/java",
     76                     ]
     77                     excludes = [ 'org/conscrypt/Platform.java' ]
     78                 }
     79             }
     80         }
     81         lintOptions {
     82             lintConfig file('lint.xml')
     83         }
     84     }
     85 
     86     configurations {
     87         publicApiDocs
     88     }
     89 
     90     dependencies {
     91         compile fileTree(dir: 'libs', include: ['*.jar'])
     92         compile project(path: ':conscrypt-openjdk', configuration: 'platform')
     93         publicApiDocs project(':conscrypt-api-doclet')
     94         androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
     95             exclude module: 'support-annotations'
     96             exclude module: 'support-v4'
     97             exclude module: 'support-v13'
     98             exclude module: 'recyclerview-v7'
     99             exclude module: 'appcompat-v7'
    100             exclude module: 'design'
    101         })
    102         testCompile project(':conscrypt-testing'),
    103                     libraries.junit
    104         provided project(':conscrypt-android-stub'),
    105                  project(':conscrypt-libcore-stub')
    106 
    107         // Adds the constants module as a dependency so that we can include its generated source
    108         provided project(':conscrypt-constants')
    109     }
    110 
    111     // Disable running the tests.
    112     tasks.withType(Test){
    113         enabled = false
    114     }
    115 
    116 } else {
    117     logger.warn('Android SDK has not been detected. The Android Platform module will not be built.')
    118 
    119     // Disable all tasks
    120     tasks.collect {
    121         it.enabled = false
    122     }
    123 }
    124