 import PackageLoading
 
 @testable import Build
+
+#if os(macOS)
+    let defaultTargetTriple: String =  "x86_64-apple-macosx10.10"
+#elseif os(Windows)
+    let defaultTargetTriple: String =  "x86_64-unknown-windows-msvc"
+#elseif os(Linux)
+    #if arch(x86_64)
+      let defaultTargetTriple: String = "x86_64-unknown-linux"
+    #elseif arch(i386)
+      let defaultTargetTriple: String = "i386-unknown-linux"
+    #elseif arch(powerpc64le)
+      let defaultTargetTriple: String = "ppc64le-unknown-linux"
+    #elseif arch(s390x)
+      let defaultTargetTriple: String = "s390x-unknown-linux"
+    #elseif arch(arm64)
+      let defaultTargetTriple: String = "aarch64-unknown-linux"
+    #elseif arch(arm)
+      let defaultTargetTriple: String = "armv7-unknown-linux-gnueabihf"
+    #endif
+#endif
 
 private struct MockToolchain: Toolchain {
     let swiftCompiler = AbsolutePath("/fake/path/to/swiftc")

        var args: [String] = []

      #if os(macOS)
        args += ["-fobjc-arc", "-target", "x86_64-apple-macosx10.10"]
      #else
        args += ["-target", "x86_64-unknown-linux"]
      #endif

        args += ["-g", "-O0", "-DSWIFT_PACKAGE=1", "-DDEBUG=1"]

      #if os(macOS)
        XCTAssertMatch(aTarget, ["-target", "x86_64-apple-macosx10.13", .anySequence])
      #else
        XCTAssertMatch(aTarget, [.equal("-target"), .equal(defaultTargetTriple), .anySequence] )
      #endif

        let bTarget = try result.target(for: "BTarget").swiftTarget().compileArguments()
      #if os(macOS)
        XCTAssertMatch(bTarget, ["-target", "x86_64-apple-macosx10.12", .anySequence])
      #else
        XCTAssertMatch(bTarget, [.equal("-target"), .equal(defaultTargetTriple), .anySequence] )
      #endif
    }
    func testPlatformsValidation() throws {
        let fileSystem = InMemoryFileSystem(emptyFiles:
            "/A/Sources/ATarget/foo.swift",
