Documented examples build

This commit is contained in:
Erik C. Thauvin 2023-11-07 12:39:45 -08:00
parent 30e323c931
commit 04fd7fe037

View file

@ -40,6 +40,7 @@ public class ExampleBuild extends Project {
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1))); .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)));
// Include the Kotlin source directory when creating or publishing sources Java Archives
jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin")); jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin"));
} }
@ -47,6 +48,8 @@ public class ExampleBuild extends Project {
var level = Level.ALL; var level = Level.ALL;
var logger = Logger.getLogger("rife.bld.extension"); var logger = Logger.getLogger("rife.bld.extension");
var consoleHandler = new ConsoleHandler(); var consoleHandler = new ConsoleHandler();
// Enable detailed logging for the Kotlin extension
consoleHandler.setLevel(level); consoleHandler.setLevel(level);
logger.addHandler(consoleHandler); logger.addHandler(consoleHandler);
logger.setLevel(level); logger.setLevel(level);
@ -56,7 +59,9 @@ public class ExampleBuild extends Project {
} }
@BuildCommand(summary = "Compile the Kotlin project") @BuildCommand(summary = "Compile the Kotlin project")
@Override
public void compile() throws IOException { public void compile() throws IOException {
// The source code located in src/main/kotlin and src/test/kotlin will be compiled
new CompileKotlinOperation() new CompileKotlinOperation()
.fromProject(this) .fromProject(this)
.compileOptions( .compileOptions(
@ -72,6 +77,7 @@ public class ExampleBuild extends Project {
new DokkaOperation() new DokkaOperation()
.fromProject(this) .fromProject(this)
.loggingLevel(LoggingLevel.INFO) .loggingLevel(LoggingLevel.INFO)
// Create build/dokka/gfm
.outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "gfm").toFile()) .outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "gfm").toFile())
.outputFormat(OutputFormat.MARKDOWN) .outputFormat(OutputFormat.MARKDOWN)
.execute(); .execute();
@ -82,16 +88,19 @@ public class ExampleBuild extends Project {
new DokkaOperation() new DokkaOperation()
.fromProject(this) .fromProject(this)
.loggingLevel(LoggingLevel.INFO) .loggingLevel(LoggingLevel.INFO)
// Create build/dokka/html
.outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "html").toFile()) .outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "html").toFile())
.outputFormat(OutputFormat.HTML) .outputFormat(OutputFormat.HTML)
.execute(); .execute();
} }
@BuildCommand(summary = "Generates Javadoc for the project") @BuildCommand(summary = "Generates Javadoc for the project")
@Override
public void javadoc() throws ExitStatusException, IOException, InterruptedException { public void javadoc() throws ExitStatusException, IOException, InterruptedException {
new DokkaOperation() new DokkaOperation()
.fromProject(this) .fromProject(this)
.loggingLevel(LoggingLevel.INFO) .loggingLevel(LoggingLevel.INFO)
// Create build/javadoc
.outputDir(new File(buildDirectory(), "javadoc")) .outputDir(new File(buildDirectory(), "javadoc"))
.outputFormat(OutputFormat.JAVADOC) .outputFormat(OutputFormat.JAVADOC)
.execute(); .execute();