Created
December 27, 2016 10:59
-
-
Save pepicrft/a76b378af9726fec55b8f0d10db68b1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift | |
import Foundation | |
print("Ensuring Swift-Package-Manager compatibility") | |
let fileManager = FileManager.default | |
let currentPath = fileManager.currentDirectoryPath | |
let podURL = URL(fileURLWithPath: currentPath).appendingPathComponent("${POD_NAME}/Classes") | |
print("Pod path: \(podURL.path)") | |
let sourcesURL = URL(fileURLWithPath: currentPath).appendingPathComponent("Sources") | |
print("Sources path: \(sourcesURL.path)") | |
_ = try? fileManager.removeItem(at: sourcesURL) | |
_ = try? fileManager.createDirectory(at: sourcesURL, | |
withIntermediateDirectories: true, | |
attributes: nil) | |
fileManager.enumerator(at: podURL, includingPropertiesForKeys: nil)?.forEach { element in | |
guard let fileURL = element as? URL else { return } | |
if !fileURL.path.contains(".swift") { return } | |
print("Symlinking: \(fileURL.path)") | |
let symTo = fileURL | |
let symFrom = sourcesURL.appendingPathComponent(symTo.lastPathComponent) | |
_ = try? fileManager.createSymbolicLink(at: symFrom, withDestinationURL: symTo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment