This repository was archived by the owner on Dec 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +22
-3
lines changed
src/main/kotlin/com/liteldev/headeroutput Expand file tree Collapse file tree 5 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,10 @@ regex = [
100
100
" ^.*VariantBuilder" , # for mc
101
101
]
102
102
103
+ [ignore ]
104
+
105
+ regex = []
106
+
103
107
[sort ]
104
108
parent = [
105
109
# { parent = "Actor", dst = "Actor" },
Original file line number Diff line number Diff line change @@ -149,7 +149,8 @@ object HeaderOutput {
149
149
val notIdentifiedTypes = mutableSetOf<String >()
150
150
logger.info { " Loading types..." }
151
151
typeDataMap
152
- .filterNot { (k, _) -> GeneratorConfig .isExcludedFromGeneration(k) }
152
+ .filterNot { (k, _) -> GeneratorConfig .isExcluded(k) }
153
+ .filterNot { (k, _) -> GeneratorConfig .isIgnored(k) }
153
154
.forEach { (typeName, type) ->
154
155
TypeManager .addType(
155
156
typeName,
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ object TypeManager {
116
116
private fun createDummyClass (name : String , type : TypeKind ? = null): BaseType ? {
117
117
require(! hasType(name)) { " type $name already exists" }
118
118
119
- if (GeneratorConfig .isExcludedFromGeneration (name)) {
119
+ if (GeneratorConfig .isExcluded (name)) {
120
120
return null
121
121
}
122
122
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ object GeneratorConfig {
26
26
lateinit var replacementRegex: List <Pair <Regex , String >>
27
27
28
28
private lateinit var excludeRegexList: List <Regex >
29
+ private lateinit var ignoreRegexList: List <Regex >
29
30
private lateinit var generatorConfigData: OutputConfig
30
31
31
32
@@ -45,13 +46,20 @@ object GeneratorConfig {
45
46
enableRelativePath = generatorConfigData.config.enableRelativePath
46
47
rootPath = generatorConfigData.config.rootPath
47
48
excludeRegexList = generatorConfigData.exclusion.regex.map { it.toRegex() }
49
+ ignoreRegexList = generatorConfigData.ignore.regex.map { it.toRegex() }
48
50
replacementRegex = generatorConfigData.replacement.regex.map { it.regex.toRegex() to it.to }
49
51
}
50
52
51
- fun isExcludedFromGeneration (name : String ): Boolean {
53
+ // Exclude means exclude from the origin data, and do not generate the dummy type
54
+ fun isExcluded (name : String ): Boolean {
52
55
return excludeRegexList.any { name.matches(it) }
53
56
}
54
57
58
+ // Ignore means ignore from the origin data, and generate the dummy type
59
+ fun isIgnored (name : String ): Boolean {
60
+ return ignoreRegexList.any { name.matches(it) }
61
+ }
62
+
55
63
fun getSortRules () = generatorConfigData.sort
56
64
57
65
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ data class OutputConfig(
7
7
val config : Config ,
8
8
val exclusion : Exclusion ,
9
9
val sort : Sort ,
10
+ val ignore : Ignore ,
10
11
val replacement : Replacement
11
12
) {
12
13
@Serializable
@@ -36,6 +37,11 @@ data class OutputConfig(
36
37
val regex : List <String >
37
38
)
38
39
40
+ @Serializable
41
+ data class Ignore (
42
+ val regex : List <String >
43
+ )
44
+
39
45
@Serializable
40
46
data class Replacement (
41
47
val regex : List <Regex >
You can’t perform that action at this time.
0 commit comments