Skip to content

Commit

Permalink
Merge pull request #565 from usefulness/renovate/google.agp
Browse files Browse the repository at this point in the history
Update dependency com.android.tools.build:gradle to v8.3.0
  • Loading branch information
renovate[bot] authored Mar 1, 2024
2 parents 2703de1 + c25f57e commit 4c867c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.project.starter.easylauncher.plugin

import com.android.build.api.AndroidPluginVersion
import com.android.build.api.component.analytics.AnalyticsEnabledApplicationVariant
import com.android.build.api.dsl.AndroidSourceDirectorySet
import com.android.build.api.dsl.AndroidSourceFile
Expand All @@ -19,13 +20,19 @@ private fun resourceFilePattern(name: String): String = if (name.startsWith("@")
name
}

internal fun Variant.debuggableCompat(agpVersion: AndroidPluginVersion) = if (agpVersion > AndroidPluginVersion(8, 3, 0)) {
debuggable
} else {
isDebuggable
}

/**
* Workaround for https://issuetracker.google.com/issues/197121905
*/
internal val Variant.isDebuggable: Boolean
private val Variant.isDebuggable: Boolean
get() = when (this) {
is AnalyticsEnabledApplicationVariant -> delegate.isDebuggable
is ComponentCreationConfig -> debuggable
is ComponentCreationConfig -> (this as ComponentCreationConfig).debuggable
else -> false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class EasyLauncherPlugin : Plugin<Project> {
val filters = configs.flatMap { it.filters.get() }.toMutableSet()

// set default ribbon
if (filters.isEmpty() && variant.isDebuggable) {
if (filters.isEmpty() && variant.debuggableCompat(agpVersion)) {
val ribbonText = when (extension.isDefaultFlavorNaming.orNull) {
true -> variant.flavorName
false -> variant.buildType
Expand All @@ -71,7 +71,7 @@ class EasyLauncherPlugin : Plugin<Project> {
}
}

log.info { "configuring ${variant.name}, isDebuggable=${variant.isDebuggable}, filters=${filters.size}" }
log.info { "configuring ${variant.name}, isDebuggable=${variant.debuggableCompat(agpVersion)}, filters=${filters.size}" }

if (filters.isNotEmpty()) {
val customIconNames = provider {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]
gradle-starter = "0.70.1"
gradle-starter = "0.71.0"
gradle-gradlepublish = "1.2.1"
gradle-doctor = "0.9.2"
google-agp = "8.2.2"
google-agp = "8.3.0"
gradle-jacocotestkit = "1.0.12"
mavencentral-junit = "5.10.2"
mavencentral-assertj = "3.25.3"
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ buildscript {
}
}
dependencies {
classpath "com.project.starter:android:0.70.1"
classpath "com.project.starter:android:0.71.0"
classpath "io.github.usefulness:screenshot-testing-plugin:0.17.2"
if (project.hasProperty("useMavenLocal")) {
classpath "com.project.starter.local:easylauncher:+"
Expand Down

0 comments on commit 4c867c1

Please sign in to comment.