feat(RES-34): Fix plist font filename (#14)
All checks were successful
gitea-openium/resgen.swift/pipeline/head This commit looks good
All checks were successful
gitea-openium/resgen.swift/pipeline/head This commit looks good
Reviewed-on: #14
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
struct ConfigurationFile: Codable, CustomDebugStringConvertible {
|
||||
|
||||
var architecture: ConfigurationArchitecture?
|
||||
var analytics: [AnalyticsConfiguration]
|
||||
var colors: [ColorsConfiguration]
|
||||
@ -15,12 +16,12 @@ struct ConfigurationFile: Codable, CustomDebugStringConvertible {
|
||||
var images: [ImagesConfiguration]
|
||||
var strings: [StringsConfiguration]
|
||||
var tags: [TagsConfiguration]
|
||||
|
||||
|
||||
var runnableConfigurations: [Runnable] {
|
||||
let runnables: [[Runnable]] = [analytics, colors, fonts, images, strings, tags]
|
||||
return Array(runnables.joined())
|
||||
}
|
||||
|
||||
|
||||
var debugDescription: String {
|
||||
"""
|
||||
\(analytics)
|
||||
@ -44,20 +45,21 @@ struct ConfigurationFile: Codable, CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
struct ConfigurationArchitecture: Codable {
|
||||
|
||||
let property: String
|
||||
let classname: String
|
||||
let path: String?
|
||||
let children: [ConfigurationArchitecture]?
|
||||
|
||||
let children: [Self]?
|
||||
|
||||
func getProperty(isStatic: Bool) -> String {
|
||||
" \(isStatic ? "static " : "")let \(property) = \(classname)()"
|
||||
}
|
||||
|
||||
|
||||
func getClass(generateStaticProperty: Bool = true) -> String {
|
||||
guard children?.isEmpty == false else {
|
||||
return "final class \(classname): Sendable {}"
|
||||
}
|
||||
|
||||
|
||||
let classDefinition = [
|
||||
"class \(classname) {",
|
||||
children?.map { $0.getProperty(isStatic: generateStaticProperty) }.joined(separator: "\n"),
|
||||
@ -65,12 +67,12 @@ struct ConfigurationArchitecture: Codable {
|
||||
]
|
||||
.compactMap { $0 }
|
||||
.joined(separator: "\n")
|
||||
|
||||
|
||||
return [classDefinition, "", getSubclass()]
|
||||
.compactMap { $0 }
|
||||
.joined(separator: "\n")
|
||||
}
|
||||
|
||||
|
||||
func getSubclass() -> String? {
|
||||
guard let children else { return nil }
|
||||
return children.compactMap { arch in
|
||||
@ -81,26 +83,29 @@ struct ConfigurationArchitecture: Codable {
|
||||
}
|
||||
|
||||
struct AnalyticsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let target: String
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers = staticMembers {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
internal init(inputFile: String,
|
||||
target: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?) {
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
target: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.target = target
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
@ -108,7 +113,7 @@ struct AnalyticsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
|
||||
var debugDescription: String {
|
||||
"""
|
||||
Analytics configuration:
|
||||
@ -122,6 +127,7 @@ struct AnalyticsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let style: String
|
||||
let xcassetsPath: String
|
||||
@ -130,22 +136,24 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers = staticMembers {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
internal init(inputFile: String,
|
||||
style: String,
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?) {
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
style: String,
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.style = style
|
||||
self.xcassetsPath = xcassetsPath
|
||||
@ -155,7 +163,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
|
||||
var debugDescription: String {
|
||||
"""
|
||||
Colors configuration:
|
||||
@ -171,6 +179,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
@ -178,21 +187,23 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionSuffix: String?
|
||||
let infoPlistPaths: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers = staticMembers {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
internal init(inputFile: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
infoPlistPaths: String?,
|
||||
staticMembers: Bool?) {
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
infoPlistPaths: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
@ -201,7 +212,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.infoPlistPaths = infoPlistPaths
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
|
||||
var debugDescription: String {
|
||||
"""
|
||||
Fonts configuration:
|
||||
@ -216,6 +227,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let xcassetsPath: String
|
||||
let extensionOutputPath: String
|
||||
@ -223,21 +235,23 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers = staticMembers {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
internal init(inputFile: String,
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?) {
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
xcassetsPath: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.xcassetsPath = xcassetsPath
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
@ -246,7 +260,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
|
||||
var debugDescription: String {
|
||||
"""
|
||||
Images configuration:
|
||||
@ -261,6 +275,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let outputPath: String
|
||||
let langs: String
|
||||
@ -272,28 +287,30 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
private let xcStrings: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers = staticMembers {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var xcStringsOptions: Bool {
|
||||
if let xcStrings = xcStrings {
|
||||
if let xcStrings {
|
||||
return xcStrings
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
internal init(inputFile: String,
|
||||
outputPath: String,
|
||||
langs: String,
|
||||
defaultLang: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?,
|
||||
xcStrings: Bool?) {
|
||||
internal init(
|
||||
inputFile: String,
|
||||
outputPath: String,
|
||||
langs: String,
|
||||
defaultLang: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?,
|
||||
xcStrings: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.outputPath = outputPath
|
||||
self.langs = langs
|
||||
@ -304,7 +321,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.staticMembers = staticMembers
|
||||
self.xcStrings = xcStrings
|
||||
}
|
||||
|
||||
|
||||
var debugDescription: String {
|
||||
"""
|
||||
Strings configuration:
|
||||
@ -320,26 +337,29 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
}
|
||||
|
||||
struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
|
||||
let inputFile: String
|
||||
let lang: String
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers = staticMembers {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
internal init(inputFile: String,
|
||||
lang: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?) {
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
lang: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.lang = lang
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
@ -347,7 +367,7 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
|
||||
var debugDescription: String {
|
||||
"""
|
||||
Tags configuration:
|
||||
|
Reference in New Issue
Block a user