• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1plugins {
2    alias(libs.plugins.android.library)
3}
4
5description = 'Conscrypt: Android Platform'
6
7ext {
8    androidHome = "$System.env.ANDROID_HOME"
9    androidSdkInstalled = file("$androidHome").exists()
10    androidVersionCode = 1
11    androidVersionName = "$version"
12    // Platform is always built against head, so we can use newer API versions.
13    androidMinSdkVersion = 26
14    androidTargetSdkVersion = 26
15}
16
17android {
18    namespace "org.conscrypt"
19    compileSdkVersion androidTargetSdkVersion
20
21    compileOptions {
22        sourceCompatibility androidMinJavaVersion;
23        targetCompatibility androidMinJavaVersion
24    }
25
26    defaultConfig {
27        minSdkVersion androidMinSdkVersion
28        targetSdkVersion androidTargetSdkVersion
29        versionCode androidVersionCode
30        versionName androidVersionName
31
32        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
33
34        consumerProguardFiles 'proguard-rules.pro'
35
36        externalNativeBuild {
37            cmake {
38                arguments '-DANDROID=True',
39                        '-DANDROID_STL=c++_static',
40                        "-DBORINGSSL_HOME=$boringsslHome"
41                cFlags '-fvisibility=hidden',
42                        '-DBORINGSSL_SHARED_LIBRARY',
43                        '-DBORINGSSL_IMPLEMENTATION',
44                        '-DOPENSSL_SMALL',
45                        '-D_XOPEN_SOURCE=700',
46                        '-Wno-unused-parameter'
47            }
48        }
49        ndk {
50            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
51        }
52    }
53    buildTypes {
54        release {
55            minifyEnabled false
56            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
57        }
58    }
59    sourceSets {
60        main {
61            java {
62                srcDirs = [
63                        "${rootDir}/common/src/main/java",
64                        "src/main/java",
65                ]
66                excludes = [ 'org/conscrypt/Platform.java' ]
67            }
68        }
69    }
70    lintOptions {
71        lintConfig file('lint.xml')
72    }
73}
74
75configurations {
76    publicApiDocs
77}
78
79dependencies {
80    implementation project(path: ':conscrypt-openjdk', configuration: 'platform')
81    publicApiDocs project(':conscrypt-api-doclet')
82    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
83        exclude module: 'support-annotations'
84        exclude module: 'support-v4'
85        exclude module: 'support-v13'
86        exclude module: 'recyclerview-v7'
87        exclude module: 'appcompat-v7'
88        exclude module: 'design'
89    })
90    testCompileOnly project(':conscrypt-android-stub'),
91                    project(':conscrypt-libcore-stub')
92    testImplementation project(path: ":conscrypt-testing", configuration: "shadow"),
93                       libs.junit
94    compileOnly project(':conscrypt-android-stub'),
95                project(':conscrypt-libcore-stub')
96
97    // Adds the constants module as a dependency so that we can include its generated source
98    compileOnly project(':conscrypt-constants')
99}
100
101// Disable running the tests.
102tasks.withType(Test).configureEach {
103    enabled = false
104}
105