Skip to content

Commit

Permalink
Merge pull request #14 from UbiqueInnovation/agp-8.2
Browse files Browse the repository at this point in the history
Fixing icon for 8.2
  • Loading branch information
tabere-ubique authored Dec 11, 2023
2 parents d34564c + 96c4609 commit 71a3ab5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {

// MAVEN PUBLISHING
mavenPublishing {
coordinates("ch.ubique.gradle", "ubdiag-android", "8.2.0")
coordinates("ch.ubique.gradle", "ubdiag-android", "8.2.1")
publishToMavenCentral(SonatypeHost.S01, true)
signAllPublications()
}
8 changes: 1 addition & 7 deletions src/main/groovy/ch/ubique/gradle/ubdiag/BuildPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,11 @@ class BuildPlugin implements Plugin<Project> {
flavor.ext.set("launcherIconLabel", flavor.name)
flavor.ext.set("launcherIconLabelEnabled", (Boolean) null)

/*
With AGP 8.2 this step is not needed and leads partially to "Error: Duplicate resources"
// Add generated icon path to res-SourceSet. This must be here otherwise it is too late!
AndroidSourceSet sourceSet = android.sourceSets.maybeCreate(flavor.name)
sourceSet.res { AndroidSourceDirectorySet res ->
android.buildTypes.configureEach { BuildType buildType ->
res.srcDir("${project.buildDir}/generated/res/launcher-icon/${flavor.name}/${buildType.name}/")
}
res.srcDir("${project.buildDir}/generated/res/launcher-icon/${flavor.name}/")
}
*/
}

project.afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class IconOverlayTask {
allIcons.each { File original ->
String resTypeName = original.parentFile.name
String originalBaseName = original.name.takeBefore(".")
File targetDir = new File("${generatedResDir.toString()}/${variant.flavorName}/${variant.buildType.name}/$resTypeName")
File targetDir = new File("${generatedResDir.toString()}/${variant.flavorName}/$resTypeName")
File modified = targetDir.listFiles({ File file -> file.name.matches("${originalBaseName}\\.[^.]+") } as FileFilter)?.find() as File
if (modified != null && original.lastModified() <= modified.lastModified() && gradleLastModified <= modified.lastModified()) return
println("$taskName: found modified launcher icon: " + original.absolutePath)
Expand Down

0 comments on commit 71a3ab5

Please sign in to comment.