Skip to content

Commit

Permalink
Address merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lakpa committed Dec 9, 2019
1 parent 9c21445 commit 8b2e5ed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
16 changes: 16 additions & 0 deletions Sources/TuistCore/Graph/GraphLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ public class GraphLoader: GraphLoading {
swiftModuleMap: swiftModuleMap,
libraryPath: libraryPath,
graphLoaderCache: graphLoaderCache)
// XCFramework
case let .xcFramework(frameworkPath):
return try loadXCFrameworkNode(path: frameworkPath, graphLoaderCache: graphLoaderCache)

// System SDK
case let .sdk(name, status):
return try SDKNode(name: name, platform: platform, status: status)
Expand Down Expand Up @@ -260,4 +264,16 @@ public class GraphLoader: GraphLoading {
graphLoaderCache.add(cocoapods: node)
return node
}

/// Loads the XCFramework node. If it it exists in the cache, it returns it from the cache.
/// Otherwise, it initializes it, stores it in the cache, and then returns it.
///
/// - Parameters:
/// - xcframeworkPath: Path to the .xcframework.
/// - graphLoaderCache: Graph loader cache.
fileprivate func loadXCFrameworkNode(
path: AbsolutePath,
graphLoaderCache: GraphLoaderCaching) throws -> XCFrameworkNode {
return try XCFrameworkParser.parse(path: path, cache: graphLoaderCache)
}
}
14 changes: 13 additions & 1 deletion Sources/TuistGenerator/Generator/LinkGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,19 @@ final class LinkGenerator: LinkGenerating {

try dependencies.forEach { dependency in
if case let GraphDependencyReference.absolute(path) = dependency {
precompiledFrameworkPaths.append(path)
if path.extension == "xcframework" {
guard let fileRef = fileElements.file(path: path) else {
throw LinkGeneratorError.missingReference(path: path)
}
let buildFile = PBXBuildFile(
file: fileRef,
settings: ["ATTRIBUTES": ["CodeSignOnCopy"]]
)
pbxproj.add(object: buildFile)
embedPhase.files?.append(buildFile)
} else {
precompiledFrameworkPaths.append(path)
}
} else if case let GraphDependencyReference.product(target, _) = dependency {
guard let fileRef = fileElements.product(target: target) else {
throw LinkGeneratorError.missingProduct(name: target)
Expand Down
4 changes: 2 additions & 2 deletions Tests/TuistGeneratorTests/Generator/LinkGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ final class LinkGeneratorErrorTests: XCTestCase {

func test_generateEmbedPhase_setupEmbedFrameworksBuildPhase_whenXCFrameworkIsPresent() throws {
// Given
var dependencies: [DependencyReference] = []
dependencies.append(DependencyReference.absolute(AbsolutePath("/Frameworks/Test.xcframework")))
var dependencies: [GraphDependencyReference] = []
dependencies.append(GraphDependencyReference.absolute(AbsolutePath("/Frameworks/Test.xcframework")))
let pbxproj = PBXProj()
let pbxTarget = PBXNativeTarget(name: "Test")
let sourceRootPath = AbsolutePath("/")
Expand Down

0 comments on commit 8b2e5ed

Please sign in to comment.