Skip to content

Commit

Permalink
Update AGP to 8.2.0 (duckduckgo#4580)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshliebe authored Jun 4, 2024
1 parent 693fe84 commit 4ce0b1e
Show file tree
Hide file tree
Showing 23 changed files with 102 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DeviceShieldTileService : TileService() {
}
}

@SuppressLint("NewApi") // IDE doesn't get we use appBuildConfig
@SuppressLint("NewApi", "StartActivityAndCollapseDeprecated") // IDE doesn't get we use appBuildConfig
private fun launchActivity() {
val intent = Intent(this, VpnPermissionRequesterActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }
if (appBuildConfig.sdkInt >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.duckduckgo.app

import android.appwidget.AppWidgetManager
import android.content.ComponentName
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
Expand All @@ -30,6 +31,7 @@ import com.duckduckgo.app.statistics.pixels.Pixel
import com.duckduckgo.appbuildconfig.api.AppBuildConfig
import com.duckduckgo.common.ui.DuckDuckGoActivity
import com.duckduckgo.di.scopes.ActivityScope
import com.duckduckgo.widget.SearchAndFavoritesWidget
import com.duckduckgo.widget.WidgetPreferences
import com.duckduckgo.widget.WidgetTheme
import javax.inject.Inject
Expand Down Expand Up @@ -123,7 +125,10 @@ class WidgetThemeConfiguration : DuckDuckGoActivity() {
) {
widgetPrefs.saveWidgetSelectedTheme(widgetId, selectedTheme.toString())
pixelSelectedTheme(selectedTheme)
val widgetUpdateIntent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)

val widgetUpdateIntent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE).apply {
component = ComponentName(this@WidgetThemeConfiguration, SearchAndFavoritesWidget::class.java)
}
val widgetsToUpdate = IntArray(1).also { it[0] = widgetId }
widgetUpdateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetsToUpdate)
sendBroadcast(widgetUpdateIntent)
Expand Down
5 changes: 5 additions & 0 deletions autoconsent/autoconsent-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ apply from: "$rootProject.projectDir/gradle/android-library.gradle"

android {
namespace 'com.duckduckgo.autoconsent.impl'
compileOptions {
coreLibraryDesugaringEnabled = true
}
}

