Add visibility parameters to control scope of generated extension
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
@ -86,31 +86,21 @@ 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 {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let outputFile: String
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
target: String,
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
outputFile: String,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
self.target = target
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.outputFile = outputFile
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -119,9 +109,9 @@ struct AnalyticsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
Analytics configuration:
|
||||
- Input file: \(inputFile)
|
||||
- Target: \(target)
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Output file: \(outputFile)
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -135,14 +125,8 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -152,6 +136,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -161,6 +146,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionName = extensionName
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -174,6 +160,8 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -186,14 +174,8 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
let infoPlistPaths: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -202,6 +184,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
infoPlistPaths: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -210,6 +193,7 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.infoPlistPaths = infoPlistPaths
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -222,6 +206,8 @@ struct FontsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- InfoPlistPaths: \(infoPlistPaths ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -234,14 +220,8 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionName: String?
|
||||
let extensionNameUIKit: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -250,6 +230,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionName: String?,
|
||||
extensionNameUIKit: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -258,6 +239,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionName = extensionName
|
||||
self.extensionNameUIKit = extensionNameUIKit
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -270,6 +252,8 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -283,22 +267,9 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionOutputPath: String?
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
private let xcStrings: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var xcStringsOptions: Bool {
|
||||
if let xcStrings {
|
||||
return xcStrings
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
let xcStrings: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -308,6 +279,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionOutputPath: String?,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?,
|
||||
xcStrings: Bool?
|
||||
) {
|
||||
@ -318,6 +290,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
self.xcStrings = xcStrings
|
||||
}
|
||||
@ -332,6 +305,9 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension output path: \(extensionOutputPath ?? "-")
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
- XC Strings: \(xcStrings != nil ? "\(String(describing: xcStrings))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -343,14 +319,8 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
let extensionOutputPath: String
|
||||
let extensionName: String?
|
||||
let extensionSuffix: String?
|
||||
private let staticMembers: Bool?
|
||||
|
||||
var staticMembersOptions: Bool {
|
||||
if let staticMembers {
|
||||
return staticMembers
|
||||
}
|
||||
return false
|
||||
}
|
||||
let visibility: String?
|
||||
let staticMembers: Bool?
|
||||
|
||||
internal init(
|
||||
inputFile: String,
|
||||
@ -358,6 +328,7 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
extensionOutputPath: String,
|
||||
extensionName: String?,
|
||||
extensionSuffix: String?,
|
||||
visibility: String?,
|
||||
staticMembers: Bool?
|
||||
) {
|
||||
self.inputFile = inputFile
|
||||
@ -365,6 +336,7 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
self.extensionOutputPath = extensionOutputPath
|
||||
self.extensionName = extensionName
|
||||
self.extensionSuffix = extensionSuffix
|
||||
self.visibility = visibility
|
||||
self.staticMembers = staticMembers
|
||||
}
|
||||
|
||||
@ -376,6 +348,8 @@ struct TagsConfiguration: Codable, CustomDebugStringConvertible {
|
||||
- Extension output path: \(extensionOutputPath)
|
||||
- Extension name: \(extensionName ?? "-")
|
||||
- Extension suffix: \(extensionSuffix ?? "-")
|
||||
- Visiblity: \(visibility ?? "default")
|
||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,11 @@ import Foundation
|
||||
extension AnalyticsConfiguration: Runnable {
|
||||
|
||||
func run(projectDirectory: String, force: Bool) {
|
||||
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
||||
Analytics.main(args)
|
||||
}
|
||||
|
||||
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
||||
var args = [String]()
|
||||
|
||||
if force {
|
||||
@ -20,25 +25,23 @@ extension AnalyticsConfiguration: Runnable {
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--target",
|
||||
target,
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
"--output-file",
|
||||
outputFile.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
]
|
||||
}
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
// Add optional parameters
|
||||
[
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Analytics.main(args)
|
||||
return args
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,7 @@ extension ColorsConfiguration: Runnable {
|
||||
"--style",
|
||||
style,
|
||||
"--xcassets-path",
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
@ -36,7 +34,9 @@ extension ColorsConfiguration: Runnable {
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
|
@ -22,9 +22,7 @@ extension FontsConfiguration: Runnable {
|
||||
}
|
||||
|
||||
args += [
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
inputFile.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
@ -32,7 +30,9 @@ extension FontsConfiguration: Runnable {
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
|
@ -24,9 +24,7 @@ extension ImagesConfiguration: Runnable {
|
||||
args += [
|
||||
inputFile.prependIfRelativePath(projectDirectory),
|
||||
"--xcassets-path",
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
xcassetsPath.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
@ -34,7 +32,9 @@ extension ImagesConfiguration: Runnable {
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-name-ui-kit", extensionNameUIKit),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
|
@ -10,6 +10,11 @@ import Foundation
|
||||
extension StringsConfiguration: Runnable {
|
||||
|
||||
func run(projectDirectory: String, force: Bool) {
|
||||
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
||||
Stringium.main(args)
|
||||
}
|
||||
|
||||
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
||||
var args = [String]()
|
||||
|
||||
if force {
|
||||
@ -23,18 +28,17 @@ extension StringsConfiguration: Runnable {
|
||||
"--langs",
|
||||
langs,
|
||||
"--default-lang",
|
||||
defaultLang,
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)",
|
||||
"--xc-strings",
|
||||
"\(xcStringsOptions)"
|
||||
defaultLang
|
||||
]
|
||||
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
||||
("--extension-name", extensionName),
|
||||
("--extension-suffix", extensionSuffix)
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--xc-strings", staticMembers?.description),
|
||||
("--static-members", xcStrings?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
@ -44,6 +48,6 @@ extension StringsConfiguration: Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
Stringium.main(args)
|
||||
return args
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,11 @@ import Foundation
|
||||
extension TagsConfiguration: Runnable {
|
||||
|
||||
func run(projectDirectory: String, force: Bool) {
|
||||
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
||||
Tags.main(args)
|
||||
}
|
||||
|
||||
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
||||
var args = [String]()
|
||||
|
||||
if force {
|
||||
@ -21,24 +26,24 @@ extension TagsConfiguration: Runnable {
|
||||
"--lang",
|
||||
lang,
|
||||
"--extension-output-path",
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory),
|
||||
"--static-members",
|
||||
"\(staticMembersOptions)"
|
||||
extensionOutputPath.prependIfRelativePath(projectDirectory)
|
||||
]
|
||||
|
||||
if let extensionName {
|
||||
args += [
|
||||
"--extension-name",
|
||||
extensionName
|
||||
]
|
||||
}
|
||||
if let extensionSuffix {
|
||||
args += [
|
||||
"--extension-suffix",
|
||||
extensionSuffix
|
||||
]
|
||||
// Add optional parameters
|
||||
[
|
||||
("--extension-name", extensionName),
|
||||
("--extension-suffix", extensionSuffix),
|
||||
("--visibility", visibility),
|
||||
("--static-members", staticMembers?.description)
|
||||
].forEach { argumentName, argumentValue in
|
||||
if let argumentValue {
|
||||
args += [
|
||||
argumentName,
|
||||
argumentValue
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Tags.main(args)
|
||||
return args
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user