1buildscript {
2    repositories {
3        mavenCentral()
4        google()
5        jcenter()
6    }
7    dependencies {
8        classpath GRADLE_CLASS_PATH
9        classpath PROTOBUF_CLASS_PATH
10    }
11}
12
13final String ANDROID_TOP = "${rootDir}/../../.."
14final String FRAMEWORK_PREBUILTS_DIR = "${ANDROID_TOP}/prebuilts/framework_intermediates/"
15
16apply plugin: 'com.android.application'
17apply plugin: 'com.google.protobuf'
18
19android {
20    compileSdkVersion COMPILE_SDK
21    buildToolsVersion BUILD_TOOLS_VERSION
22
23    defaultConfig {
24        minSdkVersion 25
25        targetSdkVersion 28
26        versionCode 1
27        versionName "1.0"
28
29        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30        vectorDrawables.useSupportLibrary = true
31    }
32    buildTypes {
33        debug {
34            minifyEnabled false
35        }
36    }
37
38    compileOptions {
39        sourceCompatibility JavaVersion.VERSION_1_8
40        targetCompatibility JavaVersion.VERSION_1_8
41    }
42
43    // The flavor dimensions for build variants (e.g. aospWithQuickstep, aospWithoutQuickstep)
44    // See: https://developer.android.com/studio/build/build-variants#flavor-dimensions
45    flavorDimensions "app", "recents"
46
47    productFlavors {
48        aosp {
49            dimension "app"
50            applicationId 'com.android.launcher3'
51            testApplicationId 'com.android.launcher3.tests'
52        }
53
54        l3go {
55            dimension "app"
56            applicationId 'com.android.launcher3'
57            testApplicationId 'com.android.launcher3.tests'
58        }
59
60        withQuickstep {
61            dimension "recents"
62
63            minSdkVersion 28
64        }
65
66        withoutQuickstep {
67            dimension "recents"
68        }
69    }
70
71    // Disable release builds for now
72    android.variantFilter { variant ->
73        if (variant.buildType.name.endsWith('release')) {
74            variant.setIgnore(true)
75        }
76    }
77
78    sourceSets {
79        main {
80            res.srcDirs = ['res']
81            java.srcDirs = ['src', 'src_plugins']
82            manifest.srcFile 'AndroidManifest-common.xml'
83            proto {
84                srcDir 'protos/'
85                srcDir 'proto_overrides/'
86            }
87        }
88
89        androidTest {
90            res.srcDirs = ['tests/res']
91            java.srcDirs = ['tests/src', 'tests/tapl']
92            manifest.srcFile "tests/AndroidManifest-common.xml"
93        }
94
95        androidTestDebug {
96            manifest.srcFile "tests/AndroidManifest.xml"
97        }
98
99        aosp {
100            java.srcDirs = ['src_flags', 'src_shortcuts_overrides']
101        }
102
103        aospWithoutQuickstep {
104            manifest.srcFile "AndroidManifest.xml"
105        }
106
107        aospWithQuickstep {
108            manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
109        }
110
111        l3go {
112            res.srcDirs = ['go/res']
113            java.srcDirs = ['go/src']
114            manifest.srcFile "go/AndroidManifest.xml"
115        }
116
117        l3goWithoutQuickstepDebug {
118            manifest.srcFile "AndroidManifest.xml"
119        }
120
121        l3goWithQuickstepDebug {
122            manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
123        }
124
125        withoutQuickstep {
126            java.srcDirs = ['src_ui_overrides']
127        }
128
129        withQuickstep {
130            res.srcDirs = ['quickstep/res', 'quickstep/recents_ui_overrides/res']
131            java.srcDirs = ['quickstep/src', 'quickstep/recents_ui_overrides/src']
132            manifest.srcFile "quickstep/AndroidManifest.xml"
133        }
134    }
135}
136
137allprojects {
138    repositories {
139        maven { url "../../../prebuilts/sdk/current/androidx/m2repository" }
140        maven { url "../../../prebuilts/fullsdk-darwin/extras/android/m2repository" }
141        maven { url "../../../prebuilts/fullsdk-linux/extras/android/m2repository" }
142        mavenCentral()
143        google()
144    }
145}
146
147dependencies {
148    implementation "androidx.dynamicanimation:dynamicanimation:${ANDROID_X_VERSION}"
149    implementation "androidx.recyclerview:recyclerview:${ANDROID_X_VERSION}"
150    implementation "androidx.preference:preference:${ANDROID_X_VERSION}"
151    implementation project(':IconLoader')
152    withQuickstepImplementation project(':SharedLibWrapper')
153    implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'launcher_protos.jar')
154
155    // Recents lib dependency
156    withQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/quickstep/libs", include: 'sysui_shared.jar')
157
158    // Required for AOSP to compile. This is already included in the sysui_shared.jar
159    withoutQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'plugin_core.jar')
160
161    testImplementation 'junit:junit:4.12'
162    androidTestImplementation "org.mockito:mockito-core:1.9.5"
163    androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
164    androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
165    androidTestImplementation 'com.android.support.test:runner:1.0.0'
166    androidTestImplementation 'com.android.support.test:rules:1.0.0'
167    androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
168    androidTestImplementation "androidx.annotation:annotation:${ANDROID_X_VERSION}"
169}
170
171protobuf {
172    // Configure the protoc executable
173    protoc {
174        artifact = 'com.google.protobuf:protoc:3.0.0'
175
176        generateProtoTasks {
177            all().each { task ->
178                task.builtins {
179                    remove java
180                    javanano {
181                        option "java_package=launcher_log_extension.proto|com.android.launcher3.userevent.nano"
182                        option "java_package=launcher_log.proto|com.android.launcher3.userevent.nano"
183                        option "java_package=launcher_dump.proto|com.android.launcher3.model.nano"
184                        option "enum_style=java"
185                    }
186                }
187            }
188        }
189    }
190}
191