dependencies {
Expand Down Expand Up @@ -76,6 +79,8 @@ dependencies {
testImplementation Testing.robolectric
testImplementation 'app.cash.turbine:turbine:_'
testImplementation project(path: ':common-test')

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
spotless = '6.1.2'
anvil_version = '2.5.0-beta07'
ksp_version = '1.9.22-1.0.17'
gradle_plugin = '8.1.2'
gradle_plugin = '8.2.0'
min_sdk = 26
target_sdk = 34
compile_sdk = 34
Expand Down
4 changes: 4 additions & 0 deletions content-scope-scripts/content-scope-scripts-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ dependencies {
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
}

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -84,5 +85,8 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
namespace 'com.duckduckgo.contentscopescripts.impl'
}
5 changes: 5 additions & 0 deletions cookies/cookies-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ dependencies {
testImplementation AndroidX.work.testing

testImplementation project(path: ':common-test')

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -79,5 +81,8 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
namespace 'com.duckduckgo.cookies.impl'
}
2 changes: 2 additions & 0 deletions data-store/data-store-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ dependencies {

implementation KotlinX.coroutines.core
implementation AndroidX.appCompat

coreLibraryDesugaring Android.tools.desugarJdkLibs
}


5 changes: 5 additions & 0 deletions experiments/experiments-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ dependencies {

androidTestImplementation project(path: ':common-test')
testImplementation project(path: ':common-test')

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -94,6 +96,9 @@ android {
sourceSets {
test.assets.srcDirs += files("$projectDir/schemas".toString())
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
namespace 'com.duckduckgo.experiments.impl'
}

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
19 changes: 10 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
5 changes: 5 additions & 0 deletions httpsupgrade/httpsupgrade-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ dependencies {
// WorkManager
implementation AndroidX.work.runtimeKtx
testImplementation AndroidX.work.testing

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -73,6 +75,9 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
}

fulladleModuleConfig {
Expand Down
7 changes: 6 additions & 1 deletion installation/installation-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ dependencies {
testImplementation "org.mockito.kotlin:mockito-kotlin:_"
testImplementation Testing.robolectric
testImplementation project(path: ':common-test')

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -53,5 +55,8 @@ android {
includeAndroidResources = true
}
}
namespace 'com.duckduckgo.installation.impl'
compileOptions {
coreLibraryDesugaringEnabled = true
}
namespace 'com.duckduckgo.installation.impl'
}
4 changes: 4 additions & 0 deletions js-messaging/js-messaging-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dependencies {
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
}

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -65,5 +66,8 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
namespace 'com.duckduckgo.js.messaging.impl'
}
5 changes: 5 additions & 0 deletions macos/macos-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ dependencies {
testImplementation "androidx.test:runner:_"
testImplementation Testing.robolectric
testImplementation CashApp.turbine

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -86,5 +88,8 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class VpnTileService : TileService() {
AndroidInjection.inject(this, VpnTileServiceBindingKey::class.java)
}

@SuppressLint("NewApi") // IDE doesn't get we use appBuildConfig
@SuppressLint("NewApi", "StartActivityAndCollapseDeprecated") // IDE doesn't get we use appBuildConfig
override fun onClick() {
serviceScope.launch(dispatcherProvider.io()) {
if (networkProtectionState.isRunning()) {
Expand Down
5 changes: 5 additions & 0 deletions privacy-dashboard/privacy-dashboard-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ dependencies {
androidTestImplementation CashApp.turbine
androidTestImplementation "org.mockito:mockito-android:_"
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:_"

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -86,6 +88,9 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
}

fulladleModuleConfig {
Expand Down
5 changes: 5 additions & 0 deletions request-filterer/request-filterer-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ dependencies {
testImplementation Testing.robolectric

testImplementation project(path: ':common-test')

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -74,5 +76,8 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
namespace 'com.duckduckgo.request.filterer.impl'
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.content.Intent
import android.content.res.Configuration
import android.net.Uri
import android.provider.Settings
import android.view.ViewGroup
import android.webkit.PermissionRequest
import androidx.activity.result.ActivityResultCaller
import androidx.annotation.StringRes
Expand All @@ -43,7 +44,6 @@ import com.duckduckgo.site.permissions.store.sitepermissions.SitePermissionsEnti
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.BaseTransientBottomBar.BaseCallback
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.snackbar.Snackbar.SnackbarLayout
import com.squareup.anvil.annotations.ContributesBinding
import java.lang.IllegalStateException
import javax.inject.Inject
Expand Down Expand Up @@ -333,9 +333,11 @@ class SitePermissionsDialogActivityLauncher @Inject constructor(
}

val snackbar = Snackbar.make(activity.window.decorView.rootView, message, Snackbar.LENGTH_LONG)
val layout = snackbar.view as SnackbarLayout
val snackbarView = snackbar.view
if (activity.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
layout.setPadding(0, 0, 0, 40.toPx())
val layoutParams = snackbarView.layoutParams as ViewGroup.MarginLayoutParams
layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin, layoutParams.rightMargin, 32.toPx())
snackbarView.layoutParams = layoutParams
}
snackbar.apply {
setAction(R.string.sitePermissionsDeniedSnackBarAction) { onPermissionAllowed() }
Expand Down
5 changes: 5 additions & 0 deletions subscriptions/subscriptions-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ dependencies {
// conflicts with mockito due to direct inclusion of byte buddy
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
}

coreLibraryDesugaring Android.tools.desugarJdkLibs
}

android {
Expand All @@ -99,5 +101,8 @@ android {
includeAndroidResources = true
}
}
compileOptions {
coreLibraryDesugaringEnabled = true
}
namespace 'com.duckduckgo.subscriptions.impl'
}
Loading

0 comments on commit 4ce0b1e

Please sign in to comment.