Bump core version

This commit is contained in:
Pedro Piñera 2018-10-05 16:50:55 +02:00
parent 96a17b1594
commit f7c2ca7cf9
13 changed files with 65 additions and 35 deletions

View File

@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/tuist/core.git",
"state": {
"branch": null,
"revision": "49c1b488b2eec6b1561e79ab96e61bf3acab5d91",
"version": "0.2.0"
"revision": "4500863dd846244323b29cb0950cb861e1fddcd0",
"version": null
}
},
{

View File

@ -13,7 +13,7 @@ let package = Package(
],
dependencies: [
.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/Carthage/ReactiveTask.git", .upToNextMinor(from: "0.15.0")),
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMinor(from: "1.0.1")),

View File

@ -116,10 +116,10 @@ class CommandRunner: CommandRunning {
}
func runAtPath(_ path: AbsolutePath) throws {
var args = [path.appending(component: Constants.binName).asString]
args.append(contentsOf: Array(arguments().dropFirst()))
try system.popen(args, verbose: false)
try system.popen(path.appending(component: Constants.binName).asString,
arguments: Array(arguments().dropFirst()),
verbose: false,
environment: System.userEnvironment)
}
// MARK: - Static

View File

@ -36,9 +36,9 @@ class BuildCopier: BuildCopying {
let filePath = from.appending(component: file)
let toPath = to.appending(component: file)
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" {
try system.capture("chmod", "+x", toPath.asString, verbose: false).throwIfError()
try system.capture("/bin/chmod", arguments: "+x", toPath.asString, verbose: false, environment: nil).throwIfError()
}
}
}

View File

@ -124,11 +124,17 @@ final class Installer: Installing {
// Download bundle
printer.print("Downloading version from \(bundleURL.absoluteString)")
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
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)
printer.print("Version \(version) installed")
@ -144,9 +150,15 @@ final class Installer: Installing {
// Cloning and building
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 {
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 {
if error.description.contains("did not match any file(s) known to git") {
throw InstallerError.versionNotFound(version)
@ -156,22 +168,26 @@ final class Installer: Installing {
printer.print("Building using Swift (it might take a while)")
let swiftPath = try system.capture("/usr/bin/xcrun", "-f", "swift", verbose: false).stdout.chuzzle()!
try system.capture(swiftPath, "build",
let swiftPath = try system.capture("/usr/bin/xcrun", arguments: "-f", "swift", verbose: false, environment: nil).stdout.chuzzle()!
try system.capture(swiftPath,
arguments: "build",
"--product", "tuist",
"--package-path", temporaryDirectory.path.asString,
"--configuration", "release",
"-Xswiftc", "-static-stdlib",
verbose: false).throwIfError()
try system.capture(swiftPath, "build",
verbose: false,
environment: System.userEnvironment).throwIfError()
try system.capture(swiftPath,
arguments: "build",
"--product", "ProjectDescription",
"--package-path", temporaryDirectory.path.asString,
"--configuration", "release",
verbose: false).throwIfError()
verbose: false,
environment: System.userEnvironment).throwIfError()
// Copying files
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,
to: installationDirectory)

View File

@ -29,6 +29,6 @@ class CreateIssueCommand: NSObject, Command {
// MARK: - Command
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)
}
}

View File

@ -91,7 +91,7 @@ final class Embeddable {
func architectures(system: Systeming = System()) throws -> [String] {
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
characterSet.insert(charactersIn: " _-")
let scanner = Scanner(string: lipoResult)
@ -170,7 +170,10 @@ final class Embeddable {
fileprivate func stripArchitecture(packagePath: AbsolutePath,
architecture: String,
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 {
@ -217,7 +220,10 @@ final class Embeddable {
fileprivate func uuidsFromDwarfdump(path: AbsolutePath,
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()
uuidCharacterSet.formUnion(.letters)
uuidCharacterSet.formUnion(.decimalDigits)

View File

@ -160,7 +160,7 @@ class GraphManifestLoader: GraphManifestLoading {
fileprivate func loadSwiftManifest(path: AbsolutePath) throws -> JSON {
let projectDescriptionPath = try resourceLocator.projectDescription()
var arguments: [String] = [
"xcrun", "swiftc",
"swiftc",
"--driver-mode=swift",
"-suppress-warnings",
"-I", projectDescriptionPath.parentDirectory.asString,
@ -172,7 +172,10 @@ class GraphManifestLoader: GraphManifestLoading {
try fileAggregator.aggregate(moduleLoader.load(path).reversed(), into: file.path)
arguments.append(file.path.asString)
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()
let jsonString: String! = result.stdout.chuzzle()
if jsonString == nil {

View File

@ -151,7 +151,10 @@ class PrecompiledNode: GraphNode {
}
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: [])
guard let match = regex.firstMatch(in: result, options: [], range: NSRange(location: 0, length: result.count)) else {
throw PrecompiledNodeError.architecturesNotFound(binaryPath)
@ -161,7 +164,10 @@ class PrecompiledNode: GraphNode {
}
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
}
}

View File

@ -23,7 +23,7 @@ final class CreateIssueCommandTests: XCTestCase {
}
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())
}
}

View File

@ -100,8 +100,7 @@ final class EmbeddableTests: XCTestCase {
func test_uuids_whenFramework() throws {
try withUniversalFramework {
let expected: Set<UUID> = Set(arrayLiteral: UUID(uuidString: "510FD121-B669-3524-A748-2DDF357A051C")!,
UUID(uuidString: "FB17107A-86FA-3880-92AC-C9AA9E04BA98")!)
let expected: Set<UUID> = Set(arrayLiteral: UUID(uuidString: "510FD121-B669-3524-A748-2DDF357A051C")!)
try XCTAssertEqual($0.uuids(), expected)
}
}

View File

@ -43,12 +43,12 @@ final class FrameworkNodeTests: XCTestCase {
}
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)
}
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)
}
}
@ -70,12 +70,12 @@ final class LibraryNodeTests: XCTestCase {
}
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)
}
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)
}
}

View File

@ -175,7 +175,7 @@ final class GraphTests: XCTestCase {
cache.add(targetNode: targetNode)
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,
stdout: "dynamically linked",
exitstatus: 0)