Skip to content

fix generateRulesDocumentation task to pick up dependencies in serviceloader#66

Merged
emilyyuan03 merged 2 commits intomainfrom
fix-docs-task
Mar 10, 2026
Merged

fix generateRulesDocumentation task to pick up dependencies in serviceloader#66
emilyyuan03 merged 2 commits intomainfrom
fix-docs-task

Conversation

@emilyyuan03
Copy link
Copy Markdown
Contributor

@emilyyuan03 emilyyuan03 commented Mar 9, 2026

the ServiceLoader was only picking up classes in the archRules source set, so if those rules depended on an external package (like in OSS archrules, they depend on some predicate helpers in the common library), service loader would fail to read those archrules

// .stream()
// .map { it.type().name }
// .toList()
// .toSet()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here I am trying to get a set of the class names only in the archRules src set. I can either use this classLoader approach or read from the META-INF file like below... wondering which approach is better? I assume the META-INF since it doesn't require another classloader

@emilyyuan03 emilyyuan03 requested a review from wakingrufus March 9, 2026 21:56
Copy link
Copy Markdown
Member

@wakingrufus wakingrufus left a comment

Choose a reason for hiding this comment

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

Ok this makes sense. Good find. Just one minor suggestion.
Thanks!

abstract val rulesClasspath: ConfigurableFileCollection

@get:Classpath
abstract val dependencyClasspath: ConfigurableFileCollection
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think 'from()' is additive, so you could just keep 1 classpath property, and call from twice in it in the plugin code

@emilyyuan03 emilyyuan03 changed the title fix generateDocsTask to pick up dependencies in serviceloader fix generateRulesDocumentation task to pick up dependencies in serviceloader Mar 9, 2026
@emilyyuan03 emilyyuan03 marked this pull request as ready for review March 9, 2026 23:06
@emilyyuan03 emilyyuan03 requested a review from wakingrufus March 9, 2026 23:46
@emilyyuan03 emilyyuan03 merged commit 883defe into main Mar 10, 2026
3 checks passed
@emilyyuan03 emilyyuan03 deleted the fix-docs-task branch March 10, 2026 19:04
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.

3 participants