Skip to content

Filtering classes by annotation#2

Open
nhachicha wants to merge 2 commits into
masterfrom
nh/classes_filtering
Open

Filtering classes by annotation#2
nhachicha wants to merge 2 commits into
masterfrom
nh/classes_filtering

Conversation

@nhachicha

Copy link
Copy Markdown
Owner
  1. Filter IrClass to be lowered to those having a specific annotation

  2. Adding logger using the Ir dump helper function

@nhachicha

Copy link
Copy Markdown
Owner Author

@rorbech FYI

@rorbech rorbech left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept seems sound, but should probably be self contained in the sample project, either by declaring the annotation as part of an annotation dependency or accepting the annotation class name as a plugin parameter.

// Annotation
private val IrClass.isRealmObject: Boolean get() = kind == ClassKind.CLASS && hasRealmObjectAnnotationWithoutArgs()

private val realmObjectAnnotationFqName = FqName("io.realm.kmmapplication.shared.RealmObject")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should expose the annotation as part of the plugin.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you would inject these kind of dependencies by adding them to the project by overriding the apply(target: Project) in the gradle plugins implementation of KotlinCompilerPluginSupportPlugin.

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.

2 participants