Skip to content

Commit

Permalink
Fix reflection issue inside gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
RoRoche committed May 6, 2020
1 parent 9ee1093 commit a49a6a7
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import com.github.roroche.plantuml.diagrams.DiagramWithLog
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.reflections.Reflections
import org.reflections.scanners.SubTypesScanner
import org.reflections.scanners.TypeAnnotationsScanner
import org.reflections.util.ConfigurationBuilder

import javax.inject.Inject
import java.util.concurrent.Executors

/**
* Task to build PlantUML class diagram.
Expand Down Expand Up @@ -51,9 +55,11 @@ class BuildClassDiagramTask extends DefaultTask implements CustomTask {
getLogger().lifecycle(
"File?: " + it
)
if(it != null) {
if (it != null) {
it.toURI().toURL()
}
}.findAll {
it != null
} as URL[]
getLogger().lifecycle(
"URLs to scan: " + urls
Expand All @@ -64,8 +70,15 @@ class BuildClassDiagramTask extends DefaultTask implements CustomTask {
new ClsInPackage(
extension.packageName,
new Reflections(
extension.packageName,
classLoader
new ConfigurationBuilder()
.setScanners(
new SubTypesScanner(false),
new TypeAnnotationsScanner()
).setExecutorService(
Executors.newFixedThreadPool(4)
).setClassLoaders(
classLoader
)
)
),
new ClsWithNames(extension.ignoredClasses)
Expand Down

0 comments on commit a49a6a7

Please sign in to comment.