feat(RES-57): Add visibility to control scope of generated code (#18)
All checks were successful
gitea-openium/resgen.swift/pipeline/head This commit looks good

Add visibility parameter: public, package, internal, private
Impacted command: analytics, colors, fonts, images, strings, tags

Reviewed-on: #18
This commit is contained in:
2025-07-21 16:56:05 +02:00
parent beca2c6b2b
commit 5ad219ae89
62 changed files with 1526 additions and 794 deletions

View File

@@ -16,24 +16,28 @@ final class ImagesConfigurationTests: XCTestCase {
func test_argsGeneration_requiredArgs() {
// Given
let testingConfiguration = ImagesConfiguration(inputFile: "path/to/images.txt",
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: nil,
extensionName: nil,
extensionNameUIKit: nil,
extensionSuffix: nil,
staticMembers: nil)
let testingConfiguration = ImagesConfiguration(
inputFile: "path/to/images.txt",
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: nil,
extensionName: nil,
extensionNameUIKit: nil,
extensionSuffix: nil,
visibility: nil,
staticMembers: nil
)
// When
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: false)
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: false
)
// Expect
let expectedArguments = [
"projectDirectory/path/to/images.txt",
"--xcassets-path",
"projectDirectory/path/to/assets.xcassets",
"--static-members",
"false"
"projectDirectory/path/to/assets.xcassets"
]
XCTAssertEqual(arguments, expectedArguments)
@@ -41,16 +45,22 @@ final class ImagesConfigurationTests: XCTestCase {
func test_argsGeneration_allArguments() {
// Given
let testingConfiguration = ImagesConfiguration(inputFile: "path/to/images.txt",
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Images/Generated",
extensionName: "AppUIImage",
extensionNameUIKit: "AppImage",
extensionSuffix: "Testing",
staticMembers: true)
let testingConfiguration = ImagesConfiguration(
inputFile: "path/to/images.txt",
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Images/Generated",
extensionName: "AppUIImage",
extensionNameUIKit: "AppImage",
extensionSuffix: "Testing",
visibility: "private",
staticMembers: true
)
// When
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: true)
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: true
)
// Expect
let expectedArguments = [
@@ -58,8 +68,6 @@ final class ImagesConfigurationTests: XCTestCase {
"projectDirectory/path/to/images.txt",
"--xcassets-path",
"projectDirectory/path/to/assets.xcassets",
"--static-members",
"true",
"--extension-output-path",
"projectDirectory/Images/Generated",
"--extension-name",
@@ -68,6 +76,10 @@ final class ImagesConfigurationTests: XCTestCase {
"AppImage",
"--extension-suffix",
"Testing",
"--visibility",
"private",
"--static-members",
"true"
]
XCTAssertEqual(arguments, expectedArguments)