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,16 +16,22 @@ final class ColorsConfigurationTests: XCTestCase {
func test_argsGeneration_requiredArgs() {
// Given
let testingConfiguration = ColorsConfiguration(inputFile: "path/to/colors.txt",
style: ColorStyle.all.rawValue,
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: nil,
extensionName: nil,
extensionNameUIKit: nil,
extensionSuffix: nil,
staticMembers: false)
let testingConfiguration = ColorsConfiguration(
inputFile: "path/to/colors.txt",
style: ColorStyle.all.rawValue,
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: nil,
extensionName: nil,
extensionNameUIKit: nil,
extensionSuffix: nil,
visibility: nil,
staticMembers: false
)
// When
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: false)
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: false
)
// Expect
let expectedArguments = [
@@ -43,16 +49,22 @@ final class ColorsConfigurationTests: XCTestCase {
func test_argsGeneration_allArguments() {
// Given
let testingConfiguration = ColorsConfiguration(inputFile: "path/to/colors.txt",
style: ColorStyle.all.rawValue,
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Colors/Generated",
extensionName: "AppUIColor",
extensionNameUIKit: "AppColor",
extensionSuffix: "Testing",
staticMembers: false)
let testingConfiguration = ColorsConfiguration(
inputFile: "path/to/colors.txt",
style: ColorStyle.all.rawValue,
xcassetsPath: "path/to/assets.xcassets",
extensionOutputPath: "Colors/Generated",
extensionName: "AppUIColor",
extensionNameUIKit: "AppColor",
extensionSuffix: "Testing",
visibility: "public",
staticMembers: false
)
// When
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: true)
let arguments = testingConfiguration.getArguments(
projectDirectory: projectDirectory,
force: true
)
// Expect
let expectedArguments = [
@@ -62,8 +74,6 @@ final class ColorsConfigurationTests: XCTestCase {
"all",
"--xcassets-path",
"projectDirectory/path/to/assets.xcassets",
"--static-members",
"false",
"--extension-output-path",
"projectDirectory/Colors/Generated",
"--extension-name",
@@ -72,6 +82,10 @@ final class ColorsConfigurationTests: XCTestCase {
"AppColor",
"--extension-suffix",
"Testing",
"--visibility",
"public",
"--static-members",
"false"
]
XCTAssertEqual(arguments, expectedArguments)