Skip to content

Commit 82811fd

Browse files
committed
Make project path validation optional
1 parent 7656459 commit 82811fd

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ class GodotKotlinTree : Plugin<Project> {
2929

3030
open class GodotKotlinTreeInput(
3131
var projectPath: String? = null,
32+
var validateProjectPath: Boolean = true,
3233
var packageName: String? = null,
3334
)

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
package com.tomwyr.command
22

33
import com.tomwyr.GodotKotlinTreeInput
4-
import com.tomwyr.common.InvalidGodotProject
54
import com.tomwyr.ffi.generateNodeTree
65
import org.gradle.api.Project
7-
import java.io.File
86
import java.nio.file.Paths
97

108
class GenerateTreeCommand(
119
val libPath: String,
1210
val projectPath: String,
11+
val validateProjectPath: Boolean,
1312
val outputPath: String,
1413
val packageName: String?,
1514
) {
1615
fun run() {
17-
val tree = generateNodeTree(libPath = libPath, projectPath = projectPath)
16+
val tree = generateNodeTree(
17+
libPath = libPath,
18+
projectPath = projectPath,
19+
validateProjectPath = validateProjectPath
20+
)
1821
val content = NodeTreeRenderer().render(packageName, tree)
1922
NodeTreeWriter().write(content, outputPath)
2023
}
@@ -29,6 +32,7 @@ class GenerateTreeCommand(
2932
return GenerateTreeCommand(
3033
libPath = libPath,
3134
projectPath = projectPath,
35+
validateProjectPath = input.validateProjectPath,
3236
outputPath = outputPath,
3337
packageName = input.packageName
3438
)

src/main/kotlin/com/tomwyr/ffi/Ffi.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import com.tomwyr.common.GeneratorError
77
import com.tomwyr.common.GodotNodeTreeError
88
import com.tomwyr.common.NodeTree
99

10-
fun generateNodeTree(libPath: String, projectPath: String): NodeTree {
10+
fun generateNodeTree(libPath: String, projectPath: String, validateProjectPath: Boolean): NodeTree {
1111
val lib = Native.load(libPath, GodotNodeTreeLib::class.java)
12-
val resultPtr = lib.generateNodeTree(projectPath)
12+
val resultPtr = lib.generateNodeTree(projectPath, validateProjectPath)
1313
val result = Result.fromJson<NodeTree, GodotNodeTreeError>(resultPtr.getString(0))
1414
return when (result) {
1515
is Ok -> result.value
@@ -18,5 +18,5 @@ fun generateNodeTree(libPath: String, projectPath: String): NodeTree {
1818
}
1919

2020
interface GodotNodeTreeLib : Library {
21-
fun generateNodeTree(projectPath: String): Pointer
21+
fun generateNodeTree(projectPath: String, validateProjectPath: Boolean): Pointer
2222
}
192 Bytes
Binary file not shown.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ fun setUpTestCommand(testCase: String, packageName: String): GenerateTreeCommand
4848
return GenerateTreeCommand(
4949
libPath = "libGodotNodeTreeCore.dylib",
5050
projectPath = "$basePath/$testCase/scenes",
51+
validateProjectPath = false,
5152
outputPath = "$basePath/$testCase/Actual",
5253
packageName = packageName,
5354
)
192 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)