Skip to content

Commit 4ce722d

Browse files
authored
Fix deprecated gradle BuildConfig warning (#6648)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1210715540682696/task/1211122564014100?focus=true ### Description Fixes gradle deprecation warning around enabling BuildConfig for the project. This is no longer a project-wide config, but per module. Previously, all modules had a BuildConfig.java file generated even if they didn't read any config. Now only the modules that actually access BuildConfig have it enabled. ### Steps to test this PR Verify that correct values are used at runtime based on the build config and build variant. Test case 1: - [x] Clean install of internalDebug - [x] Check that you see the "Skip onboarding" button - [x] Check that all pixels have "test=1" - [x] Search for generated BuildConfig.java files, there should be 7 (for each module that has it enabled) - [x] Open them and verify correct config (DEBUG=true, BUILD_TYPE="internal", ...) Test case 2: - [x] Clean install of playRelease - [x] Check that you don't see the "Skip onboarding" button - [x] Open app/build/generated/source/buildConfig/internal/debug/com/duckduckgo/app/browser/BuildConfig.java and verify correct config - [x] Search for generated BuildConfig.java files, there should be 7 (for each module that has it enabled) - [x] Open them and verify correct config (DEBUG=false, BUILD_TYPE="release", ...) ### UI changes No UI changes
1 parent de32c7e commit 4ce722d

File tree

10 files changed

+25
-6
lines changed

10 files changed

+25
-6
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ android {
7272
}
7373
buildFeatures {
7474
viewBinding = true
75+
buildConfig = true
7576
}
7677
compileOptions {
7778
coreLibraryDesugaringEnabled = true

autofill/autofill-impl/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ android {
123123
compileOptions {
124124
coreLibraryDesugaringEnabled = true
125125
}
126+
buildFeatures {
127+
buildConfig = true
128+
}
126129
defaultConfig {
127130
if (project.hasProperty("$autofillDisableAuthRequirementBuildFlag")) {
128131
buildConfigField "boolean", "AUTH_REQUIRED", "false"
@@ -146,4 +149,4 @@ tasks.register('installForAutofillTesting', Exec) {
146149
tasks.register('autofillTestLocal', Exec) {
147150
commandLine 'maestro', 'test', '--include-tags', 'autofillNoAuthTests,autofillPasswordGeneration,autofillBackfillingUsername', "$rootDir/.maestro"
148151
dependsOn 'installForAutofillTesting'
149-
}
152+
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,4 @@ fladle {
189189
}
190190
}
191191

192-
apply plugin: 'android-reporting'
192+
apply plugin: 'android-reporting'

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ org.gradle.caching=true
2121
org.gradle.parallel=true
2222
org.gradle.configureondemand=true
2323
org.gradle.configuration-cache=true
24-
android.defaults.buildfeatures.buildconfig=true
2524
android.nonFinalResIds=false
2625

malicious-site-protection/malicious-site-protection-impl/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ android {
101101
compileOptions {
102102
coreLibraryDesugaringEnabled = true
103103
}
104+
buildFeatures {
105+
buildConfig = true
106+
}
104107
defaultConfig {
105108
buildConfigField "String", "MALICIOUS_SITE_PROTECTION_AUTH_TOKEN", "\"${MALICIOUS_SITE_PROTECTION_AUTH_TOKEN}\""
106109
}

network-protection/network-protection-impl/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,13 @@ android {
112112
includeAndroidResources = true
113113
}
114114
}
115+
buildFeatures {
116+
buildConfig = true
117+
}
115118
defaultConfig {
116119
buildConfigField "String", "NETP_DEBUG_SERVER_TOKEN", "\"${NETP_DEBUG_SERVER_TOKEN}\""
117120
}
118121
compileOptions {
119122
coreLibraryDesugaringEnabled = true
120123
}
121-
}
124+
}

privacy-config/privacy-config-internal/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ android {
5656
}
5757
namespace 'com.duckduckgo.privacy.config.internal'
5858

59+
buildFeatures {
60+
buildConfig = true
61+
}
62+
5963
defaultConfig {
6064
def patchFiles = getConfigPatchFiles()
6165
def patchFileNames = []
@@ -163,4 +167,4 @@ afterEvaluate {
163167

164168
// force the task to always run (never up-to-date)
165169
copyConfigPatches.outputs.upToDateWhen { false }
166-
}
170+
}

statistics/statistics-impl/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,7 @@ android {
9999
compileOptions {
100100
coreLibraryDesugaringEnabled = true
101101
}
102+
buildFeatures {
103+
buildConfig = true
104+
}
102105
}

statistics/statistics-impl/src/main/java/com/duckduckgo/app/statistics/api/PixelService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
package com.duckduckgo.app.statistics.api
1818

1919
import com.duckduckgo.anvil.annotations.ContributesNonCachingServiceApi
20+
import com.duckduckgo.app.statistics.BuildConfig
2021
import com.duckduckgo.common.utils.AppUrl
21-
import com.duckduckgo.common.utils.BuildConfig
2222
import com.duckduckgo.di.scopes.AppScope
2323
import io.reactivex.Completable
2424
import retrofit2.http.GET

sync/sync-impl/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ android {
121121
compileOptions {
122122
coreLibraryDesugaringEnabled = true
123123
}
124+
buildFeatures {
125+
buildConfig = true
126+
}
124127
defaultConfig {
125128
if (project.hasProperty("$syncDisableAuthRequirementBuildFlag")) {
126129
buildConfigField "boolean", "AUTH_REQUIRED", "false"

0 commit comments

Comments
 (0)