Optional generation of Images extension. Make extensionOutputPath optional for Images and Colors cause it's not needed if no extensionName are provided

This commit is contained in:
2025-07-17 10:23:05 +02:00
parent 4426091dcb
commit e22f9ba894
12 changed files with 132 additions and 97 deletions

View File

@@ -27,29 +27,23 @@ extension ColorsConfiguration: Runnable {
style,
"--xcassets-path",
xcassetsPath.prependIfRelativePath(projectDirectory),
"--extension-output-path",
extensionOutputPath.prependIfRelativePath(projectDirectory),
"--static-members",
"\(staticMembersOptions)"
]
if let extensionName {
args += [
"--extension-name",
extensionName
]
}
if let extensionNameUIKit {
args += [
"--extension-name-ui-kit",
extensionNameUIKit
]
}
if let extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
// Add optional parameters
[
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
("--extension-name", extensionName),
("--extension-name-ui-kit", extensionNameUIKit),
("--extension-suffix", extensionSuffix)
].forEach { argumentName, argumentValue in
if let argumentValue {
args += [
argumentName,
argumentValue
]
}
}
return args

View File

@@ -25,31 +25,23 @@ extension ImagesConfiguration: Runnable {
inputFile.prependIfRelativePath(projectDirectory),
"--xcassets-path",
xcassetsPath.prependIfRelativePath(projectDirectory),
"--extension-output-path",
extensionOutputPath.prependIfRelativePath(projectDirectory),
"--static-members",
"\(staticMembersOptions)"
]
if let extensionName {
args += [
"--extension-name",
extensionName
]
}
if let extensionNameUIKit {
args += [
"--extension-name-ui-kit",
extensionNameUIKit
]
}
if let extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
// Add optional parameters
[
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
("--extension-name", extensionName),
("--extension-name-ui-kit", extensionNameUIKit),
("--extension-suffix", extensionSuffix)
].forEach { argumentName, argumentValue in
if let argumentValue {
args += [
argumentName,
argumentValue
]
}
}
return args