Added the compile and provided classpaths to the sourceSet when DokkaOperation().fromProject() is called. Closes #3

This commit is contained in:
Erik C. Thauvin 2024-05-25 00:59:51 -07:00
parent deb66a2d20
commit d2560125d7
Signed by: erik
GPG key ID: 776702A6A2DA330E
4 changed files with 45 additions and 16 deletions

View file

@ -50,8 +50,8 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
private final Collection<String> globalPackageOptions_ = new ArrayList<>();
private final Collection<String> globalSrcLinks_ = new ArrayList<>();
private final Collection<String> includes_ = new ArrayList<>();
private final Map<String, String> pluginsConfiguration_ = new ConcurrentHashMap<>();
private final Collection<String> pluginsClasspath_ = new ArrayList<>();
private final Map<String, String> pluginsConfiguration_ = new ConcurrentHashMap<>();
private boolean delayTemplateSubstitution_;
private boolean failOnWarning_;
private LoggingLevel loggingLevel_;
@ -226,15 +226,18 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
/**
* Configures the operation from a {@link BaseProject}.
* <p>
* Sets the {@link #sourceSet sourceSet}, {@link SourceSet#jdkVersion jdkVersion} and {@link #moduleName moduleName}
* from the project.
* Sets the {@link #sourceSet sourceSet}, {@link SourceSet#jdkVersion jdkVersion}, {@link #moduleName moduleName}
* and {@link SourceSet#classpath(String...) classpath} from the project.
*
* @param project the project to configure the operation from
*/
@Override
public DokkaOperation fromProject(BaseProject project) {
project_ = project;
sourceSet_ = new SourceSet().src(new File(project.srcMainDirectory(), "kotlin").getAbsolutePath());
sourceSet_ = new SourceSet()
.src(new File(project.srcMainDirectory(), "kotlin").getAbsolutePath())
.classpath(project.compileClasspathJars())
.classpath(project.providedClasspathJars());
if (project.javaRelease() != null) {
sourceSet_ = sourceSet_.jdkVersion(project.javaRelease());
}

View file

@ -16,6 +16,7 @@
package rife.bld.extension.dokka;
import java.io.File;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -236,11 +237,11 @@ public class SourceSet {
* <p>
* This option accepts both {@code .jar} and {@code .klib} files.
*
* @param classpath one or more classpath
* @param files one or more file
* @return this operation instance
*/
public SourceSet classpath(String... classpath) {
classpath_.addAll(Arrays.asList(classpath));
public SourceSet classpath(String... files) {
classpath_.addAll(Arrays.asList(files));
return this;
}
@ -251,11 +252,26 @@ public class SourceSet {
* <p>
* This option accepts both {@code .jar} and {@code .klib} files.
*
* @param classpath the list of classpath
* @param files the list of files
* @return this operation instance
*/
public SourceSet classpath(Collection<String> classpath) {
classpath_.addAll(classpath);
public SourceSet classpath(Collection<String> files) {
classpath_.addAll(files);
return this;
}
/**
* Sets classpath for analysis and interactive samples.
* <p>
* This is useful if some types that come from dependencies are not resolved/picked up automatically.
* <p>
* This option accepts both {@code .jar} and {@code .klib} files.
*
* @param files the list of files
* @return this operation instance
*/
public SourceSet classpath(List<File> files) {
files.forEach(it -> classpath_.add(it.getAbsolutePath()));
return this;
}