Added detekt-main & detekt-test examples
This commit is contained in:
parent
ba4741062c
commit
a13a2b814b
8 changed files with 49 additions and 25 deletions
4
examples/.idea/misc.xml
generated
4
examples/.idea/misc.xml
generated
|
@ -6,6 +6,10 @@
|
|||
<pattern value="com.example.ExampleBuild" method="dokkaHtml" />
|
||||
<pattern value="com.example.ExampleBuild" method="dokkaGfm" />
|
||||
<pattern value="com.example.ExampleBuild" method="dokkaJekyll" />
|
||||
<pattern value="com.example.ExampleBuild" method="detekt" />
|
||||
<pattern value="com.example.ExampleBuild" method="detektBaseline" />
|
||||
<pattern value="com.example.ExampleBuild" method="detektMain" />
|
||||
<pattern value="com.example.ExampleBuild" method="detektTest" />
|
||||
</component>
|
||||
<component name="PDMPlugin">
|
||||
<option name="customRuleSets">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
j## Compile the Kotlin Example
|
||||
## Compile the Kotlin Example
|
||||
|
||||
```console
|
||||
./bld compile
|
||||
|
@ -8,6 +8,9 @@ j## Compile the Kotlin Example
|
|||
|
||||
```console
|
||||
./bld detekt
|
||||
|
||||
./bld detekt-main
|
||||
./bld detekt-test
|
||||
```
|
||||
|
||||
## Generate Detekt baseline
|
||||
|
@ -16,4 +19,4 @@ j## Compile the Kotlin Example
|
|||
./bld detekt-baseline
|
||||
```
|
||||
|
||||
The `detekt-baseline.xml` will be created in the project's root directory.
|
||||
The `detekt-baseline.xml` file will be created in the project's root directory.
|
||||
|
|
|
@ -4,14 +4,10 @@ import rife.bld.BuildCommand;
|
|||
import rife.bld.Project;
|
||||
import rife.bld.extension.CompileKotlinOperation;
|
||||
import rife.bld.extension.DetektOperation;
|
||||
import rife.bld.extension.dokka.DokkaOperation;
|
||||
import rife.bld.extension.dokka.LoggingLevel;
|
||||
import rife.bld.extension.dokka.OutputFormat;
|
||||
import rife.bld.operations.exceptions.ExitStatusException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Level;
|
||||
|
@ -49,7 +45,7 @@ public class ExampleBuild extends Project {
|
|||
var logger = Logger.getLogger("rife.bld.extension");
|
||||
var consoleHandler = new ConsoleHandler();
|
||||
|
||||
// Enable detailed logging for the Kotlin extension
|
||||
// Enable detailed logging
|
||||
consoleHandler.setLevel(level);
|
||||
logger.addHandler(consoleHandler);
|
||||
logger.setLevel(level);
|
||||
|
@ -58,23 +54,22 @@ public class ExampleBuild extends Project {
|
|||
new ExampleBuild().start(args);
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Compile the Kotlin project")
|
||||
@BuildCommand(summary = "Compiles 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)
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Check source with Detekt")
|
||||
@BuildCommand(summary = "Checks source with Detekt")
|
||||
public void detekt() throws ExitStatusException, IOException, InterruptedException {
|
||||
new DetektOperation()
|
||||
.fromProject(this)
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand(value = "detekt-baseline", summary = "Creates a Detekt baseline")
|
||||
@BuildCommand(value = "detekt-baseline", summary = "Creates the Detekt baseline")
|
||||
public void detektBaseline() throws ExitStatusException, IOException, InterruptedException {
|
||||
new DetektOperation()
|
||||
.fromProject(this)
|
||||
|
@ -82,4 +77,18 @@ public class ExampleBuild extends Project {
|
|||
.createBaseline(true)
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand(value = "detekt-main", summary = "Checks main source with Detekt")
|
||||
public void detektMain() throws ExitStatusException, IOException, InterruptedException {
|
||||
var op = new DetektOperation().fromProject(this);
|
||||
op.input().clear();
|
||||
op.input("src/main/kotlin").execute();
|
||||
}
|
||||
|
||||
@BuildCommand(value = "detekt-test", summary = "Checks test source with Detekt")
|
||||
public void detektTest() throws ExitStatusException, IOException, InterruptedException {
|
||||
var op = new DetektOperation().fromProject(this);
|
||||
op.input().clear();
|
||||
op.input("src/test/kotlin").execute();
|
||||
}
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
package com.example
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Example class.
|
||||
*/
|
||||
class Example {
|
||||
val message: String
|
||||
get() = "Hello World!"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue