Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
chore: try add namespace sort
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Oct 9, 2024
1 parent 5f155c5 commit a2c6e56
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/kotlin/com/liteldev/headeroutput/entity/BaseType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ abstract class BaseType(
val forwardDeclareList: MutableSet<String> = mutableSetOf()

val simpleName = name.substringAfterLast("::")
val namespace = name.substringBeforeLast("::")
val fullEscapeName = name.replace("::", "_")
val fullUpperEscapeName = fullEscapeName.uppercase(Locale.getDefault())

Expand Down Expand Up @@ -56,6 +57,17 @@ abstract class BaseType(
?.let {
return@run "$root/${it.dst}/${this.simpleName}.$HEADER_SUFFIX"
}
val parentRules = GeneratorConfig.getSortRules().namespace
parentRules.find { this.namespace.startsWith(it.namespace) }
?.let {
return@run "$root/${it.dst}/${this.simpleName}.$HEADER_SUFFIX"
}
} else if (this is NamespaceType) {
val parentRules = GeneratorConfig.getSortRules().namespace
parentRules.find { this.name.startsWith(it.namespace) }
?.let {
return@run "$root/${it.dst}/${this.simpleName}.$HEADER_SUFFIX"
}
}
regexRules.filter { !it.override }.find { this.name.matches(it.regex.toRegex()) }?.let {
return@run "$root/${it.dst}/${this.simpleName}.$HEADER_SUFFIX"
Expand Down

0 comments on commit a2c6e56

Please sign in to comment.