/parsePackage.swift Secret
Created
May 24, 2017 23:49
Star
You must be signed in to star a gist
This file contains 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
// TODO(owensd): Need to actually get the version of Swift that the workspace is using based on the OS. | |
projectPath = params.rootPath! | |
let includePath = "/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/lib/swift/pm" | |
let packagePath = "\(projectPath!)/Package.swift" | |
let swiftPath = "/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift" | |
let output = shell( | |
tool: swiftPath, | |
arguments: ["-I", includePath, "-L", includePath, "-lPackageDescription", packagePath, "-fileno", "1"]) | |
let packageJson = try JSValue.parse(output) | |
moduleName = packageJson["package"]["name"].string! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment