From 04fd7fe0377d0d9dd90acd92bce97a028539294c Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 7 Nov 2023 12:39:45 -0800 Subject: [PATCH] Documented examples build --- examples/src/bld/java/com/example/ExampleBuild.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/src/bld/java/com/example/ExampleBuild.java b/examples/src/bld/java/com/example/ExampleBuild.java index 414e73a..5880d28 100644 --- a/examples/src/bld/java/com/example/ExampleBuild.java +++ b/examples/src/bld/java/com/example/ExampleBuild.java @@ -40,6 +40,7 @@ public class ExampleBuild extends Project { .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 the Kotlin source directory when creating or publishing sources Java Archives jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin")); } @@ -47,6 +48,8 @@ public class ExampleBuild extends Project { var level = Level.ALL; var logger = Logger.getLogger("rife.bld.extension"); var consoleHandler = new ConsoleHandler(); + + // Enable detailed logging for the Kotlin extension consoleHandler.setLevel(level); logger.addHandler(consoleHandler); logger.setLevel(level); @@ -56,7 +59,9 @@ public class ExampleBuild extends Project { } @BuildCommand(summary = "Compile the Kotlin project") + @Override public void compile() throws IOException { + // The source code located in src/main/kotlin and src/test/kotlin will be compiled new CompileKotlinOperation() .fromProject(this) .compileOptions( @@ -72,6 +77,7 @@ public class ExampleBuild extends Project { new DokkaOperation() .fromProject(this) .loggingLevel(LoggingLevel.INFO) + // Create build/dokka/gfm .outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "gfm").toFile()) .outputFormat(OutputFormat.MARKDOWN) .execute(); @@ -82,16 +88,19 @@ public class ExampleBuild extends Project { new DokkaOperation() .fromProject(this) .loggingLevel(LoggingLevel.INFO) + // Create build/dokka/html .outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "html").toFile()) .outputFormat(OutputFormat.HTML) .execute(); } @BuildCommand(summary = "Generates Javadoc for the project") + @Override public void javadoc() throws ExitStatusException, IOException, InterruptedException { new DokkaOperation() .fromProject(this) .loggingLevel(LoggingLevel.INFO) + // Create build/javadoc .outputDir(new File(buildDirectory(), "javadoc")) .outputFormat(OutputFormat.JAVADOC) .execute();