Skip to content

Fix AGP 9.2.0 source-set DSL ClassCastException#2728

Draft
yschimke wants to merge 2 commits intogoogle:mainfrom
yschimke:agent/fix-agp-classcast-exception
Draft

Fix AGP 9.2.0 source-set DSL ClassCastException#2728
yschimke wants to merge 2 commits intogoogle:mainfrom
yschimke:agent/fix-agp-classcast-exception

Conversation

@yschimke
Copy link
Copy Markdown
Collaborator

WHAT

Fix AGP 9.2.0 source-set DSL ClassCastException

WHY

HOW

Checklist 📋

  • Add explicit visibility modifier and explicit return types for public declarations
  • Run spotless check
  • Run tests
  • Update metalava's signature text files

AGP 9.2.0's decorated AndroidLibrarySourceSet implementation no longer
extends the legacy com.android.build.gradle.api.AndroidLibrarySourceSet
type, so the script-accessor form

  sourceSets.getByName("main") { ... }

fails configuration with a ClassCastException. The redundant
assets.srcDir("src/main/assets") calls are deleted (it is the AGP
default), and media/audio's sharedTest source-dir wiring is moved to
the public-DSL LibraryExtension whose AndroidSourceSet implementation
is compatible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant