-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xcframework prebuilt binaries #3123
Changes from 5 commits
11ee044
1b939b0
0c5ee02
d489007
014ca18
b4b8bb1
83c4a46
932eccf
30dc6fd
b06a5dd
07df005
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Result | ||
|
||
/// Framework Suffix | ||
public enum FrameworkSuffix: String { | ||
/// Framework | ||
case framework = "framework" | ||
|
||
/// XCFramework | ||
case xcframework = "xcframework" | ||
|
||
/// Attempts to parse a product type from a string path component | ||
public static func from(string: String) -> Result<FrameworkSuffix, CarthageError> { | ||
return Result(self.init(rawValue: string), failWith: .parseError(description: "unexpected framework suffix \"\(string)\"")) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,6 +323,9 @@ public enum FrameworkType: String, Codable { | |
internal enum PackageType: String { | ||
/// A .framework package. | ||
case framework = "FMWK" | ||
|
||
/// A .xcframework package | ||
case xcframework = "XFWK" | ||
|
||
/// A .bundle package. Some frameworks might have this package type code | ||
/// (e.g. https://github.com/ResearchKit/ResearchKit/blob/1.3.0/ResearchKit/Info.plist#L15-L16). | ||
|
@@ -1357,6 +1360,9 @@ extension Signal where Value: TaskEventType { | |
} | ||
|
||
public func nonDestructivelyStripArchitectures(_ frameworkURL: URL, _ architectures: Set<String>) -> SignalProducer<(Data, URL), CarthageError> { | ||
guard isNotXCFramework(frameworkURL) else { | ||
return SignalProducer<(Data, URL), CarthageError>.empty | ||
} | ||
return SignalProducer(value: frameworkURL) | ||
.attemptMap(binaryURL) | ||
.attemptMap { | ||
|
@@ -1413,6 +1419,9 @@ public func nonDestructivelyStripArchitectures(_ frameworkURL: URL, _ architectu | |
|
||
/// Strips the given architectures from a framework. | ||
private func stripArchitectures(_ packageURL: URL, _ architectures: Set<String>) -> SignalProducer<(), CarthageError> { | ||
guard isNotXCFramework(packageURL) else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation fix needed. Please check the indentation of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 👍 |
||
return SignalProducer<(), CarthageError>.empty | ||
} | ||
return SignalProducer<URL, CarthageError> { () -> Result<URL, CarthageError> in binaryURL(packageURL) } | ||
.flatMap(.merge) { binaryURL -> SignalProducer<(), CarthageError> in | ||
let arguments = [ | ||
|
@@ -1431,6 +1440,9 @@ private func stripArchitectures(_ packageURL: URL, _ architectures: Set<String>) | |
|
||
// Returns a signal of all architectures present in a given package. | ||
public func architecturesInPackage(_ packageURL: URL, xcrunQuery: [String] = ["lipo", "-info"]) -> SignalProducer<[String], CarthageError> { | ||
guard isNotXCFramework(packageURL) else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation fix needed. Please check the indentation of return statement below it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done for all changes made in the PR 👍 |
||
return SignalProducer(value: []) | ||
} | ||
let binaryURLResult = binaryURL(packageURL) | ||
guard let binaryURL = binaryURLResult.value else { return SignalProducer(error: binaryURLResult.error!) } | ||
|
||
|
@@ -1491,6 +1503,9 @@ public func architecturesInPackage(_ packageURL: URL, xcrunQuery: [String] = ["l | |
|
||
/// Strips debug symbols from the given framework | ||
public func stripDebugSymbols(_ frameworkURL: URL) -> SignalProducer<(), CarthageError> { | ||
guard isNotXCFramework(frameworkURL) else { | ||
return SignalProducer<(), CarthageError>.empty | ||
} | ||
return SignalProducer<URL, CarthageError> { () -> Result<URL, CarthageError> in binaryURL(frameworkURL) } | ||
.flatMap(.merge) { binaryURL -> SignalProducer<TaskEvent<Data>, CarthageError> in | ||
let stripTask = Task("/usr/bin/xcrun", arguments: [ "strip", "-S", "-o", binaryURL.path, binaryURL.path]) | ||
|
@@ -1532,6 +1547,9 @@ private func stripDirectory(named directory: String, of frameworkURL: URL) -> Si | |
|
||
/// Sends a set of UUIDs for each architecture present in the given framework. | ||
public func UUIDsForFramework(_ frameworkURL: URL) -> SignalProducer<Set<UUID>, CarthageError> { | ||
guard isNotXCFramework(frameworkURL) else { | ||
return SignalProducer(value: Set<UUID>()) | ||
} | ||
return SignalProducer { () -> Result<URL, CarthageError> in binaryURL(frameworkURL) } | ||
.flatMap(.merge, UUIDsFromDwarfdump) | ||
} | ||
|
@@ -1649,3 +1667,7 @@ private func codesign(_ frameworkURL: URL, _ expandedIdentity: String) -> Signal | |
.mapError(CarthageError.taskError) | ||
.then(SignalProducer<(), CarthageError>.empty) | ||
} | ||
|
||
private func isNotXCFramework(_ frameworkUrl: URL) -> Bool { | ||
return FrameworkSuffix.from(string: frameworkUrl.pathExtension).value != .xcframework | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation fix needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