import Commander
import PathKit

func build() throws {
  let libraries = Path.glob(".build/debug/*.a")
  let testSources = Path.glob("Tests/*.swift").map { $0.description }

  let arguments = [
    "-o", ".build/debug/spectre-runner",
    "-I.build/debug",
  ] + libraries.map { "-Xlinker \($0)" } + testSources

  try invoke("swiftc", arguments)
}

func runTests() throws {
  try invoke(".build/debug/spectre-runner", [])
}

command {
  try build()
  try runTests()
}.run()

import Commander
import PathKit

private func target_specific_arguments() throws -> [String] {
#if os(OSX)
  return [
    "-sdk",
    "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk",
    "-target", "x86_64-apple-macosx10.10",
    "-Xlinker", "-all_load",
  ]
#else
  return []
#endif
}

func build() throws {
  let libraries = Path.glob(".build/debug/*.a")
  let testSources = Path.glob("Tests/*.swift").map { $0.description }

  let arguments = try target_specific_arguments() + [
    "-o", ".build/debug/spectre-runner",
    "-I.build/debug",
  ] + libraries.map { "-Xlinker \($0)" } + testSources

  try invoke("swiftc", arguments)
}

func runTests() throws {
  try invoke(".build/debug/spectre-runner", [])
}

command {
  try build()
  try runTests()
}.run()

Add necessary flags for naive OS X support
Add necessary flags for naive OS X support
