Bump core version
This commit is contained in:
parent
96a17b1594
commit
f7c2ca7cf9
|
@ -15,8 +15,8 @@
|
||||||
"repositoryURL": "https://github.com/tuist/core.git",
|
"repositoryURL": "https://github.com/tuist/core.git",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "49c1b488b2eec6b1561e79ab96e61bf3acab5d91",
|
"revision": "4500863dd846244323b29cb0950cb861e1fddcd0",
|
||||||
"version": "0.2.0"
|
"version": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ let package = Package(
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMinor(from: "6.0.0")),
|
.package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMinor(from: "6.0.0")),
|
||||||
.package(url: "https://github.com/tuist/core.git", .upToNextMinor(from: "0.2.0")),
|
.package(url: "https://github.com/tuist/core.git", .revision("4500863dd846244323b29cb0950cb861e1fddcd0")),
|
||||||
.package(url: "https://github.com/apple/swift-package-manager", .upToNextMinor(from: "0.2.1")),
|
.package(url: "https://github.com/apple/swift-package-manager", .upToNextMinor(from: "0.2.1")),
|
||||||
.package(url: "https://github.com/Carthage/ReactiveTask.git", .upToNextMinor(from: "0.15.0")),
|
.package(url: "https://github.com/Carthage/ReactiveTask.git", .upToNextMinor(from: "0.15.0")),
|
||||||
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMinor(from: "1.0.1")),
|
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMinor(from: "1.0.1")),
|
||||||
|
|
|
@ -116,10 +116,10 @@ class CommandRunner: CommandRunning {
|
||||||
}
|
}
|
||||||
|
|
||||||
func runAtPath(_ path: AbsolutePath) throws {
|
func runAtPath(_ path: AbsolutePath) throws {
|
||||||
var args = [path.appending(component: Constants.binName).asString]
|
try system.popen(path.appending(component: Constants.binName).asString,
|
||||||
args.append(contentsOf: Array(arguments().dropFirst()))
|
arguments: Array(arguments().dropFirst()),
|
||||||
|
verbose: false,
|
||||||
try system.popen(args, verbose: false)
|
environment: System.userEnvironment)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Static
|
// MARK: - Static
|
||||||
|
|
|
@ -36,9 +36,9 @@ class BuildCopier: BuildCopying {
|
||||||
let filePath = from.appending(component: file)
|
let filePath = from.appending(component: file)
|
||||||
let toPath = to.appending(component: file)
|
let toPath = to.appending(component: file)
|
||||||
if !fileHandler.exists(filePath) { return }
|
if !fileHandler.exists(filePath) { return }
|
||||||
try system.capture("cp", "-rf", filePath.asString, toPath.asString, verbose: false).throwIfError()
|
try system.capture("/bin/cp", arguments: "-rf", filePath.asString, toPath.asString, verbose: false, environment: nil).throwIfError()
|
||||||
if file == "tuist" {
|
if file == "tuist" {
|
||||||
try system.capture("chmod", "+x", toPath.asString, verbose: false).throwIfError()
|
try system.capture("/bin/chmod", arguments: "+x", toPath.asString, verbose: false, environment: nil).throwIfError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,11 +124,17 @@ final class Installer: Installing {
|
||||||
// Download bundle
|
// Download bundle
|
||||||
printer.print("Downloading version from \(bundleURL.absoluteString)")
|
printer.print("Downloading version from \(bundleURL.absoluteString)")
|
||||||
let downloadPath = temporaryDirectory.path.appending(component: Constants.bundleName)
|
let downloadPath = temporaryDirectory.path.appending(component: Constants.bundleName)
|
||||||
try system.capture("curl", "-LSs", "--output", downloadPath.asString, bundleURL.absoluteString, verbose: false).throwIfError()
|
try system.capture("/usr/bin/curl",
|
||||||
|
arguments: "-LSs", "--output", downloadPath.asString, bundleURL.absoluteString,
|
||||||
|
verbose: false,
|
||||||
|
environment: nil).throwIfError()
|
||||||
|
|
||||||
// Unzip
|
// Unzip
|
||||||
printer.print("Installing...")
|
printer.print("Installing...")
|
||||||
try system.capture("unzip", downloadPath.asString, "-d", installationDirectory.asString, verbose: true).throwIfError()
|
try system.capture("/usr/bin/unzip",
|
||||||
|
arguments: downloadPath.asString, "-d", installationDirectory.asString,
|
||||||
|
verbose: false,
|
||||||
|
environment: nil).throwIfError()
|
||||||
|
|
||||||
try createTuistVersionFile(version: version, path: installationDirectory)
|
try createTuistVersionFile(version: version, path: installationDirectory)
|
||||||
printer.print("Version \(version) installed")
|
printer.print("Version \(version) installed")
|
||||||
|
@ -144,9 +150,15 @@ final class Installer: Installing {
|
||||||
// Cloning and building
|
// Cloning and building
|
||||||
printer.print("Pulling source code")
|
printer.print("Pulling source code")
|
||||||
|
|
||||||
try system.capture("git", "clone", Constants.gitRepositoryURL, temporaryDirectory.path.asString, verbose: false).throwIfError()
|
try system.capture("/usr/bin/env",
|
||||||
|
arguments: "git", "clone", Constants.gitRepositoryURL, temporaryDirectory.path.asString,
|
||||||
|
verbose: false,
|
||||||
|
environment: System.userEnvironment).throwIfError()
|
||||||
do {
|
do {
|
||||||
try system.capture("git", "-C", temporaryDirectory.path.asString, "checkout", version, verbose: false).throwIfError()
|
try system.capture("/usr/bin/env",
|
||||||
|
arguments: "git", "-C", temporaryDirectory.path.asString, "checkout", version,
|
||||||
|
verbose: false,
|
||||||
|
environment: System.userEnvironment).throwIfError()
|
||||||
} catch let error as SystemError {
|
} catch let error as SystemError {
|
||||||
if error.description.contains("did not match any file(s) known to git") {
|
if error.description.contains("did not match any file(s) known to git") {
|
||||||
throw InstallerError.versionNotFound(version)
|
throw InstallerError.versionNotFound(version)
|
||||||
|
@ -156,22 +168,26 @@ final class Installer: Installing {
|
||||||
|
|
||||||
printer.print("Building using Swift (it might take a while)")
|
printer.print("Building using Swift (it might take a while)")
|
||||||
|
|
||||||
let swiftPath = try system.capture("/usr/bin/xcrun", "-f", "swift", verbose: false).stdout.chuzzle()!
|
let swiftPath = try system.capture("/usr/bin/xcrun", arguments: "-f", "swift", verbose: false, environment: nil).stdout.chuzzle()!
|
||||||
try system.capture(swiftPath, "build",
|
try system.capture(swiftPath,
|
||||||
|
arguments: "build",
|
||||||
"--product", "tuist",
|
"--product", "tuist",
|
||||||
"--package-path", temporaryDirectory.path.asString,
|
"--package-path", temporaryDirectory.path.asString,
|
||||||
"--configuration", "release",
|
"--configuration", "release",
|
||||||
"-Xswiftc", "-static-stdlib",
|
"-Xswiftc", "-static-stdlib",
|
||||||
verbose: false).throwIfError()
|
verbose: false,
|
||||||
try system.capture(swiftPath, "build",
|
environment: System.userEnvironment).throwIfError()
|
||||||
|
try system.capture(swiftPath,
|
||||||
|
arguments: "build",
|
||||||
"--product", "ProjectDescription",
|
"--product", "ProjectDescription",
|
||||||
"--package-path", temporaryDirectory.path.asString,
|
"--package-path", temporaryDirectory.path.asString,
|
||||||
"--configuration", "release",
|
"--configuration", "release",
|
||||||
verbose: false).throwIfError()
|
verbose: false,
|
||||||
|
environment: System.userEnvironment).throwIfError()
|
||||||
|
|
||||||
// Copying files
|
// Copying files
|
||||||
if !fileHandler.exists(installationDirectory) {
|
if !fileHandler.exists(installationDirectory) {
|
||||||
try system.capture("/bin/mkdir", installationDirectory.asString, verbose: false).throwIfError()
|
try system.capture("/bin/mkdir", arguments: installationDirectory.asString, verbose: false, environment: nil).throwIfError()
|
||||||
}
|
}
|
||||||
try buildCopier.copy(from: buildDirectory,
|
try buildCopier.copy(from: buildDirectory,
|
||||||
to: installationDirectory)
|
to: installationDirectory)
|
||||||
|
|
|
@ -29,6 +29,6 @@ class CreateIssueCommand: NSObject, Command {
|
||||||
// MARK: - Command
|
// MARK: - Command
|
||||||
|
|
||||||
func run(with _: ArgumentParser.Result) throws {
|
func run(with _: ArgumentParser.Result) throws {
|
||||||
try system.popen("open", CreateIssueCommand.createIssueUrl, verbose: false)
|
try system.popen("/usr/bin/open", arguments: CreateIssueCommand.createIssueUrl, verbose: false, environment: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ final class Embeddable {
|
||||||
|
|
||||||
func architectures(system: Systeming = System()) throws -> [String] {
|
func architectures(system: Systeming = System()) throws -> [String] {
|
||||||
guard let binPath = try binaryPath() else { return [] }
|
guard let binPath = try binaryPath() else { return [] }
|
||||||
let lipoResult = try system.capture("lipo", "-info", binPath.asString, verbose: false).throwIfError().stdout.chuzzle() ?? ""
|
let lipoResult = try system.capture("/usr/bin/lipo", arguments: "-info", binPath.asString, verbose: false, environment: nil).stdout.chuzzle() ?? ""
|
||||||
var characterSet = CharacterSet.alphanumerics
|
var characterSet = CharacterSet.alphanumerics
|
||||||
characterSet.insert(charactersIn: " _-")
|
characterSet.insert(charactersIn: " _-")
|
||||||
let scanner = Scanner(string: lipoResult)
|
let scanner = Scanner(string: lipoResult)
|
||||||
|
@ -170,7 +170,10 @@ final class Embeddable {
|
||||||
fileprivate func stripArchitecture(packagePath: AbsolutePath,
|
fileprivate func stripArchitecture(packagePath: AbsolutePath,
|
||||||
architecture: String,
|
architecture: String,
|
||||||
system: Systeming = System()) throws {
|
system: Systeming = System()) throws {
|
||||||
try system.popen("lipo", "-remove", architecture, "-output", packagePath.asString, packagePath.asString, verbose: false)
|
try system.popen("/usr/bin/lipo",
|
||||||
|
arguments: "-remove", architecture, "-output", packagePath.asString, packagePath.asString,
|
||||||
|
verbose: false,
|
||||||
|
environment: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func stripHeaders(frameworkPath: AbsolutePath) throws {
|
fileprivate func stripHeaders(frameworkPath: AbsolutePath) throws {
|
||||||
|
@ -217,7 +220,10 @@ final class Embeddable {
|
||||||
|
|
||||||
fileprivate func uuidsFromDwarfdump(path: AbsolutePath,
|
fileprivate func uuidsFromDwarfdump(path: AbsolutePath,
|
||||||
system: Systeming = System()) throws -> Set<UUID> {
|
system: Systeming = System()) throws -> Set<UUID> {
|
||||||
let result = try system.capture("dwarfdump", "--uuid", path.asString, verbose: false).throwIfError().stdout.chuzzle() ?? ""
|
let result = try system.capture("/usr/bin/dwarfdump",
|
||||||
|
arguments: "--uuid", path.asString,
|
||||||
|
verbose: false,
|
||||||
|
environment: nil).stdout.chuzzle() ?? ""
|
||||||
var uuidCharacterSet = CharacterSet()
|
var uuidCharacterSet = CharacterSet()
|
||||||
uuidCharacterSet.formUnion(.letters)
|
uuidCharacterSet.formUnion(.letters)
|
||||||
uuidCharacterSet.formUnion(.decimalDigits)
|
uuidCharacterSet.formUnion(.decimalDigits)
|
||||||
|
|
|
@ -160,7 +160,7 @@ class GraphManifestLoader: GraphManifestLoading {
|
||||||
fileprivate func loadSwiftManifest(path: AbsolutePath) throws -> JSON {
|
fileprivate func loadSwiftManifest(path: AbsolutePath) throws -> JSON {
|
||||||
let projectDescriptionPath = try resourceLocator.projectDescription()
|
let projectDescriptionPath = try resourceLocator.projectDescription()
|
||||||
var arguments: [String] = [
|
var arguments: [String] = [
|
||||||
"xcrun", "swiftc",
|
"swiftc",
|
||||||
"--driver-mode=swift",
|
"--driver-mode=swift",
|
||||||
"-suppress-warnings",
|
"-suppress-warnings",
|
||||||
"-I", projectDescriptionPath.parentDirectory.asString,
|
"-I", projectDescriptionPath.parentDirectory.asString,
|
||||||
|
@ -172,7 +172,10 @@ class GraphManifestLoader: GraphManifestLoading {
|
||||||
try fileAggregator.aggregate(moduleLoader.load(path).reversed(), into: file.path)
|
try fileAggregator.aggregate(moduleLoader.load(path).reversed(), into: file.path)
|
||||||
arguments.append(file.path.asString)
|
arguments.append(file.path.asString)
|
||||||
arguments.append("--dump")
|
arguments.append("--dump")
|
||||||
let result = try system.capture(arguments, verbose: false)
|
let result = try system.capture("/usr/bin/xcrun",
|
||||||
|
arguments: arguments,
|
||||||
|
verbose: false,
|
||||||
|
environment: System.userEnvironment)
|
||||||
try result.throwIfError()
|
try result.throwIfError()
|
||||||
let jsonString: String! = result.stdout.chuzzle()
|
let jsonString: String! = result.stdout.chuzzle()
|
||||||
if jsonString == nil {
|
if jsonString == nil {
|
||||||
|
|
|
@ -151,7 +151,10 @@ class PrecompiledNode: GraphNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
func architectures(system: Systeming = System()) throws -> [Architecture] {
|
func architectures(system: Systeming = System()) throws -> [Architecture] {
|
||||||
let result = try system.capture("lipo", "-info", binaryPath.asString, verbose: false).throwIfError().stdout.chuzzle() ?? ""
|
let result = try system.capture("/usr/bin/lipo",
|
||||||
|
arguments: "-info", binaryPath.asString,
|
||||||
|
verbose: false,
|
||||||
|
environment: nil).stdout.chuzzle() ?? ""
|
||||||
let regex = try NSRegularExpression(pattern: ".+:\\s.+\\sis\\sarchitecture:\\s(.+)", options: [])
|
let regex = try NSRegularExpression(pattern: ".+:\\s.+\\sis\\sarchitecture:\\s(.+)", options: [])
|
||||||
guard let match = regex.firstMatch(in: result, options: [], range: NSRange(location: 0, length: result.count)) else {
|
guard let match = regex.firstMatch(in: result, options: [], range: NSRange(location: 0, length: result.count)) else {
|
||||||
throw PrecompiledNodeError.architecturesNotFound(binaryPath)
|
throw PrecompiledNodeError.architecturesNotFound(binaryPath)
|
||||||
|
@ -161,7 +164,10 @@ class PrecompiledNode: GraphNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
func linking(system: Systeming = System()) throws -> Linking {
|
func linking(system: Systeming = System()) throws -> Linking {
|
||||||
let result = try system.capture("file", binaryPath.asString, verbose: false).throwIfError().stdout.chuzzle() ?? ""
|
let result = try system.capture("/usr/bin/file",
|
||||||
|
arguments: binaryPath.asString,
|
||||||
|
verbose: false,
|
||||||
|
environment: nil).throwIfError().stdout.chuzzle() ?? ""
|
||||||
return result.contains("dynamically linked") ? .dynamic : .static
|
return result.contains("dynamically linked") ? .dynamic : .static
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ final class CreateIssueCommandTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_run() throws {
|
func test_run() throws {
|
||||||
system.stub(args: ["open", CreateIssueCommand.createIssueUrl], stderror: nil, stdout: nil, exitstatus: 0)
|
system.stub(args: ["/usr/bin/open", CreateIssueCommand.createIssueUrl], stderror: nil, stdout: nil, exitstatus: 0)
|
||||||
try subject.run(with: ArgumentParser.Result.test())
|
try subject.run(with: ArgumentParser.Result.test())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,7 @@ final class EmbeddableTests: XCTestCase {
|
||||||
|
|
||||||
func test_uuids_whenFramework() throws {
|
func test_uuids_whenFramework() throws {
|
||||||
try withUniversalFramework {
|
try withUniversalFramework {
|
||||||
let expected: Set<UUID> = Set(arrayLiteral: UUID(uuidString: "510FD121-B669-3524-A748-2DDF357A051C")!,
|
let expected: Set<UUID> = Set(arrayLiteral: UUID(uuidString: "510FD121-B669-3524-A748-2DDF357A051C")!)
|
||||||
UUID(uuidString: "FB17107A-86FA-3880-92AC-C9AA9E04BA98")!)
|
|
||||||
try XCTAssertEqual($0.uuids(), expected)
|
try XCTAssertEqual($0.uuids(), expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,12 @@ final class FrameworkNodeTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_architectures() throws {
|
func test_architectures() throws {
|
||||||
system.stub(args: ["lipo -info /test.framework/test"], stderror: nil, stdout: "Non-fat file: path is architecture: x86_64", exitstatus: 0)
|
system.stub(args: ["/usr/bin/lipo -info /test.framework/test"], stderror: nil, stdout: "Non-fat file: path is architecture: x86_64", exitstatus: 0)
|
||||||
try XCTAssertEqual(subject.architectures(system: system).first, .x8664)
|
try XCTAssertEqual(subject.architectures(system: system).first, .x8664)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_linking() {
|
func test_linking() {
|
||||||
system.stub(args: ["file", "/test.framework/test"], stderror: nil, stdout: "whatever dynamically linked", exitstatus: 0)
|
system.stub(args: ["/usr/bin/file", "/test.framework/test"], stderror: nil, stdout: "whatever dynamically linked", exitstatus: 0)
|
||||||
try XCTAssertEqual(subject.linking(system: system), .dynamic)
|
try XCTAssertEqual(subject.linking(system: system), .dynamic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,12 @@ final class LibraryNodeTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_architectures() throws {
|
func test_architectures() throws {
|
||||||
system.stub(args: ["lipo", "-info", "/test.a"], stderror: nil, stdout: "Non-fat file: path is architecture: x86_64", exitstatus: 0)
|
system.stub(args: ["/usr/bin/lipo", "-info", "/test.a"], stderror: nil, stdout: "Non-fat file: path is architecture: x86_64", exitstatus: 0)
|
||||||
try XCTAssertEqual(subject.architectures(system: system).first, .x8664)
|
try XCTAssertEqual(subject.architectures(system: system).first, .x8664)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_linking() {
|
func test_linking() {
|
||||||
system.stub(args: ["file /test.a"], stderror: nil, stdout: "whatever dynamically linked", exitstatus: 0)
|
system.stub(args: ["/usr/bin/file", "/test.a"], stderror: nil, stdout: "whatever dynamically linked", exitstatus: 0)
|
||||||
try XCTAssertEqual(subject.linking(system: system), .dynamic)
|
try XCTAssertEqual(subject.linking(system: system), .dynamic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ final class GraphTests: XCTestCase {
|
||||||
cache.add(targetNode: targetNode)
|
cache.add(targetNode: targetNode)
|
||||||
let graph = Graph.test(cache: cache)
|
let graph = Graph.test(cache: cache)
|
||||||
|
|
||||||
system.stub(args: ["file", "/test/test.framework/test"],
|
system.stub(args: ["/usr/bin/file", "/test/test.framework/test"],
|
||||||
stderror: nil,
|
stderror: nil,
|
||||||
stdout: "dynamically linked",
|
stdout: "dynamically linked",
|
||||||
exitstatus: 0)
|
exitstatus: 0)
|
||||||
|
|
Loading…
Reference in New Issue