Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Reviewed-on: #1
181 lines
4.7 KiB
Swift
181 lines
4.7 KiB
Swift
//
|
|
// ConfigurationFile.swift
|
|
//
|
|
//
|
|
// Created by Thibaut Schmitt on 30/08/2022.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct ConfigurationFile: Codable, CustomDebugStringConvertible {
|
|
var colors: [ColorsConfiguration]
|
|
var fonts: [FontsConfiguration]
|
|
var images: [ImagesConfiguration]
|
|
var strings: [StringsConfiguration]
|
|
var tags: [TagsConfiguration]
|
|
|
|
var runnableConfigurations: [Runnable] {
|
|
let runnables: [[Runnable]] = [colors, fonts, images, strings, tags]
|
|
return Array(runnables.joined())
|
|
}
|
|
|
|
var debugDescription: String {
|
|
"""
|
|
\(colors)
|
|
-----------
|
|
-----------
|
|
\(fonts)
|
|
-----------
|
|
-----------
|
|
\(images)
|
|
-----------
|
|
-----------
|
|
\(strings)
|
|
-----------
|
|
-----------
|
|
\(tags)
|
|
"""
|
|
}
|
|
}
|
|
|
|
|
|
struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|
let inputFile: String
|
|
let style: String
|
|
let xcassetsPath: String
|
|
let extensionOutputPath: String
|
|
let extensionName: String?
|
|
let extensionSuffix: String?
|
|
private let staticMembers: Bool?
|
|
|
|
var staticMembersOptions: Bool {
|
|
if let staticMembers = staticMembers {
|
|
return staticMembers
|
|
}
|
|
return false
|
|
}
|
|
|
|
var debugDescription: String {
|
|
"""
|
|
Colors configuration:
|
|
- Input file: \(inputFile)
|
|
- Style: \(style)
|
|
- Xcassets path: \(xcassetsPath)
|
|
- Extension output path: \(extensionOutputPath)
|
|
- Extension name: \(extensionName ?? "-")
|
|
- Extension suffix: \(extensionSuffix ?? "-")
|
|
"""
|
|
}
|
|
}
|
|
|
|
struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
|
let inputFile: String
|
|
let extensionOutputPath: String
|
|
let extensionName: String?
|
|
let extensionSuffix: String?
|
|
private let staticMembers: Bool?
|
|
|
|
var staticMembersOptions: Bool {
|
|
if let staticMembers = staticMembers {
|
|
return staticMembers
|
|
}
|
|
return false
|
|
}
|
|
|
|
var debugDescription: String {
|
|
"""
|
|
Fonts configuration:
|
|
- Input file: \(inputFile)
|
|
- Extension output path: \(extensionOutputPath)
|
|
- Extension name: \(extensionName ?? "-")
|
|
- Extension suffix: \(extensionSuffix ?? "-")
|
|
"""
|
|
}
|
|
}
|
|
|
|
struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|
let inputFile: String
|
|
let xcassetsPath: String
|
|
let extensionOutputPath: String
|
|
let extensionName: String?
|
|
let extensionSuffix: String?
|
|
private let staticMembers: Bool?
|
|
|
|
var staticMembersOptions: Bool {
|
|
if let staticMembers = staticMembers {
|
|
return staticMembers
|
|
}
|
|
return false
|
|
}
|
|
|
|
var debugDescription: String {
|
|
"""
|
|
Images configuration:
|
|
- Input file: \(inputFile)
|
|
- Xcassets path: \(xcassetsPath)
|
|
- Extension output path: \(extensionOutputPath)
|
|
- Extension name: \(extensionName ?? "-")
|
|
- Extension suffix: \(extensionSuffix ?? "-")
|
|
"""
|
|
}
|
|
}
|
|
|
|
struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
|
let inputFile: String
|
|
let outputPath: String
|
|
let langs: String
|
|
let defaultLang: String
|
|
let extensionOutputPath: String
|
|
let extensionName: String?
|
|
let extensionSuffix: String?
|
|
private let staticMembers: Bool?
|
|
|
|
var staticMembersOptions: Bool {
|
|
if let staticMembers = staticMembers {
|
|
return staticMembers
|
|
}
|
|
return false
|
|
}
|
|
|
|
var debugDescription: String {
|
|
"""
|
|
Strings configuration:
|
|
- Input file: \(inputFile)
|
|
- Output path: \(outputPath)
|
|
- Langs: \(langs)
|
|
- Default lang: \(defaultLang)
|
|
- Extension output path: \(extensionOutputPath)
|
|
- Extension name: \(extensionName ?? "-")
|
|
- Extension suffix: \(extensionSuffix ?? "-")
|
|
"""
|
|
}
|
|
}
|
|
|
|
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 {
|
|
return staticMembers
|
|
}
|
|
return false
|
|
}
|
|
|
|
var debugDescription: String {
|
|
"""
|
|
Tags configuration:
|
|
- Input file: \(inputFile)
|
|
- Lang: \(lang)
|
|
- Extension output path: \(extensionOutputPath)
|
|
- Extension name: \(extensionName ?? "-")
|
|
- Extension suffix: \(extensionSuffix ?? "-")
|
|
"""
|
|
}
|
|
}
|
|
|