Skip to content

Commit 5be405c

Browse files
committed
add option for xcmappingmodel
Signed-off-by: Lucas Romano <[email protected]>
1 parent afc11bc commit 5be405c

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

tools/generators/files_and_groups/src/ElementCreator/CreateGroupChild.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ extension ElementCreator.CreateGroupChild {
105105
)
106106
)
107107

108+
case "xcmappingmodel":
109+
return .elementAndChildren(
110+
createFile(
111+
name: name,
112+
bazelPath: BazelPath(
113+
parent: parentBazelPath,
114+
path: name
115+
),
116+
bazelPathType: parentBazelPathType,
117+
transitiveBazelPaths: []
118+
)
119+
)
120+
108121
default:
109122
return .elementAndChildren(
110123
createGroup(

tools/generators/files_and_groups/test/ElementCreator/CreateFileElementTests.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,37 @@ final class CreateFileElementTests: XCTestCase {
497497
)
498498
XCTAssertEqual(result.resolvedRepository, stubbedResolvedRepository)
499499
}
500+
501+
func test_element_content_explicitFileType_xcmappingmodel() {
502+
// Arrange
503+
504+
let name = "Mapping.xcmappingmodel"
505+
let ext = "xcmappingmodel"
506+
let bazelPath = BazelPath("a/bazel/path/Mapping.xcmappingmodel")
507+
let createAttributes = ElementCreator.CreateAttributes.stub(
508+
elementAttributes: ElementAttributes(
509+
sourceTree: .group, name: nil, path: "a_path"
510+
),
511+
resolvedRepository: nil
512+
)
513+
514+
let expectedContent = #"""
515+
{isa = PBXFileReference; explicitFileType = wrapper.xcmappingmodel; path = a_path; sourceTree = "<group>"; }
516+
"""#
517+
518+
// Act
519+
520+
let result = ElementCreator.CreateFileElement.defaultCallable(
521+
name: name,
522+
ext: ext,
523+
bazelPath: bazelPath,
524+
bazelPathType: .workspace,
525+
createAttributes: createAttributes,
526+
createIdentifier: ElementCreator.Stubs.createIdentifier
527+
)
528+
529+
// Assert
530+
531+
XCTAssertEqual(result.element.object.content, expectedContent)
532+
}
500533
}

0 commit comments

Comments
 (0)