|
13 | 13 | import org.gradle.api.tasks.TaskAction; |
14 | 14 |
|
15 | 15 | import edu.umd.cs.findbugs.annotations.Nullable; |
| 16 | + |
| 17 | +import java.io.File; |
16 | 18 | import java.nio.file.Path; |
17 | 19 | import java.util.List; |
18 | 20 | import java.util.Optional; |
@@ -44,27 +46,27 @@ public void generate() throws Throwable { |
44 | 46 |
|
45 | 47 | String mainClass = Optional.ofNullable(this.mainClass) |
46 | 48 | .orElseGet(() -> computeMainClassName(projects)); |
47 | | - |
48 | | - Path outputDir = classes(getProject(), false); |
49 | | - // Reduce lookup to current project: See https://github.com/jooby-project/jooby/issues/2756 |
50 | | - String metaInf = |
51 | | - outputDir |
52 | | - .resolve("META-INF") |
53 | | - .resolve("services") |
54 | | - .resolve("io.jooby.MvcFactory") |
55 | | - .toAbsolutePath() |
56 | | - .toString(); |
| 49 | + var sources = projects.stream() |
| 50 | + .flatMap(project -> { |
| 51 | + var sourceSet = sourceSet(project, false); |
| 52 | + return sourceSet.stream() |
| 53 | + .flatMap(it -> it.getAllSource().getSrcDirs().stream()) |
| 54 | + .map(File::toPath); |
| 55 | + }) |
| 56 | + .distinct() |
| 57 | + .toList(); Path outputDir = classes(getProject(), false); |
57 | 58 |
|
58 | 59 | ClassLoader classLoader = createClassLoader(projects); |
59 | 60 |
|
60 | 61 | getLogger().info("Generating OpenAPI: " + mainClass); |
61 | 62 | getLogger().debug("Using classloader: " + classLoader); |
62 | 63 | getLogger().debug("Output directory: " + outputDir); |
63 | | - getLogger().debug("META-INF: " + metaInf); |
| 64 | + getLogger().debug("Source directories: " + sources); |
64 | 65 |
|
65 | | - OpenAPIGenerator tool = new OpenAPIGenerator(metaInf); |
| 66 | + OpenAPIGenerator tool = new OpenAPIGenerator(); |
66 | 67 | tool.setClassLoader(classLoader); |
67 | 68 | tool.setOutputDir(outputDir); |
| 69 | + tool.setSources(sources); |
68 | 70 | trim(includes).ifPresent(tool::setIncludes); |
69 | 71 | trim(excludes).ifPresent(tool::setExcludes); |
70 | 72 |
|
|
0 commit comments