Skip to content

Commit 811a744

Browse files
committed
Remove log
1 parent 56dbde1 commit 811a744

File tree

8 files changed

+1
-193
lines changed

8 files changed

+1
-193
lines changed

src/main/kotlin/com/tomwyr/Command.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.tomwyr
22

3-
import com.tomwyr.common.Log
43
import com.tomwyr.generator.NodeTreeGenerator
54
import com.tomwyr.utils.GodotKotlinProject
65
import org.gradle.api.Project
@@ -9,7 +8,6 @@ class GenerateTreeCommand {
98
fun run(project: Project, config: GodotNodeTreeConfig) {
109
val projectPath = project.projectDir.absolutePath
1110
val godotProject = GodotKotlinProject.create(projectPath, config)
12-
val treeInfo = NodeTreeGenerator().generate(godotProject)
13-
Log.nodeTreeGenerated(treeInfo)
11+
NodeTreeGenerator().generate(godotProject)
1412
}
1513
}

src/main/kotlin/com/tomwyr/Plugin.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
package com.tomwyr
22

3-
import com.tomwyr.common.Log
4-
import com.tomwyr.common.Logger
53
import org.gradle.api.Plugin
64
import org.gradle.api.Project
75
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
86

97
class GodotNodeTree : Plugin<Project> {
108
override fun apply(project: Project) {
11-
initLog(project)
129
registerTask(project)
1310
addSourceSet(project)
1411
}
1512

16-
private fun initLog(project: Project) {
17-
Log.logger = Logger.stdOut(project)
18-
}
19-
2013
private fun registerTask(project: Project) {
2114
val config = project.extensions.create("godotNodeTree", GodotNodeTreeConfig::class.java)
2215
project.tasks.register("generateNodeTree") { task ->

src/main/kotlin/com/tomwyr/common/Log.kt

Lines changed: 0 additions & 137 deletions
This file was deleted.

src/main/kotlin/com/tomwyr/generator/Generator.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.tomwyr.generator
22

3-
import com.tomwyr.common.Log
43
import com.tomwyr.common.NodeTreeInfo
54
import com.tomwyr.common.Scene
65
import com.tomwyr.utils.GodotKotlinProject
@@ -10,22 +9,14 @@ class NodeTreeGenerator(
109
private val renderer: NodeTreeRenderer = NodeTreeRenderer(),
1110
) {
1211
fun generate(project: GodotKotlinProject): NodeTreeInfo {
13-
Log.readingScenes()
1412
val scenesData = project.readScenes()
15-
Log.scenesFound(scenesData)
16-
1713
val scenes = scenesData.map { data ->
18-
Log.parsingScene(data)
1914
val root = parser.parse(data)
2015
Scene(data.name, root)
2116
}.toList()
22-
23-
Log.renderingNodeTree()
2417
val content = renderer.render(project.targetPackage, scenes)
2518

26-
Log.savingResult()
2719
project.writeNodeTree(content)
28-
Log.resultSaved()
2920

3021
return NodeTreeInfo(scenes)
3122
}

src/main/kotlin/com/tomwyr/generator/Parser.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class SceneNodesParser {
1212

1313
private class ScenesParser {
1414
fun parse(sceneData: SceneData): Map<String, String> {
15-
Log.parsingScenePaths()
1615
return splitToEntries(sceneData.content, "ext_resource")
1716
.map(::parseEntryParams)
1817
.mapNotNull(::extractSceneIdToPath)
@@ -24,7 +23,6 @@ private class ScenesParser {
2423
val path = params["path"]
2524

2625
if (id == null || path == null) {
27-
Log.skippingSceneResource(params)
2826
return null
2927
}
3028

@@ -36,17 +34,12 @@ private class ScenesParser {
3634
.groupBy({ it.first }, { it.second })
3735
.filter { it.value.size > 1 }
3836

39-
if (duplicates.isNotEmpty()) {
40-
Log.duplicatedSceneResources(duplicates)
41-
}
42-
4337
return sceneIdsToPaths.toMap()
4438
}
4539
}
4640

4741
private class NodesParser(val scenePathsById: Map<String, String>) {
4842
fun parse(sceneData: SceneData): Node {
49-
Log.parsingSceneNodes()
5043
return splitToEntries(sceneData.content, "node")
5144
.map(::parseEntryParams)
5245
.mapNotNull(::extractNodeParams)
@@ -61,15 +54,13 @@ private class NodesParser(val scenePathsById: Map<String, String>) {
6154
val parent = params["parent"]
6255

6356
if (name == null || (type == null && instance == null) || (type != null && instance != null)) {
64-
Log.skippingNode(params)
6557
return null
6658
}
6759

6860
return NodeParams(name = name, type = type, instance = instance, parent = parent)
6961
}
7062

7163
private fun createRootNode(sceneName: String, params: List<NodeParams>): Node {
72-
Log.creatingRootNode()
7364
val childrenByParent = params.groupBy { it.parent }
7465
val rootParams = params.firstOrNull { it.parent == null } ?: throw ParentNodeNotFound(sceneName)
7566
return rootParams.toNode(childrenByParent, scenePathsById)
@@ -114,13 +105,11 @@ data class NodeParams(
114105
}
115106

116107
private fun splitToEntries(data: String, entryType: String): List<String> {
117-
Log.splittingEntries(entryType)
118108
val pattern = """\[${entryType} .*]""".toRegex()
119109
return pattern.findAll(data).mapNotNull { it.groupValues.firstOrNull() }.toList()
120110
}
121111

122112
private fun parseEntryParams(entry: String): Map<String, String> {
123-
Log.parsingEntryParams(entry)
124113
val pattern = """(?:(\w+)=(?:\w+\("(.+)"\)|"(.+?)"))+""".toRegex()
125114
return pattern.findAll(entry).associate { match ->
126115
val (key, argumentValue, plainValue) = match.destructured
@@ -130,7 +119,6 @@ private fun parseEntryParams(entry: String): Map<String, String> {
130119
}
131120

132121
private fun parseSceneName(scenePath: String): String? {
133-
Log.parsingEntryParams(scenePath)
134122
val pattern = """^res://(.*).tscn$""".toRegex()
135123
return pattern.find(scenePath)?.groupValues?.getOrNull(1)
136124
}

src/main/kotlin/com/tomwyr/generator/Renderer.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ class NodeTreeRenderer {
6464
.mapIndexed { index: Int, s: String -> if (index == 0) s else s.capitalize() }
6565
.joinToString("")
6666

67-
Log.renderingNode(node, nodePath)
68-
6967
val field = when (node) {
7068
is ParentNode -> """
7169
|val $symbolName = ${symbolName}Tree()

src/main/kotlin/com/tomwyr/utils/Project.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.tomwyr.utils
22

33
import com.tomwyr.GodotNodeTreeConfig
44
import com.tomwyr.common.InvalidGodotProject
5-
import com.tomwyr.common.Log
65
import com.tomwyr.common.SceneData
76
import java.io.File
87
import java.nio.file.FileSystems
@@ -40,23 +39,10 @@ class GodotKotlinProject(
4039
companion object Factory {
4140
fun create(rootPath: String, config: GodotNodeTreeConfig): GodotKotlinProject {
4241
val targetPackage = config.packageName
43-
if (targetPackage != null) {
44-
Log.targetPackage(targetPackage)
45-
}
46-
47-
Log.kotlinProjectPath(rootPath)
48-
4942
val projectRelativePath = config.projectPath
50-
if (projectRelativePath != null) {
51-
Log.godotCustomProjectPath(projectRelativePath)
52-
}
53-
5443
val projectPath = getProjectPath(rootPath, projectRelativePath)
5544
projectPath ?: throw InvalidGodotProject()
56-
Log.godotProjectPath(projectPath)
57-
5845
val outputPath = getOutputPath(rootPath, targetPackage)
59-
Log.kotlinOutputPath(outputPath)
6046

6147
return GodotKotlinProject(projectPath, outputPath, targetPackage)
6248
}

src/test/kotlin/com/tomwyr/GeneratorTest.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ class GeneratorTest {
3434
fun `multiple scenes`() {
3535
test("dodge-the-creeps", "com.example.game")
3636
}
37-
38-
@BeforeTest
39-
fun setUpTestLogger() {
40-
Log.logger = object : Logger {
41-
override fun debug(message: String) {}
42-
override fun info(message: String) {}
43-
override fun warn(message: String) {}
44-
}
45-
}
4637
}
4738

4839
fun test(testCase: String, targetPackage: String) {

0 commit comments

Comments
 (0)