Skip to content

Commit

Permalink
Delay subcomponent generation only for direct children of appScope (#…
Browse files Browse the repository at this point in the history
…3827)

Task/Issue URL: https://app.asana.com/0/488551667048375/1205898947038393/f

### Description
Only scopes that have `AppScope` as direct parent allow delayed subcomponent generation

### Steps to test this PR
QA optional
  • Loading branch information
aitorvs authored Nov 7, 2023
1 parent bb9aac3 commit aa94537
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class ContributesSubComponentCodeGenerator : CodeGenerator {
it.fqName == InjectWith::class.fqName
}.argumentAt("delayGeneration", 2)?.value() as Boolean?
) ?: false
if (delayed && scope.fqName.getParentScope(module) != appScopeFqName) {
throw AnvilCompilationException(
"${vmClass.fqName}: 'delayGeneration = true' can only be used in scopes with 'AppScope' as direct parent.",
element = vmClass.clazz.identifyingElement,
)
}

val content = FileSpec.buildFile(generatedPackage, subcomponentFactoryClassName) {
addType(
Expand Down

0 comments on commit aa94537

Please sign in to comment.