Skip to content

Commit 3ff74d2

Browse files
committed
refactor: split chapi helper module
1 parent b8fcee9 commit 3ff74d2

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

chapi-helper/build.gradle.kts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plugins {
2+
java
3+
kotlin("jvm")
4+
kotlin("plugin.serialization") version "1.6.10"
5+
6+
`jacoco-conventions`
7+
}
8+
9+
dependencies {
10+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
11+
implementation(kotlin("stdlib-jdk8"))
12+
implementation(kotlin("reflect"))
13+
14+
implementation("org.antlr:antlr4:4.11.1")
15+
implementation("org.antlr:antlr4-runtime:4.11.1")
16+
// Kotlin reflection.
17+
implementation(kotlin("test"))
18+
implementation(kotlin("test-junit"))
19+
20+
testImplementation(project(":chapi-ast-java"))
21+
testImplementation(project(":chapi-domain"))
22+
23+
// JUnit 5
24+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
25+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.0")
26+
testRuntimeOnly("org.junit.platform:junit-platform-console:1.6.0")
27+
}
28+
29+
tasks.withType<Test> {
30+
useJUnitPlatform()
31+
testLogging {
32+
events("passed", "skipped", "failed")
33+
}
34+
}

chapi-ast-java/src/main/kotlin/chapi/ast/javaast/TreeViewer.kt renamed to chapi-helper/src/main/kotlin/chapi/ast/helper/TreeViewer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package chapi.ast.javaast
1+
package chapi.ast.helper
22

33
import org.antlr.v4.runtime.misc.Utils;
44
import org.antlr.v4.runtime.tree.Tree;

chapi-ast-java/src/test/kotlin/chapi/ast/javaast/TreeViewerTest.kt renamed to chapi-helper/src/test/kotlin/chapi/ast/helper/TreeViewerTest.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
package chapi.ast.javaast
1+
package chapi.ast.helper
22

3+
import chapi.ast.javaast.JavaAnalyser
34
import org.junit.jupiter.api.Test
45

56
internal class TreeViewerTest {
67
@Test
78
fun show() {
8-
JavaAnalyser().parse("public class Test { }").let {
9+
val javaAnalyser = JavaAnalyser()
10+
javaAnalyser.parse("public class Test { }").let {
911
val ruleNamesList: List<String> = it.ruleNames.toList()
1012
println(TreeViewer().toPrettyTree(it.compilationUnit(), ruleNamesList))
1113
}

settings.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ rootProject.name = "chapi"
22

33
include(
44
":chapi-domain",
5+
":chapi-helper",
56
// tier 1 languages
67
":chapi-ast-java",
78
":chapi-ast-typescript",

0 commit comments

Comments
 (0)