summaryrefslogtreecommitdiffstats
path: root/mobile/android/android-components/samples/browser/build.gradle
blob: 351becf85be02a7f6daf89626a60e127d56d7de0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

if (findProject(":geckoview") != null) {
    buildDir "${topobjdir}/gradle/build/mobile/android/samples-browser"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

if (findProject(":geckoview") != null) {
    apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
}

android {
    defaultConfig {
        applicationId "org.mozilla.samples.browser"
        minSdkVersion config.minSdkVersion
        compileSdk config.compileSdkVersion
        targetSdkVersion config.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        testInstrumentationRunnerArgument "clearPackageData", "true"
        testInstrumentationRunnerArgument "listener", "leakcanary.FailTestOnLeakRunListener"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    if (findProject(":geckoview") != null) {
        project.configureProductFlavors.delegate = it
        project.configureProductFlavors()
    }

    flavorDimensions += "engine"

    productFlavors {
        gecko {
            dimension "engine"
        }

        // WebView
        system {
            dimension "engine"
        }
    }

    variantFilter { variant ->
        if (variant.buildType.name == "release") {
            // This is a sample app that we are not releasing. Save some time and do not build
            // release versions.
            setIgnore(true)
        }
    }

    buildFeatures {
        viewBinding true
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = Versions.compose_compiler
    }

    namespace 'org.mozilla.samples.browser'
}

tasks.register("updateBorderifyExtensionVersion", Copy) { task ->
    updateExtensionVersion(task, 'src/main/assets/extensions/borderify')
}

tasks.register("updateTestExtensionVersion", Copy) { task ->
    updateExtensionVersion(task, 'src/main/assets/extensions/test')
}

dependencies {
    implementation platform(ComponentsDependencies.androidx_compose_bom)
    implementation project(':concept-awesomebar')
    implementation project(':concept-fetch')
    implementation project(':concept-engine')
    implementation project(':concept-tabstray')
    implementation project(':concept-toolbar')
    implementation project(':concept-storage')
    implementation project(':concept-base')

    implementation project(':compose-awesomebar')

    implementation project(':browser-engine-system')
    implementation project(':browser-domains')
    implementation project(':browser-icons')
    implementation project(':browser-session-storage')
    implementation project(':browser-state')
    implementation project(':browser-tabstray')
    implementation project(':browser-thumbnails')
    implementation project(':browser-toolbar')
    implementation project(':browser-menu')
    implementation project(':browser-storage-sync')

    implementation project(':lib-fetch-httpurlconnection')
    implementation project(":lib-crash")
    implementation project(':lib-dataprotect')
    implementation project(":lib-publicsuffixlist")

    implementation project(':feature-awesomebar')
    implementation project(":feature-autofill")
    implementation project(':feature-app-links')
    implementation project(':feature-contextmenu')
    implementation project(':feature-customtabs')
    implementation project(':feature-downloads')
    implementation project(':feature-intent')
    implementation project(':feature-media')
    implementation project(':feature-readerview')
    implementation project(':feature-search')
    implementation project(':feature-session')
    implementation project(':feature-toolbar')
    implementation project(':feature-tabs')
    implementation project(':feature-prompts')
    implementation project(':feature-privatemode')
    implementation project(':feature-pwa')
    implementation project(':feature-findinpage')
    implementation project(':feature-sitepermissions')
    implementation project(':feature-webcompat')
    implementation project(':feature-webcompat-reporter')
    implementation project(':feature-webnotifications')
    implementation project(':feature-addons')

    implementation project(':ui-autocomplete')
    implementation project(':ui-tabcounter')
    implementation project(':ui-widgets')

    // Add a dependency on service-glean to simplify the testing workflow
    // for engineers that want to test Gecko metrics exfiltrated via the Glean
    // SDK. See bug 1592935 for more context.
    implementation project(':service-glean')
    implementation project(':service-location')
    implementation project(':service-digitalassetlinks')
    implementation project(':service-sync-logins')

    implementation project(':support-base')
    implementation project(':support-locale')
    implementation project(':support-utils')
    implementation project(':support-ktx')
    implementation project(':support-webextensions')
    implementation project(':support-rustlog')

    geckoImplementation project(':browser-engine-gecko')

    implementation ComponentsDependencies.google_material

    implementation ComponentsDependencies.androidx_appcompat
    implementation ComponentsDependencies.androidx_compose_ui_tooling
    implementation ComponentsDependencies.androidx_compose_foundation
    implementation ComponentsDependencies.androidx_compose_material
    implementation ComponentsDependencies.androidx_core_ktx
    implementation ComponentsDependencies.androidx_constraintlayout
    implementation ComponentsDependencies.androidx_swiperefreshlayout
    implementation ComponentsDependencies.androidx_localbroadcastmanager

    debugImplementation ComponentsDependencies.leakcanary

    testImplementation ComponentsDependencies.androidx_test_core
    testImplementation ComponentsDependencies.androidx_test_junit
    testImplementation ComponentsDependencies.testing_robolectric
    testImplementation ComponentsDependencies.testing_mockito
    testImplementation ComponentsDependencies.testing_coroutines

    androidTestImplementation project(':support-android-test')
    androidTestImplementation ComponentsDependencies.androidx_test_core
    androidTestImplementation ComponentsDependencies.androidx_test_runner
    androidTestImplementation ComponentsDependencies.androidx_test_rules
    androidTestImplementation ComponentsDependencies.androidx_test_junit
    androidTestImplementation ComponentsDependencies.androidx_test_uiautomator
    androidTestImplementation ComponentsDependencies.androidx_espresso_core
    androidTestImplementation ComponentsDependencies.testing_leakcanary
    androidTestImplementation ComponentsDependencies.testing_mockwebserver
}

preBuild.dependsOn updateBorderifyExtensionVersion
preBuild.dependsOn updateTestExtensionVersion