Skip to content

Commit

Permalink
Fixups for building and testing on linux/docker
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottwilliams committed Nov 9, 2020
1 parent 49bb0cd commit a5c8cbe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Sources/XcodeProj/Extensions/Path+Extras.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import PathKit

// MARK: - Path extras.

#if os(macOS)
let systemGlob = Darwin.glob
#else
let systemGlob = Glibc.glob
#endif

extension Path {
/// Creates a directory
Expand All @@ -28,7 +32,11 @@ extension Path {

let flags = GLOB_TILDE | GLOB_BRACE | GLOB_MARK
if systemGlob(cPattern, flags, nil, &gt) == 0 {
#if os(macOS)
let matchc = gt.gl_matchc
#else
let matchc = gt.gl_pathc
#endif
return (0 ..< Int(matchc)).compactMap { index in
if let path = String(validatingUTF8: gt.gl_pathv[index]!) {
return Path(path)
Expand Down
2 changes: 1 addition & 1 deletion Sources/XcodeProj/Objects/Project/PBXProjEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ final class PBXProjEncoder {
try write(section: section, proj: proj, objects: objects, sort: outputSettings.projFileListOrder.sort, stateHolder: &stateHolder, to: &output)
}

final class PBXProjElement {
final class PBXProjElement: NSObject {
let key: CommentedString
let value: PlistValue
let multiline: Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import PathKit
import XCTest
@testable import XcodeProj

import Darwin

final class PBXProjIntegrationTests: XCTestCase {
func test_init_initializesTheProjCorrectly() {
let data = try! Data(contentsOf: fixturePath().url)
Expand Down Expand Up @@ -40,7 +38,7 @@ final class PBXProjIntegrationTests: XCTestCase {
// Create a commit
try checkedOutput("git", ["init"])
try checkedOutput("git", ["add", "."])
try checkedOutput("git", ["commit", "-m", "test"])
try checkedOutput("git", ["-c", "[email protected]", "commit", "-m", "test"])

// Read/write the project
let project = try XcodeProj(path: xcodeprojPath)
Expand Down

0 comments on commit a5c8cbe

Please sign in to comment.