From fd713e7fcc927aa6f925bd3d5664d818d4392e9b Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Thu, 29 Feb 2024 10:53:03 +0100 Subject: [PATCH 01/21] Migrate SwiftGit2 project to Swift Package Manager - Restructure to a standard Swift package structure. - Rename `Clibgit2` import to `libgit2`. - Update tests to use the latest versions of Nimble and Quick. To do: - Fork libgit2 to the SwiftGit2 organisation, so we can add the Package.swift manifest there. - Compile LibSSH2 and OpenSSL as XCFrameworks, and add them as dependencies. --- .github/workflows/BuildPR.yml | 26 +- .gitignore | 1 + .gitmodules | 21 - .travis.yml | 30 - Cartfile.private | 4 - Cartfile.resolved | 4 - Carthage/Checkouts/Nimble | 1 - Carthage/Checkouts/Quick | 1 - Carthage/Checkouts/ZipArchive | 1 - Carthage/Checkouts/xcconfigs | 1 - External/libcrypto.a | 1 - External/libgit2 | 1 - External/libssh2 | 1 - External/libssl.a | 1 - External/openssl | 1 - Package.resolved | 59 + Package.swift | 30 + .../SwiftGit2}/CheckoutStrategy.swift | 2 +- .../SwiftGit2}/CommitIterator.swift | 2 +- .../SwiftGit2}/Credentials.swift | 2 +- {SwiftGit2 => Sources/SwiftGit2}/Diffs.swift | 2 +- {SwiftGit2 => Sources/SwiftGit2}/Errors.swift | 2 +- .../SwiftGit2}/Libgit2.swift | 2 +- {SwiftGit2 => Sources/SwiftGit2}/OID.swift | 2 +- .../SwiftGit2}/Objects.swift | 2 +- .../SwiftGit2}/Pointers.swift | 2 +- .../SwiftGit2}/References.swift | 2 +- .../SwiftGit2}/Remotes.swift | 2 +- .../SwiftGit2}/Repository.swift | 2 +- .../SwiftGit2}/StatusOptions.swift | 2 +- Sources/SwiftGit2/SwiftGit2.swift | 53 + SwiftGit2.xcodeproj/project.pbxproj | 1224 ----------------- .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcschemes/SwiftGit2-OSX.xcscheme | 109 -- .../xcschemes/SwiftGit2-iOS.xcscheme | 109 -- .../contents.xcworkspacedata | 16 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - SwiftGit2/Info.plist | 28 - SwiftGit2/SwiftGit2.h | 17 - SwiftGit2/SwiftGit2.m | 15 - SwiftGit2Tests/Info.plist | 24 - .../SwiftGit2Tests}/Fixtures.swift | 12 +- .../SwiftGit2Tests}/Fixtures/Mantle.zip | Bin .../Fixtures/detached-head.zip | Bin .../Fixtures/repository-with-status.zip | Bin .../Fixtures/simple-repository.zip | Bin .../SwiftGit2Tests}/FixturesSpec.swift | 5 +- .../SwiftGit2Tests}/OIDSpec.swift | 2 +- .../SwiftGit2Tests}/ObjectsSpec.swift | 15 +- .../SwiftGit2Tests}/ReferencesSpec.swift | 8 +- .../SwiftGit2Tests}/RemotesSpec.swift | 4 +- .../SwiftGit2Tests}/RepositorySpec.swift | 5 +- .../SwiftGit2Tests}/ResultShims.swift | 0 libgit2/git2 | 1 - libgit2/git2.h | 1 - libgit2/module.modulemap | 31 - script/bootstrap | 130 -- script/cibuild | 86 -- script/clean_externals | 22 - script/ios_build_functions.sh | 94 -- script/update_libgit2 | 142 -- script/update_libgit2_ios | 76 - script/update_libssh2_ios | 55 - script/update_libssl_ios | 75 - script/xcode_functions.sh | 52 - 65 files changed, 187 insertions(+), 2450 deletions(-) delete mode 100644 .gitmodules delete mode 100644 .travis.yml delete mode 100644 Cartfile.private delete mode 100644 Cartfile.resolved delete mode 160000 Carthage/Checkouts/Nimble delete mode 160000 Carthage/Checkouts/Quick delete mode 160000 Carthage/Checkouts/ZipArchive delete mode 160000 Carthage/Checkouts/xcconfigs delete mode 120000 External/libcrypto.a delete mode 160000 External/libgit2 delete mode 160000 External/libssh2 delete mode 120000 External/libssl.a delete mode 160000 External/openssl create mode 100644 Package.resolved create mode 100644 Package.swift rename {SwiftGit2 => Sources/SwiftGit2}/CheckoutStrategy.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/CommitIterator.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/Credentials.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/Diffs.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/Errors.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/Libgit2.swift (96%) rename {SwiftGit2 => Sources/SwiftGit2}/OID.swift (98%) rename {SwiftGit2 => Sources/SwiftGit2}/Objects.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/Pointers.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/References.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/Remotes.swift (97%) rename {SwiftGit2 => Sources/SwiftGit2}/Repository.swift (99%) rename {SwiftGit2 => Sources/SwiftGit2}/StatusOptions.swift (99%) create mode 100644 Sources/SwiftGit2/SwiftGit2.swift delete mode 100644 SwiftGit2.xcodeproj/project.pbxproj delete mode 100644 SwiftGit2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-OSX.xcscheme delete mode 100644 SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-iOS.xcscheme delete mode 100644 SwiftGit2.xcworkspace/contents.xcworkspacedata delete mode 100644 SwiftGit2.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 SwiftGit2/Info.plist delete mode 100644 SwiftGit2/SwiftGit2.h delete mode 100644 SwiftGit2/SwiftGit2.m delete mode 100644 SwiftGit2Tests/Info.plist rename {SwiftGit2Tests/Fixtures => Tests/SwiftGit2Tests}/Fixtures.swift (84%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/Fixtures/Mantle.zip (100%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/Fixtures/detached-head.zip (100%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/Fixtures/repository-with-status.zip (100%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/Fixtures/simple-repository.zip (100%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/FixturesSpec.swift (71%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/OIDSpec.swift (98%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/ObjectsSpec.swift (98%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/ReferencesSpec.swift (98%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/RemotesSpec.swift (97%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/RepositorySpec.swift (99%) rename {SwiftGit2Tests => Tests/SwiftGit2Tests}/ResultShims.swift (100%) delete mode 120000 libgit2/git2 delete mode 120000 libgit2/git2.h delete mode 100644 libgit2/module.modulemap delete mode 100755 script/bootstrap delete mode 100755 script/cibuild delete mode 100755 script/clean_externals delete mode 100755 script/ios_build_functions.sh delete mode 100755 script/update_libgit2 delete mode 100755 script/update_libgit2_ios delete mode 100755 script/update_libssh2_ios delete mode 100755 script/update_libssl_ios delete mode 100755 script/xcode_functions.sh diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index 1c86dd9a..8616467b 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -12,30 +12,16 @@ jobs: strategy: fail-fast: false matrix: - xcode: [ Xcode_14.1.0, Xcode_13.3 ] - os: [ macos-12 ] - architecture: [ x86_64 ] -# include: -# - xcode: Xcode -# os: ARM64 -# architecture: arm64 + xcode: [ Xcode_15.2 ] + os: [ macos-14 ] steps: - name: ls Xcode run: ls -la /Applications/Xcode* - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: recursive - - name: Set XCode Version + - name: Set Xcode Version run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app - - name: schemes list - run: xcodebuild -workspace SwiftGit2.xcworkspace -list - - name: update_libgit2 - run: script/update_libgit2 - - name: bootstrap - run: script/bootstrap -# - name: cibuild -# run: script/cibuild - name: Build project - run: xcodebuild -workspace SwiftGit2.xcworkspace -scheme SwiftGit2-OSX -archivePath ./SwiftGit2 archive ARCHS="${{ matrix.architecture }}" + run: swift build + - name: Test project + run: swift test diff --git a/.gitignore b/.gitignore index 62284732..4876dda1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .vscode/ .build/ +.swiftpm/ # Xcode # diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index cff0fbd7..00000000 --- a/.gitmodules +++ /dev/null @@ -1,21 +0,0 @@ -[submodule "External/libgit2"] - path = External/libgit2 - url = https://github.com/libgit2/libgit2.git -[submodule "Carthage/Checkouts/Nimble"] - path = Carthage/Checkouts/Nimble - url = https://github.com/Quick/Nimble.git -[submodule "Carthage/Checkouts/Quick"] - path = Carthage/Checkouts/Quick - url = https://github.com/Quick/Quick.git -[submodule "Carthage/Checkouts/xcconfigs"] - path = Carthage/Checkouts/xcconfigs - url = https://github.com/jspahrsummers/xcconfigs.git -[submodule "Carthage/Checkouts/ZipArchive"] - path = Carthage/Checkouts/ZipArchive - url = https://github.com/ZipArchive/ZipArchive.git -[submodule "External/libssh2"] - path = External/libssh2 - url = https://github.com/libssh2/libssh2.git -[submodule "External/openssl"] - path = External/openssl - url = https://github.com/openssl/openssl.git diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 09db92bc..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: objective-c - -os: osx -osx_image: xcode11.4 - -sudo: false # Enable container-based builds - -env: - matrix: - - SCHEME="SwiftGit2-OSX" - - SCHEME="SwiftGit2-iOS" - -matrix: - fast_finish: true - -before_install: - - gem update bundler # https://github.com/bundler/bundler/pull/4981 - - gem install xcpretty - - gem install xcpretty-travis-formatter - -install: script/bootstrap - -script: script/cibuild - -branches: - only: # whitelist - - master - -notifications: - email: false diff --git a/Cartfile.private b/Cartfile.private deleted file mode 100644 index a2448dfe..00000000 --- a/Cartfile.private +++ /dev/null @@ -1,4 +0,0 @@ -github "jspahrsummers/xcconfigs" ~> 1.1 -github "Quick/Quick" ~> 2.0 -github "Quick/Nimble" ~> 8.0 -github "ZipArchive/ZipArchive" ~> 2.0 diff --git a/Cartfile.resolved b/Cartfile.resolved deleted file mode 100644 index ad8d6d9c..00000000 --- a/Cartfile.resolved +++ /dev/null @@ -1,4 +0,0 @@ -github "Quick/Nimble" "v8.1.2" -github "Quick/Quick" "v2.2.1" -github "ZipArchive/ZipArchive" "v2.2.3" -github "jspahrsummers/xcconfigs" "1.1" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble deleted file mode 160000 index 7a46a5fc..00000000 --- a/Carthage/Checkouts/Nimble +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7a46a5fc86cb917f69e3daf79fcb045283d8f008 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick deleted file mode 160000 index 09b3becb..00000000 --- a/Carthage/Checkouts/Quick +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 09b3becb37cb2163919a3842a4c5fa6ec7130792 diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive deleted file mode 160000 index f3379e6e..00000000 --- a/Carthage/Checkouts/ZipArchive +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f3379e6efa93e657293573ad196302b94041e464 diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs deleted file mode 160000 index 4ced0ad5..00000000 --- a/Carthage/Checkouts/xcconfigs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4ced0ad5a971220917994a4edfa6abf9702e3818 diff --git a/External/libcrypto.a b/External/libcrypto.a deleted file mode 120000 index fe603c87..00000000 --- a/External/libcrypto.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libcrypto.a \ No newline at end of file diff --git a/External/libgit2 b/External/libgit2 deleted file mode 160000 index 7f4fa178..00000000 --- a/External/libgit2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7f4fa178629d559c037a1f72f79f79af9c1ef8ce diff --git a/External/libssh2 b/External/libssh2 deleted file mode 160000 index 30e9c134..00000000 --- a/External/libssh2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 30e9c1347e3b8baa2951db612f05e6d87fc8e2f2 diff --git a/External/libssl.a b/External/libssl.a deleted file mode 120000 index e321f326..00000000 --- a/External/libssl.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libssl.a \ No newline at end of file diff --git a/External/openssl b/External/openssl deleted file mode 160000 index e71ebf27..00000000 --- a/External/openssl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e71ebf275da66dfd601c92e0e80a35114c32f6f8 diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 00000000..8cd659d0 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,59 @@ +{ + "pins" : [ + { + "identity" : "cwlcatchexception", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattgallagher/CwlCatchException.git", + "state" : { + "revision" : "3b123999de19bf04905bc1dfdb76f817b0f2cc00", + "version" : "2.1.2" + } + }, + { + "identity" : "cwlpreconditiontesting", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattgallagher/CwlPreconditionTesting.git", + "state" : { + "revision" : "dc9af4781f2afdd1e68e90f80b8603be73ea7abc", + "version" : "2.2.0" + } + }, + { + "identity" : "libgit2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mbernson/libgit2.git", + "state" : { + "branch" : "spm", + "revision" : "dcfcda4317a38553438b1d875ca1a462f56a4c2d" + } + }, + { + "identity" : "nimble", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Quick/Nimble.git", + "state" : { + "revision" : "efe11bbca024b57115260709b5c05e01131470d0", + "version" : "13.2.1" + } + }, + { + "identity" : "quick", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Quick/Quick.git", + "state" : { + "revision" : "a9e6c24033a25e158384d523a556c0b96c44a839", + "version" : "7.4.0" + } + }, + { + "identity" : "ziparchive", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ZipArchive/ZipArchive.git", + "state" : { + "revision" : "79d4dc9729096c6ad83dd3cee2b9f354d1b4ab7b", + "version" : "2.5.5" + } + } + ], + "version" : 2 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..a33802f6 --- /dev/null +++ b/Package.swift @@ -0,0 +1,30 @@ +// swift-tools-version: 5.9 + +import PackageDescription + +let package = Package( + name: "SwiftGit2", + products: [ + .library( + name: "SwiftGit2", + targets: ["SwiftGit2"] + ), + ], + dependencies: [ + .package(url: "https://github.com/mbernson/libgit2.git", branch: "spm"), + .package(url: "https://github.com/Quick/Quick.git", from: "7.0.0"), + .package(url: "https://github.com/Quick/Nimble.git", from: "13.0.0"), + .package(url: "https://github.com/ZipArchive/ZipArchive.git", from: "2.5.5"), + ], + targets: [ + .target( + name: "SwiftGit2", + dependencies: ["libgit2"] + ), + .testTarget( + name: "SwiftGit2Tests", + dependencies: ["SwiftGit2", "libgit2", "Quick", "Nimble", "ZipArchive"], + resources: [.copy("Fixtures")] + ), + ] +) diff --git a/SwiftGit2/CheckoutStrategy.swift b/Sources/SwiftGit2/CheckoutStrategy.swift similarity index 99% rename from SwiftGit2/CheckoutStrategy.swift rename to Sources/SwiftGit2/CheckoutStrategy.swift index 70c41336..b8076779 100644 --- a/SwiftGit2/CheckoutStrategy.swift +++ b/Sources/SwiftGit2/CheckoutStrategy.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 /// The flags defining how a checkout should be performed. /// More detail is available in the libgit2 documentation for `git_checkout_strategy_t`. diff --git a/SwiftGit2/CommitIterator.swift b/Sources/SwiftGit2/CommitIterator.swift similarity index 99% rename from SwiftGit2/CommitIterator.swift rename to Sources/SwiftGit2/CommitIterator.swift index 01ae1902..4f63ecf1 100644 --- a/SwiftGit2/CommitIterator.swift +++ b/Sources/SwiftGit2/CommitIterator.swift @@ -4,7 +4,7 @@ // import Foundation -import Clibgit2 +import libgit2 public class CommitIterator: IteratorProtocol, Sequence { public typealias Iterator = CommitIterator diff --git a/SwiftGit2/Credentials.swift b/Sources/SwiftGit2/Credentials.swift similarity index 99% rename from SwiftGit2/Credentials.swift rename to Sources/SwiftGit2/Credentials.swift index d5d89f14..2ac5884c 100644 --- a/SwiftGit2/Credentials.swift +++ b/Sources/SwiftGit2/Credentials.swift @@ -6,7 +6,7 @@ // Copyright © 2016 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 private class Wrapper { let value: T diff --git a/SwiftGit2/Diffs.swift b/Sources/SwiftGit2/Diffs.swift similarity index 99% rename from SwiftGit2/Diffs.swift rename to Sources/SwiftGit2/Diffs.swift index e4d958b7..0aed06f2 100644 --- a/SwiftGit2/Diffs.swift +++ b/Sources/SwiftGit2/Diffs.swift @@ -6,7 +6,7 @@ // Copyright © 2017 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 public struct StatusEntry { public var status: Diff.Status diff --git a/SwiftGit2/Errors.swift b/Sources/SwiftGit2/Errors.swift similarity index 99% rename from SwiftGit2/Errors.swift rename to Sources/SwiftGit2/Errors.swift index 781ea1a5..0682522f 100644 --- a/SwiftGit2/Errors.swift +++ b/Sources/SwiftGit2/Errors.swift @@ -1,5 +1,5 @@ import Foundation -import Clibgit2 +import libgit2 public let libGit2ErrorDomain = "org.libgit2.libgit2" diff --git a/SwiftGit2/Libgit2.swift b/Sources/SwiftGit2/Libgit2.swift similarity index 96% rename from SwiftGit2/Libgit2.swift rename to Sources/SwiftGit2/Libgit2.swift index 905de9f8..d544b320 100644 --- a/SwiftGit2/Libgit2.swift +++ b/Sources/SwiftGit2/Libgit2.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 extension git_strarray { func filter(_ isIncluded: (String) -> Bool) -> [String] { diff --git a/SwiftGit2/OID.swift b/Sources/SwiftGit2/OID.swift similarity index 98% rename from SwiftGit2/OID.swift rename to Sources/SwiftGit2/OID.swift index beb3f639..e3a3e015 100644 --- a/SwiftGit2/OID.swift +++ b/Sources/SwiftGit2/OID.swift @@ -6,7 +6,7 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 /// An identifier for a Git object. public struct OID { diff --git a/SwiftGit2/Objects.swift b/Sources/SwiftGit2/Objects.swift similarity index 99% rename from SwiftGit2/Objects.swift rename to Sources/SwiftGit2/Objects.swift index b290e2d7..cf2c4cc5 100644 --- a/SwiftGit2/Objects.swift +++ b/Sources/SwiftGit2/Objects.swift @@ -7,7 +7,7 @@ // import Foundation -import Clibgit2 +import libgit2 /// A git object. public protocol ObjectType { diff --git a/SwiftGit2/Pointers.swift b/Sources/SwiftGit2/Pointers.swift similarity index 99% rename from SwiftGit2/Pointers.swift rename to Sources/SwiftGit2/Pointers.swift index d1720bf8..a182771b 100644 --- a/SwiftGit2/Pointers.swift +++ b/Sources/SwiftGit2/Pointers.swift @@ -6,7 +6,7 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 /// A pointer to a git object. public protocol PointerType: Hashable { diff --git a/SwiftGit2/References.swift b/Sources/SwiftGit2/References.swift similarity index 99% rename from SwiftGit2/References.swift rename to Sources/SwiftGit2/References.swift index 709978d3..42ca908d 100644 --- a/SwiftGit2/References.swift +++ b/Sources/SwiftGit2/References.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 /// A reference to a git object. public protocol ReferenceType { diff --git a/SwiftGit2/Remotes.swift b/Sources/SwiftGit2/Remotes.swift similarity index 97% rename from SwiftGit2/Remotes.swift rename to Sources/SwiftGit2/Remotes.swift index 0f5c026a..78ea2612 100644 --- a/SwiftGit2/Remotes.swift +++ b/Sources/SwiftGit2/Remotes.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 /// A remote in a git repository. public struct Remote: Hashable { diff --git a/SwiftGit2/Repository.swift b/Sources/SwiftGit2/Repository.swift similarity index 99% rename from SwiftGit2/Repository.swift rename to Sources/SwiftGit2/Repository.swift index bc388fdd..2d5bf7ef 100644 --- a/SwiftGit2/Repository.swift +++ b/Sources/SwiftGit2/Repository.swift @@ -7,7 +7,7 @@ // import Foundation -import Clibgit2 +import libgit2 public typealias CheckoutProgressBlock = (String?, Int, Int) -> Void diff --git a/SwiftGit2/StatusOptions.swift b/Sources/SwiftGit2/StatusOptions.swift similarity index 99% rename from SwiftGit2/StatusOptions.swift rename to Sources/SwiftGit2/StatusOptions.swift index 0601866b..c4951960 100644 --- a/SwiftGit2/StatusOptions.swift +++ b/Sources/SwiftGit2/StatusOptions.swift @@ -2,7 +2,7 @@ // Copyright © 2020 GitHub, Inc. All rights reserved. // -import Clibgit2 +import libgit2 import Foundation public struct StatusOptions: OptionSet { diff --git a/Sources/SwiftGit2/SwiftGit2.swift b/Sources/SwiftGit2/SwiftGit2.swift new file mode 100644 index 00000000..6f2186b6 --- /dev/null +++ b/Sources/SwiftGit2/SwiftGit2.swift @@ -0,0 +1,53 @@ +// +// SwiftGit2.swift +// +// +// Created by Mathijs Bernson on 01/03/2024. +// + +import Foundation +import libgit2 + +public class SwiftGit2 { + public static func initialize() -> Result { + let status = git_libgit2_init() + if status < 0 { + return .failure(NSError(gitError: status, pointOfFailure: "git_libgit2_init")) + } else { + return .success(Int(status)) + } + } + + public static func shutdown() -> Result { + let status = git_libgit2_shutdown() + if status < 0 { + return .failure(NSError(gitError: status, pointOfFailure: "git_libgit2_shutdown")) + } else { + return .success(Int(status)) + } + } + + public static var libgit2Version: String { + var major: Int32 = 0 + var minor: Int32 = 0 + var patch: Int32 = 0 + git_libgit2_version(&major, &minor, &patch) + + let version: String = [major, minor, patch] + .map(String.init) + .joined(separator: ".") + + return version + } + + private static func errorMessage(_ errorCode: Int32) -> String? { + let last = giterr_last() + if let lastErrorPointer = last { + return String(validatingUTF8: lastErrorPointer.pointee.message) + } else if UInt32(errorCode) == GIT_ERROR_OS.rawValue { + return String(validatingUTF8: strerror(errno)) + } else { + return nil + } + } +} diff --git a/SwiftGit2.xcodeproj/project.pbxproj b/SwiftGit2.xcodeproj/project.pbxproj deleted file mode 100644 index 556ea432..00000000 --- a/SwiftGit2.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1224 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXAggregateTarget section */ - C9CE0DD21E0710BD0053205D /* SwiftLint */ = { - isa = PBXAggregateTarget; - buildConfigurationList = C9CE0DD31E0710BD0053205D /* Build configuration list for PBXAggregateTarget "SwiftLint" */; - buildPhases = ( - C9CE0DD61E0710C20053205D /* Lint Sources */, - ); - dependencies = ( - ); - name = SwiftLint; - productName = SwiftLint; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 232861431F4A3A2E00276D65 /* Diffs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232861421F4A3A2E00276D65 /* Diffs.swift */; }; - 232861451F4A3A2E00276D65 /* Diffs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232861421F4A3A2E00276D65 /* Diffs.swift */; }; - 237731C71F46542B0020A3FE /* repository-with-status.zip in Resources */ = {isa = PBXBuildFile; fileRef = 237731C61F46542B0020A3FE /* repository-with-status.zip */; }; - 2549921B34FFC36AF8C9CD6D /* CommitIterator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25499A996CA7BD416620A397 /* CommitIterator.swift */; }; - 25499D325997CAB9BEFFCA4D /* CommitIterator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25499A996CA7BD416620A397 /* CommitIterator.swift */; }; - 3F5181B1258FE7D10048F1EF /* StatusOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F5181B0258FE7D10048F1EF /* StatusOptions.swift */; }; - 3F5181B2258FE7D10048F1EF /* StatusOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F5181B0258FE7D10048F1EF /* StatusOptions.swift */; }; - 621E66A01C72958800A0F352 /* OID.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70B3E41A1ACB1A002C3F4E /* OID.swift */; }; - 621E66A11C72958800A0F352 /* Remotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6D1A57284700999413 /* Remotes.swift */; }; - 621E66A21C72958800A0F352 /* CheckoutStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE276B281ACCD3CF00D6DAD7 /* CheckoutStrategy.swift */; }; - 621E66A31C72958800A0F352 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB31F6C1A0D78F300F525B9 /* Repository.swift */; }; - 621E66A41C72958800A0F352 /* Objects.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2E3BE51A31261300C67092 /* Objects.swift */; }; - 621E66A51C72958800A0F352 /* References.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F691A56F19900999413 /* References.swift */; }; - 621E66A61C72958800A0F352 /* Libgit2.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE36354B1A632C9700D37EC8 /* Libgit2.swift */; }; - 621E66A71C72958800A0F352 /* Pointers.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE7A753E1A4A2BCC002DA7E3 /* Pointers.swift */; }; - 621E66A81C72958800A0F352 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5914751A94579000AED74C /* Errors.swift */; }; - 621E66A91C72958800A0F352 /* SwiftGit2.m in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA4F1A1974010015B439 /* SwiftGit2.m */; }; - 621E66B01C72958800A0F352 /* SwiftGit2.h in Headers */ = {isa = PBXBuildFile; fileRef = BEB31F281A0D6F7A00F525B9 /* SwiftGit2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 621E66BA1C72958D00A0F352 /* RepositorySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB31F351A0D6F7A00F525B9 /* RepositorySpec.swift */; }; - 621E66BB1C72958D00A0F352 /* ObjectsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2E3BE71A31262800C67092 /* ObjectsSpec.swift */; }; - 621E66BC1C72958D00A0F352 /* RemotesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6F1A57286200999413 /* RemotesSpec.swift */; }; - 621E66BD1C72958D00A0F352 /* FixturesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA581A1996B70015B439 /* FixturesSpec.swift */; }; - 621E66BE1C72958D00A0F352 /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA541A1984550015B439 /* Fixtures.swift */; }; - 621E66BF1C72958D00A0F352 /* ReferencesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */; }; - 621E66C01C72958D00A0F352 /* OIDSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70B3E61A1ACB37002C3F4E /* OIDSpec.swift */; }; - 621E66C21C72958D00A0F352 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */; }; - 621E66C41C72958D00A0F352 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; }; - 621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; }; - 621E66C81C72958D00A0F352 /* detached-head.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0B1C5C1A9978890004726D /* detached-head.zip */; }; - 621E66C91C72958D00A0F352 /* Mantle.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0991F61A578FB1007D4E6A /* Mantle.zip */; }; - 621E66CA1C72958D00A0F352 /* simple-repository.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE14AA561A198C6E0015B439 /* simple-repository.zip */; }; - 621E66E61C729D9600A0F352 /* SwiftGit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 621E66B41C72958800A0F352 /* SwiftGit2.framework */; }; - 621E66FE1C72A5FF00A0F352 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 621E66FD1C72A5FF00A0F352 /* libiconv.tbd */; }; - 621E67001C72A60B00A0F352 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 621E66FF1C72A60B00A0F352 /* libz.tbd */; }; - 622726341C84E52500C53D17 /* Credentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = 622726331C84E52500C53D17 /* Credentials.swift */; }; - 622726351C84E52500C53D17 /* Credentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = 622726331C84E52500C53D17 /* Credentials.swift */; }; - 62E6FD8F1C727E9C00A312B0 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */; }; - 8F9A51F2209596A40037C3A6 /* repository-with-status.zip in Resources */ = {isa = PBXBuildFile; fileRef = 237731C61F46542B0020A3FE /* repository-with-status.zip */; }; - BE0991F71A578FB1007D4E6A /* Mantle.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0991F61A578FB1007D4E6A /* Mantle.zip */; }; - BE0B1C5D1A9978890004726D /* detached-head.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0B1C5C1A9978890004726D /* detached-head.zip */; }; - BE14AA501A1974010015B439 /* SwiftGit2.m in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA4F1A1974010015B439 /* SwiftGit2.m */; }; - BE14AA551A1984550015B439 /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA541A1984550015B439 /* Fixtures.swift */; }; - BE14AA571A198C6E0015B439 /* simple-repository.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE14AA561A198C6E0015B439 /* simple-repository.zip */; }; - BE14AA591A1996B70015B439 /* FixturesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA581A1996B70015B439 /* FixturesSpec.swift */; }; - BE276B291ACCD3CF00D6DAD7 /* CheckoutStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE276B281ACCD3CF00D6DAD7 /* CheckoutStrategy.swift */; }; - BE2E3BE61A31261300C67092 /* Objects.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2E3BE51A31261300C67092 /* Objects.swift */; }; - BE2E3BE81A31262800C67092 /* ObjectsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2E3BE71A31262800C67092 /* ObjectsSpec.swift */; }; - BE36354C1A632C9700D37EC8 /* Libgit2.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE36354B1A632C9700D37EC8 /* Libgit2.swift */; }; - BE70B3E51A1ACB1A002C3F4E /* OID.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70B3E41A1ACB1A002C3F4E /* OID.swift */; }; - BE70B3E71A1ACB37002C3F4E /* OIDSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70B3E61A1ACB37002C3F4E /* OIDSpec.swift */; }; - BE7A753F1A4A2BCC002DA7E3 /* Pointers.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE7A753E1A4A2BCC002DA7E3 /* Pointers.swift */; }; - BEB31F291A0D6F7A00F525B9 /* SwiftGit2.h in Headers */ = {isa = PBXBuildFile; fileRef = BEB31F281A0D6F7A00F525B9 /* SwiftGit2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BEB31F2F1A0D6F7A00F525B9 /* SwiftGit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB31F231A0D6F7A00F525B9 /* SwiftGit2.framework */; }; - BEB31F361A0D6F7A00F525B9 /* RepositorySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB31F351A0D6F7A00F525B9 /* RepositorySpec.swift */; }; - BEB31F6D1A0D78F300F525B9 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB31F6C1A0D78F300F525B9 /* Repository.swift */; }; - BEB31F9E1A0E595100F525B9 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB31F9D1A0E595100F525B9 /* libiconv.dylib */; }; - BEB31FA01A0E595600F525B9 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB31F9F1A0E595600F525B9 /* libz.dylib */; }; - BECB5F6A1A56F19900999413 /* References.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F691A56F19900999413 /* References.swift */; }; - BECB5F6C1A56F1B400999413 /* ReferencesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */; }; - BECB5F6E1A57284700999413 /* Remotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6D1A57284700999413 /* Remotes.swift */; }; - BECB5F701A57286200999413 /* RemotesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6F1A57286200999413 /* RemotesSpec.swift */; }; - C98A2BA22263FDB9007A4E3A /* ResultShims.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98A2B9F2263E017007A4E3A /* ResultShims.swift */; }; - C98A2BA32263FDBA007A4E3A /* ResultShims.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98A2B9F2263E017007A4E3A /* ResultShims.swift */; }; - DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; }; - DA5914761A94579000AED74C /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5914751A94579000AED74C /* Errors.swift */; }; - DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 621E66E41C729D8A00A0F352 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BEB31F1A1A0D6F7A00F525B9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 621E66611C72958800A0F352; - remoteInfo = "SwiftGit2-iOS"; - }; - 621E66FB1C72A25D00A0F352 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BEB31F1A1A0D6F7A00F525B9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 621E66DC1C729CE500A0F352; - remoteInfo = "libgit2-iOS"; - }; - 624349871C7CADCD0087C234 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BEB31F1A1A0D6F7A00F525B9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 621E66ED1C729EBB00A0F352; - remoteInfo = "libssh2-iOS"; - }; - 624349891C7CADD90087C234 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BEB31F1A1A0D6F7A00F525B9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 621E66E71C729EB800A0F352; - remoteInfo = "OpenSSL-iOS"; - }; - BEB31F301A0D6F7A00F525B9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BEB31F1A1A0D6F7A00F525B9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEB31F221A0D6F7A00F525B9; - remoteInfo = "SwiftGit2-OSX"; - }; - BEB31F941A0E56E200F525B9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BEB31F1A1A0D6F7A00F525B9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEB31F8E1A0E563900F525B9; - remoteInfo = libgit2; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 232861421F4A3A2E00276D65 /* Diffs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Diffs.swift; sourceTree = ""; }; - 237731C61F46542B0020A3FE /* repository-with-status.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "repository-with-status.zip"; sourceTree = ""; }; - 25499A996CA7BD416620A397 /* CommitIterator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommitIterator.swift; sourceTree = ""; }; - 3F5181B0258FE7D10048F1EF /* StatusOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusOptions.swift; sourceTree = ""; }; - 621E66B41C72958800A0F352 /* SwiftGit2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftGit2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 621E66CE1C72958D00A0F352 /* SwiftGit2-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SwiftGit2-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 621E66E11C729CE500A0F352 /* libgit2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgit2.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 621E66EC1C729EB800A0F352 /* libssl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libssl.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 621E66F21C729EBB00A0F352 /* libssh2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libssh2.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 621E66FD1C72A5FF00A0F352 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/usr/lib/libiconv.tbd; sourceTree = DEVELOPER_DIR; }; - 621E66FF1C72A60B00A0F352 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; - 622726331C84E52500C53D17 /* Credentials.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Credentials.swift; sourceTree = ""; }; - 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZipArchive.framework; path = ../Carthage/Checkouts/ZipArchive/build/Debug/ZipArchive.framework; sourceTree = ""; }; - BE0991F61A578FB1007D4E6A /* Mantle.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Mantle.zip; sourceTree = ""; }; - BE0B1C5C1A9978890004726D /* detached-head.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "detached-head.zip"; sourceTree = ""; }; - BE14AA4F1A1974010015B439 /* SwiftGit2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SwiftGit2.m; sourceTree = ""; }; - BE14AA541A1984550015B439 /* Fixtures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fixtures.swift; sourceTree = ""; }; - BE14AA561A198C6E0015B439 /* simple-repository.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "simple-repository.zip"; sourceTree = ""; }; - BE14AA581A1996B70015B439 /* FixturesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FixturesSpec.swift; sourceTree = ""; }; - BE276B281ACCD3CF00D6DAD7 /* CheckoutStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckoutStrategy.swift; sourceTree = ""; }; - BE2E3BE51A31261300C67092 /* Objects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Objects.swift; sourceTree = ""; }; - BE2E3BE71A31262800C67092 /* ObjectsSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectsSpec.swift; sourceTree = ""; }; - BE36354B1A632C9700D37EC8 /* Libgit2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Libgit2.swift; sourceTree = ""; }; - BE70B3E41A1ACB1A002C3F4E /* OID.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OID.swift; sourceTree = ""; }; - BE70B3E61A1ACB37002C3F4E /* OIDSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OIDSpec.swift; sourceTree = ""; }; - BE7A753E1A4A2BCC002DA7E3 /* Pointers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pointers.swift; sourceTree = ""; }; - BEB31F231A0D6F7A00F525B9 /* SwiftGit2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftGit2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BEB31F271A0D6F7A00F525B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - BEB31F281A0D6F7A00F525B9 /* SwiftGit2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftGit2.h; sourceTree = ""; }; - BEB31F2E1A0D6F7A00F525B9 /* SwiftGit2-OSXTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SwiftGit2-OSXTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - BEB31F341A0D6F7A00F525B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - BEB31F351A0D6F7A00F525B9 /* RepositorySpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepositorySpec.swift; sourceTree = ""; }; - BEB31F431A0D75EE00F525B9 /* Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = ""; }; - BEB31F451A0D75EE00F525B9 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - BEB31F461A0D75EE00F525B9 /* Profile.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Profile.xcconfig; sourceTree = ""; }; - BEB31F471A0D75EE00F525B9 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - BEB31F481A0D75EE00F525B9 /* Test.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Test.xcconfig; sourceTree = ""; }; - BEB31F4A1A0D75EE00F525B9 /* Application.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Application.xcconfig; sourceTree = ""; }; - BEB31F4B1A0D75EE00F525B9 /* Framework.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Framework.xcconfig; sourceTree = ""; }; - BEB31F4C1A0D75EE00F525B9 /* StaticLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = StaticLibrary.xcconfig; sourceTree = ""; }; - BEB31F4E1A0D75EE00F525B9 /* iOS-Application.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "iOS-Application.xcconfig"; sourceTree = ""; }; - BEB31F4F1A0D75EE00F525B9 /* iOS-Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "iOS-Base.xcconfig"; sourceTree = ""; }; - BEB31F501A0D75EE00F525B9 /* iOS-Framework.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "iOS-Framework.xcconfig"; sourceTree = ""; }; - BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "iOS-StaticLibrary.xcconfig"; sourceTree = ""; }; - BEB31F531A0D75EE00F525B9 /* macOS-Application.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-Application.xcconfig"; sourceTree = ""; }; - BEB31F541A0D75EE00F525B9 /* macOS-Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-Base.xcconfig"; sourceTree = ""; }; - BEB31F551A0D75EE00F525B9 /* macOS-DynamicLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-DynamicLibrary.xcconfig"; sourceTree = ""; }; - BEB31F561A0D75EE00F525B9 /* macOS-Framework.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-Framework.xcconfig"; sourceTree = ""; }; - BEB31F571A0D75EE00F525B9 /* macOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-StaticLibrary.xcconfig"; sourceTree = ""; }; - BEB31F581A0D75EE00F525B9 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - BEB31F6C1A0D78F300F525B9 /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = ""; }; - BEB31F8F1A0E563900F525B9 /* libgit2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgit2.a; sourceTree = BUILT_PRODUCTS_DIR; }; - BEB31F9D1A0E595100F525B9 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; - BEB31F9F1A0E595600F525B9 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; - BECB5F691A56F19900999413 /* References.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = References.swift; sourceTree = ""; }; - BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReferencesSpec.swift; sourceTree = ""; }; - BECB5F6D1A57284700999413 /* Remotes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Remotes.swift; sourceTree = ""; }; - BECB5F6F1A57286200999413 /* RemotesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotesSpec.swift; sourceTree = ""; }; - C98A2B9F2263E017007A4E3A /* ResultShims.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResultShims.swift; sourceTree = ""; }; - DA50239F1A969F1A004175D7 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DA5914751A94579000AED74C /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; - DAC8143C1A99749D0063D88C /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = "../../../../Library/Developer/Xcode/DerivedData/SwiftGit2-ezqqkevntxbroughwcioyxqriijk/Build/Products/Debug/Quick.framework"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 621E66AA1C72958800A0F352 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 621E67001C72A60B00A0F352 /* libz.tbd in Frameworks */, - 621E66FE1C72A5FF00A0F352 /* libiconv.tbd in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 621E66C11C72958D00A0F352 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 621E66E61C729D9600A0F352 /* SwiftGit2.framework in Frameworks */, - 621E66C21C72958D00A0F352 /* ZipArchive.framework in Frameworks */, - 621E66C41C72958D00A0F352 /* Nimble.framework in Frameworks */, - 621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEB31F1F1A0D6F7A00F525B9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BEB31FA01A0E595600F525B9 /* libz.dylib in Frameworks */, - BEB31F9E1A0E595100F525B9 /* libiconv.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEB31F2B1A0D6F7A00F525B9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 62E6FD8F1C727E9C00A312B0 /* ZipArchive.framework in Frameworks */, - DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */, - DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */, - BEB31F2F1A0D6F7A00F525B9 /* SwiftGit2.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 621E66D41C72965C00A0F352 /* Mac */ = { - isa = PBXGroup; - children = ( - BEB31F9D1A0E595100F525B9 /* libiconv.dylib */, - BEB31F9F1A0E595600F525B9 /* libz.dylib */, - ); - name = Mac; - sourceTree = ""; - }; - 621E66D51C72966000A0F352 /* iOS */ = { - isa = PBXGroup; - children = ( - 621E66FD1C72A5FF00A0F352 /* libiconv.tbd */, - 621E66FF1C72A60B00A0F352 /* libz.tbd */, - ); - name = iOS; - sourceTree = ""; - }; - BE14AA531A1983520015B439 /* Fixtures */ = { - isa = PBXGroup; - children = ( - 237731C61F46542B0020A3FE /* repository-with-status.zip */, - BE0B1C5C1A9978890004726D /* detached-head.zip */, - BE14AA541A1984550015B439 /* Fixtures.swift */, - BE0991F61A578FB1007D4E6A /* Mantle.zip */, - BE14AA561A198C6E0015B439 /* simple-repository.zip */, - ); - path = Fixtures; - sourceTree = ""; - }; - BEB31F191A0D6F7A00F525B9 = { - isa = PBXGroup; - children = ( - BEB31F251A0D6F7A00F525B9 /* SwiftGit2 */, - BEB31F261A0D6F7A00F525B9 /* Supporting Files */, - BEB31F321A0D6F7A00F525B9 /* SwiftGit2Tests */, - BEB31FA11A0E63C100F525B9 /* Libraries */, - BEB31F411A0D75EE00F525B9 /* Configuration */, - BEB31F241A0D6F7A00F525B9 /* Products */, - ); - sourceTree = ""; - usesTabs = 1; - }; - BEB31F241A0D6F7A00F525B9 /* Products */ = { - isa = PBXGroup; - children = ( - BEB31F231A0D6F7A00F525B9 /* SwiftGit2.framework */, - BEB31F2E1A0D6F7A00F525B9 /* SwiftGit2-OSXTests.xctest */, - BEB31F8F1A0E563900F525B9 /* libgit2.a */, - 621E66B41C72958800A0F352 /* SwiftGit2.framework */, - 621E66CE1C72958D00A0F352 /* SwiftGit2-iOSTests.xctest */, - 621E66E11C729CE500A0F352 /* libgit2.a */, - 621E66EC1C729EB800A0F352 /* libssl.a */, - 621E66F21C729EBB00A0F352 /* libssh2.a */, - ); - name = Products; - sourceTree = ""; - }; - BEB31F251A0D6F7A00F525B9 /* SwiftGit2 */ = { - isa = PBXGroup; - children = ( - BEB31F281A0D6F7A00F525B9 /* SwiftGit2.h */, - BE14AA4F1A1974010015B439 /* SwiftGit2.m */, - BE276B281ACCD3CF00D6DAD7 /* CheckoutStrategy.swift */, - 622726331C84E52500C53D17 /* Credentials.swift */, - DA5914751A94579000AED74C /* Errors.swift */, - BE36354B1A632C9700D37EC8 /* Libgit2.swift */, - BE2E3BE51A31261300C67092 /* Objects.swift */, - 232861421F4A3A2E00276D65 /* Diffs.swift */, - BE70B3E41A1ACB1A002C3F4E /* OID.swift */, - BE7A753E1A4A2BCC002DA7E3 /* Pointers.swift */, - BEB31F6C1A0D78F300F525B9 /* Repository.swift */, - BECB5F691A56F19900999413 /* References.swift */, - BECB5F6D1A57284700999413 /* Remotes.swift */, - 25499A996CA7BD416620A397 /* CommitIterator.swift */, - 3F5181B0258FE7D10048F1EF /* StatusOptions.swift */, - ); - path = SwiftGit2; - sourceTree = ""; - }; - BEB31F261A0D6F7A00F525B9 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - BEB31F271A0D6F7A00F525B9 /* Info.plist */, - ); - name = "Supporting Files"; - path = SwiftGit2; - sourceTree = ""; - }; - BEB31F321A0D6F7A00F525B9 /* SwiftGit2Tests */ = { - isa = PBXGroup; - children = ( - BE14AA531A1983520015B439 /* Fixtures */, - BE70B3E61A1ACB37002C3F4E /* OIDSpec.swift */, - BE2E3BE71A31262800C67092 /* ObjectsSpec.swift */, - BEB31F351A0D6F7A00F525B9 /* RepositorySpec.swift */, - BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */, - BECB5F6F1A57286200999413 /* RemotesSpec.swift */, - BE14AA581A1996B70015B439 /* FixturesSpec.swift */, - C98A2B9F2263E017007A4E3A /* ResultShims.swift */, - BEB31F331A0D6F7A00F525B9 /* Supporting Files */, - ); - path = SwiftGit2Tests; - sourceTree = ""; - }; - BEB31F331A0D6F7A00F525B9 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */, - DA50239F1A969F1A004175D7 /* Nimble.framework */, - DAC8143C1A99749D0063D88C /* Quick.framework */, - BEB31F341A0D6F7A00F525B9 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - BEB31F411A0D75EE00F525B9 /* Configuration */ = { - isa = PBXGroup; - children = ( - BEB31F421A0D75EE00F525B9 /* Base */, - BEB31F4D1A0D75EE00F525B9 /* iOS */, - BEB31F521A0D75EE00F525B9 /* macOS */, - BEB31F581A0D75EE00F525B9 /* README.md */, - ); - name = Configuration; - path = Carthage/Checkouts/xcconfigs; - sourceTree = ""; - }; - BEB31F421A0D75EE00F525B9 /* Base */ = { - isa = PBXGroup; - children = ( - BEB31F431A0D75EE00F525B9 /* Common.xcconfig */, - BEB31F441A0D75EE00F525B9 /* Configurations */, - BEB31F491A0D75EE00F525B9 /* Targets */, - ); - path = Base; - sourceTree = ""; - }; - BEB31F441A0D75EE00F525B9 /* Configurations */ = { - isa = PBXGroup; - children = ( - BEB31F451A0D75EE00F525B9 /* Debug.xcconfig */, - BEB31F461A0D75EE00F525B9 /* Profile.xcconfig */, - BEB31F471A0D75EE00F525B9 /* Release.xcconfig */, - BEB31F481A0D75EE00F525B9 /* Test.xcconfig */, - ); - path = Configurations; - sourceTree = ""; - }; - BEB31F491A0D75EE00F525B9 /* Targets */ = { - isa = PBXGroup; - children = ( - BEB31F4A1A0D75EE00F525B9 /* Application.xcconfig */, - BEB31F4B1A0D75EE00F525B9 /* Framework.xcconfig */, - BEB31F4C1A0D75EE00F525B9 /* StaticLibrary.xcconfig */, - ); - path = Targets; - sourceTree = ""; - }; - BEB31F4D1A0D75EE00F525B9 /* iOS */ = { - isa = PBXGroup; - children = ( - BEB31F4E1A0D75EE00F525B9 /* iOS-Application.xcconfig */, - BEB31F4F1A0D75EE00F525B9 /* iOS-Base.xcconfig */, - BEB31F501A0D75EE00F525B9 /* iOS-Framework.xcconfig */, - BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */, - ); - path = iOS; - sourceTree = ""; - }; - BEB31F521A0D75EE00F525B9 /* macOS */ = { - isa = PBXGroup; - children = ( - BEB31F531A0D75EE00F525B9 /* macOS-Application.xcconfig */, - BEB31F541A0D75EE00F525B9 /* macOS-Base.xcconfig */, - BEB31F551A0D75EE00F525B9 /* macOS-DynamicLibrary.xcconfig */, - BEB31F561A0D75EE00F525B9 /* macOS-Framework.xcconfig */, - BEB31F571A0D75EE00F525B9 /* macOS-StaticLibrary.xcconfig */, - ); - path = macOS; - sourceTree = ""; - }; - BEB31FA11A0E63C100F525B9 /* Libraries */ = { - isa = PBXGroup; - children = ( - 621E66D51C72966000A0F352 /* iOS */, - 621E66D41C72965C00A0F352 /* Mac */, - ); - name = Libraries; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 621E66AE1C72958800A0F352 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 621E66B01C72958800A0F352 /* SwiftGit2.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEB31F201A0D6F7A00F525B9 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - BEB31F291A0D6F7A00F525B9 /* SwiftGit2.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 621E66611C72958800A0F352 /* SwiftGit2-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 621E66B11C72958800A0F352 /* Build configuration list for PBXNativeTarget "SwiftGit2-iOS" */; - buildPhases = ( - 621E669F1C72958800A0F352 /* Sources */, - 621E66AA1C72958800A0F352 /* Frameworks */, - 621E66AE1C72958800A0F352 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 621E66FC1C72A25D00A0F352 /* PBXTargetDependency */, - ); - name = "SwiftGit2-iOS"; - productName = "SwiftGit2-OSX"; - productReference = 621E66B41C72958800A0F352 /* SwiftGit2.framework */; - productType = "com.apple.product-type.framework"; - }; - 621E66B61C72958D00A0F352 /* SwiftGit2-iOSTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 621E66CB1C72958D00A0F352 /* Build configuration list for PBXNativeTarget "SwiftGit2-iOSTests" */; - buildPhases = ( - 621E66B91C72958D00A0F352 /* Sources */, - 621E66C11C72958D00A0F352 /* Frameworks */, - 621E66C71C72958D00A0F352 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 621E66E51C729D8A00A0F352 /* PBXTargetDependency */, - ); - name = "SwiftGit2-iOSTests"; - productName = "SwiftGit2-OSXTests"; - productReference = 621E66CE1C72958D00A0F352 /* SwiftGit2-iOSTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 621E66DC1C729CE500A0F352 /* libgit2-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 621E66DE1C729CE500A0F352 /* Build configuration list for PBXNativeTarget "libgit2-iOS" */; - buildPhases = ( - 621E66DD1C729CE500A0F352 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 624349881C7CADCD0087C234 /* PBXTargetDependency */, - ); - name = "libgit2-iOS"; - productName = libgit2; - productReference = 621E66E11C729CE500A0F352 /* libgit2.a */; - productType = "com.apple.product-type.library.static"; - }; - 621E66E71C729EB800A0F352 /* OpenSSL-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 621E66E91C729EB800A0F352 /* Build configuration list for PBXNativeTarget "OpenSSL-iOS" */; - buildPhases = ( - 621E66E81C729EB800A0F352 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "OpenSSL-iOS"; - productName = libgit2; - productReference = 621E66EC1C729EB800A0F352 /* libssl.a */; - productType = "com.apple.product-type.library.static"; - }; - 621E66ED1C729EBB00A0F352 /* libssh2-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 621E66EF1C729EBB00A0F352 /* Build configuration list for PBXNativeTarget "libssh2-iOS" */; - buildPhases = ( - 621E66EE1C729EBB00A0F352 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - 6243498A1C7CADD90087C234 /* PBXTargetDependency */, - ); - name = "libssh2-iOS"; - productName = libgit2; - productReference = 621E66F21C729EBB00A0F352 /* libssh2.a */; - productType = "com.apple.product-type.library.static"; - }; - BEB31F221A0D6F7A00F525B9 /* SwiftGit2-OSX */ = { - isa = PBXNativeTarget; - buildConfigurationList = BEB31F391A0D6F7A00F525B9 /* Build configuration list for PBXNativeTarget "SwiftGit2-OSX" */; - buildPhases = ( - BEB31F1E1A0D6F7A00F525B9 /* Sources */, - BEB31F1F1A0D6F7A00F525B9 /* Frameworks */, - BEB31F201A0D6F7A00F525B9 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - BEB31F951A0E56E200F525B9 /* PBXTargetDependency */, - ); - name = "SwiftGit2-OSX"; - productName = "SwiftGit2-OSX"; - productReference = BEB31F231A0D6F7A00F525B9 /* SwiftGit2.framework */; - productType = "com.apple.product-type.framework"; - }; - BEB31F2D1A0D6F7A00F525B9 /* SwiftGit2-OSXTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = BEB31F3C1A0D6F7A00F525B9 /* Build configuration list for PBXNativeTarget "SwiftGit2-OSXTests" */; - buildPhases = ( - BEB31F2A1A0D6F7A00F525B9 /* Sources */, - BEB31F2B1A0D6F7A00F525B9 /* Frameworks */, - BEB31F2C1A0D6F7A00F525B9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - BEB31F311A0D6F7A00F525B9 /* PBXTargetDependency */, - ); - name = "SwiftGit2-OSXTests"; - productName = "SwiftGit2-OSXTests"; - productReference = BEB31F2E1A0D6F7A00F525B9 /* SwiftGit2-OSXTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - BEB31F8E1A0E563900F525B9 /* libgit2-OSX */ = { - isa = PBXNativeTarget; - buildConfigurationList = BEB31F901A0E563900F525B9 /* Build configuration list for PBXNativeTarget "libgit2-OSX" */; - buildPhases = ( - BEB31F931A0E567000F525B9 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "libgit2-OSX"; - productName = libgit2; - productReference = BEB31F8F1A0E563900F525B9 /* libgit2.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - BEB31F1A1A0D6F7A00F525B9 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 1220; - ORGANIZATIONNAME = "GitHub, Inc"; - TargetAttributes = { - 621E66611C72958800A0F352 = { - LastSwiftMigration = 1020; - }; - 621E66B61C72958D00A0F352 = { - LastSwiftMigration = 1020; - }; - BEB31F221A0D6F7A00F525B9 = { - CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 1020; - }; - BEB31F2D1A0D6F7A00F525B9 = { - CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 1020; - }; - BEB31F8E1A0E563900F525B9 = { - CreatedOnToolsVersion = 6.1; - }; - C9CE0DD21E0710BD0053205D = { - CreatedOnToolsVersion = 8.2; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = BEB31F1D1A0D6F7A00F525B9 /* Build configuration list for PBXProject "SwiftGit2" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = BEB31F191A0D6F7A00F525B9; - productRefGroup = BEB31F241A0D6F7A00F525B9 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - BEB31F221A0D6F7A00F525B9 /* SwiftGit2-OSX */, - BEB31F2D1A0D6F7A00F525B9 /* SwiftGit2-OSXTests */, - 621E66611C72958800A0F352 /* SwiftGit2-iOS */, - 621E66B61C72958D00A0F352 /* SwiftGit2-iOSTests */, - BEB31F8E1A0E563900F525B9 /* libgit2-OSX */, - 621E66DC1C729CE500A0F352 /* libgit2-iOS */, - 621E66E71C729EB800A0F352 /* OpenSSL-iOS */, - 621E66ED1C729EBB00A0F352 /* libssh2-iOS */, - C9CE0DD21E0710BD0053205D /* SwiftLint */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 621E66C71C72958D00A0F352 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 621E66C81C72958D00A0F352 /* detached-head.zip in Resources */, - 8F9A51F2209596A40037C3A6 /* repository-with-status.zip in Resources */, - 621E66C91C72958D00A0F352 /* Mantle.zip in Resources */, - 621E66CA1C72958D00A0F352 /* simple-repository.zip in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEB31F2C1A0D6F7A00F525B9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BE0B1C5D1A9978890004726D /* detached-head.zip in Resources */, - 237731C71F46542B0020A3FE /* repository-with-status.zip in Resources */, - BE0991F71A578FB1007D4E6A /* Mantle.zip in Resources */, - BE14AA571A198C6E0015B439 /* simple-repository.zip in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 621E66DD1C729CE500A0F352 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "script/update_libgit2_ios\n"; - }; - 621E66E81C729EB800A0F352 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "script/update_libssl_ios\n"; - }; - 621E66EE1C729EBB00A0F352 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = script/update_libssh2_ios; - }; - BEB31F931A0E567000F525B9 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "script/update_libgit2\n"; - }; - C9CE0DD61E0710C20053205D /* Lint Sources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Lint Sources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint --lenient\nelse\n echo \"warning: SwiftLint is not installed\"\nfi"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 621E669F1C72958800A0F352 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 621E66A01C72958800A0F352 /* OID.swift in Sources */, - 621E66A11C72958800A0F352 /* Remotes.swift in Sources */, - 621E66A21C72958800A0F352 /* CheckoutStrategy.swift in Sources */, - 622726351C84E52500C53D17 /* Credentials.swift in Sources */, - 621E66A31C72958800A0F352 /* Repository.swift in Sources */, - 621E66A41C72958800A0F352 /* Objects.swift in Sources */, - 232861451F4A3A2E00276D65 /* Diffs.swift in Sources */, - 621E66A51C72958800A0F352 /* References.swift in Sources */, - 621E66A61C72958800A0F352 /* Libgit2.swift in Sources */, - 621E66A71C72958800A0F352 /* Pointers.swift in Sources */, - 621E66A81C72958800A0F352 /* Errors.swift in Sources */, - 621E66A91C72958800A0F352 /* SwiftGit2.m in Sources */, - 3F5181B2258FE7D10048F1EF /* StatusOptions.swift in Sources */, - 2549921B34FFC36AF8C9CD6D /* CommitIterator.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 621E66B91C72958D00A0F352 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 621E66BA1C72958D00A0F352 /* RepositorySpec.swift in Sources */, - 621E66BB1C72958D00A0F352 /* ObjectsSpec.swift in Sources */, - 621E66BC1C72958D00A0F352 /* RemotesSpec.swift in Sources */, - 621E66BD1C72958D00A0F352 /* FixturesSpec.swift in Sources */, - 621E66BE1C72958D00A0F352 /* Fixtures.swift in Sources */, - 621E66BF1C72958D00A0F352 /* ReferencesSpec.swift in Sources */, - 621E66C01C72958D00A0F352 /* OIDSpec.swift in Sources */, - C98A2BA32263FDBA007A4E3A /* ResultShims.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEB31F1E1A0D6F7A00F525B9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BE70B3E51A1ACB1A002C3F4E /* OID.swift in Sources */, - BECB5F6E1A57284700999413 /* Remotes.swift in Sources */, - BE276B291ACCD3CF00D6DAD7 /* CheckoutStrategy.swift in Sources */, - 622726341C84E52500C53D17 /* Credentials.swift in Sources */, - BEB31F6D1A0D78F300F525B9 /* Repository.swift in Sources */, - BE2E3BE61A31261300C67092 /* Objects.swift in Sources */, - 232861431F4A3A2E00276D65 /* Diffs.swift in Sources */, - BECB5F6A1A56F19900999413 /* References.swift in Sources */, - BE36354C1A632C9700D37EC8 /* Libgit2.swift in Sources */, - BE7A753F1A4A2BCC002DA7E3 /* Pointers.swift in Sources */, - DA5914761A94579000AED74C /* Errors.swift in Sources */, - BE14AA501A1974010015B439 /* SwiftGit2.m in Sources */, - 3F5181B1258FE7D10048F1EF /* StatusOptions.swift in Sources */, - 25499D325997CAB9BEFFCA4D /* CommitIterator.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEB31F2A1A0D6F7A00F525B9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEB31F361A0D6F7A00F525B9 /* RepositorySpec.swift in Sources */, - BE2E3BE81A31262800C67092 /* ObjectsSpec.swift in Sources */, - BECB5F701A57286200999413 /* RemotesSpec.swift in Sources */, - BE14AA591A1996B70015B439 /* FixturesSpec.swift in Sources */, - BE14AA551A1984550015B439 /* Fixtures.swift in Sources */, - BECB5F6C1A56F1B400999413 /* ReferencesSpec.swift in Sources */, - BE70B3E71A1ACB37002C3F4E /* OIDSpec.swift in Sources */, - C98A2BA22263FDB9007A4E3A /* ResultShims.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 621E66E51C729D8A00A0F352 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 621E66611C72958800A0F352 /* SwiftGit2-iOS */; - targetProxy = 621E66E41C729D8A00A0F352 /* PBXContainerItemProxy */; - }; - 621E66FC1C72A25D00A0F352 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 621E66DC1C729CE500A0F352 /* libgit2-iOS */; - targetProxy = 621E66FB1C72A25D00A0F352 /* PBXContainerItemProxy */; - }; - 624349881C7CADCD0087C234 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 621E66ED1C729EBB00A0F352 /* libssh2-iOS */; - targetProxy = 624349871C7CADCD0087C234 /* PBXContainerItemProxy */; - }; - 6243498A1C7CADD90087C234 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 621E66E71C729EB800A0F352 /* OpenSSL-iOS */; - targetProxy = 624349891C7CADD90087C234 /* PBXContainerItemProxy */; - }; - BEB31F311A0D6F7A00F525B9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEB31F221A0D6F7A00F525B9 /* SwiftGit2-OSX */; - targetProxy = BEB31F301A0D6F7A00F525B9 /* PBXContainerItemProxy */; - }; - BEB31F951A0E56E200F525B9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEB31F8E1A0E563900F525B9 /* libgit2-OSX */; - targetProxy = BEB31F941A0E56E200F525B9 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 621E66B21C72958800A0F352 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F501A0D75EE00F525B9 /* iOS-Framework.xcconfig */; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/External/libgit2/include", - "$(inherited)", - ); - INFOPLIST_FILE = SwiftGit2/Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/libgit2-ios", - "External/libssh2-ios/lib", - "External/ios-openssl/lib", - "$(inherited)", - ); - OTHER_LDFLAGS = ( - "-force_load", - "External/libgit2-ios/libgit2-ios.a", - "-lgit2-ios", - "-lssl", - "-lcrypto", - "-lssh2-ios", - ); - PRODUCT_BUNDLE_IDENTIFIER = org.libgit2.SwiftGit2; - PRODUCT_NAME = SwiftGit2; - SWIFT_INCLUDE_PATHS = "$(SRCROOT)/libgit2"; - }; - name = Debug; - }; - 621E66B31C72958800A0F352 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F501A0D75EE00F525B9 /* iOS-Framework.xcconfig */; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/External/libgit2/include", - "$(inherited)", - ); - INFOPLIST_FILE = SwiftGit2/Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/libgit2-ios", - "External/libssh2-ios/lib", - "External/ios-openssl/lib", - "$(inherited)", - ); - OTHER_LDFLAGS = ( - "-force_load", - "External/libgit2-ios/libgit2-ios.a", - "-lgit2-ios", - "-lssl", - "-lcrypto", - "-lssh2-ios", - ); - PRODUCT_BUNDLE_IDENTIFIER = org.libgit2.SwiftGit2; - PRODUCT_NAME = SwiftGit2; - SWIFT_INCLUDE_PATHS = "$(SRCROOT)/libgit2"; - }; - name = Release; - }; - 621E66CC1C72958D00A0F352 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F4E1A0D75EE00F525B9 /* iOS-Application.xcconfig */; - buildSettings = { - INFOPLIST_FILE = SwiftGit2Tests/Info.plist; - PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 621E66CD1C72958D00A0F352 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F4E1A0D75EE00F525B9 /* iOS-Application.xcconfig */; - buildSettings = { - INFOPLIST_FILE = SwiftGit2Tests/Info.plist; - PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 621E66DF1C729CE500A0F352 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */; - buildSettings = { - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = git2; - }; - name = Debug; - }; - 621E66E01C729CE500A0F352 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */; - buildSettings = { - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = git2; - }; - name = Release; - }; - 621E66EA1C729EB800A0F352 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */; - buildSettings = { - PRODUCT_NAME = ssl; - }; - name = Debug; - }; - 621E66EB1C729EB800A0F352 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */; - buildSettings = { - PRODUCT_NAME = ssl; - }; - name = Release; - }; - 621E66F01C729EBB00A0F352 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */; - buildSettings = { - PRODUCT_NAME = ssh2; - }; - name = Debug; - }; - 621E66F11C729EBB00A0F352 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */; - buildSettings = { - PRODUCT_NAME = ssh2; - }; - name = Release; - }; - BEB31F371A0D6F7A00F525B9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F451A0D75EE00F525B9 /* Debug.xcconfig */; - buildSettings = { - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INSTALL_GROUP = ""; - INSTALL_MODE_FLAG = ""; - INSTALL_OWNER = ""; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - BEB31F381A0D6F7A00F525B9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F471A0D75EE00F525B9 /* Release.xcconfig */; - buildSettings = { - ENABLE_NS_ASSERTIONS = NO; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INSTALL_GROUP = ""; - INSTALL_MODE_FLAG = ""; - INSTALL_OWNER = ""; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - BEB31F3A1A0D6F7A00F525B9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F561A0D75EE00F525B9 /* macOS-Framework.xcconfig */; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/External/libgit2/include", - "$(inherited)", - ); - INFOPLIST_FILE = SwiftGit2/Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/libgit2-mac", - External/, - "$(inherited)", - ); - OTHER_LDFLAGS = ( - "-force_load", - "External/libgit2-mac/libgit2-mac.a", - /usr/local/lib/libssh2.a, - "-lgit2-mac", - "-lcrypto", - "-lssl", - "-lcurl", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = SwiftGit2; - SWIFT_INCLUDE_PATHS = "$(SRCROOT)/libgit2"; - VALID_ARCHS = "arm64 arm64e i386 x86_64\n"; - }; - name = Debug; - }; - BEB31F3B1A0D6F7A00F525B9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F561A0D75EE00F525B9 /* macOS-Framework.xcconfig */; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/External/libgit2/include", - "$(inherited)", - ); - INFOPLIST_FILE = SwiftGit2/Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/libgit2-mac", - External/, - "$(inherited)", - ); - OTHER_LDFLAGS = ( - "-force_load", - "External/libgit2-mac/libgit2-mac.a", - /usr/local/lib/libssh2.a, - "-lgit2-mac", - "-lcrypto", - "-lssl", - "-lcurl", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = SwiftGit2; - SWIFT_INCLUDE_PATHS = "$(SRCROOT)/libgit2"; - VALID_ARCHS = "arm64 arm64e i386 x86_64\n"; - }; - name = Release; - }; - BEB31F3D1A0D6F7A00F525B9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F531A0D75EE00F525B9 /* macOS-Application.xcconfig */; - buildSettings = { - INFOPLIST_FILE = SwiftGit2Tests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - BEB31F3E1A0D6F7A00F525B9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F531A0D75EE00F525B9 /* macOS-Application.xcconfig */; - buildSettings = { - INFOPLIST_FILE = SwiftGit2Tests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - BEB31F911A0E563900F525B9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F571A0D75EE00F525B9 /* macOS-StaticLibrary.xcconfig */; - buildSettings = { - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = git2; - }; - name = Debug; - }; - BEB31F921A0E563900F525B9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BEB31F571A0D75EE00F525B9 /* macOS-StaticLibrary.xcconfig */; - buildSettings = { - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - PRODUCT_NAME = git2; - }; - name = Release; - }; - C9CE0DD41E0710BD0053205D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - C9CE0DD51E0710BD0053205D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 621E66B11C72958800A0F352 /* Build configuration list for PBXNativeTarget "SwiftGit2-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 621E66B21C72958800A0F352 /* Debug */, - 621E66B31C72958800A0F352 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 621E66CB1C72958D00A0F352 /* Build configuration list for PBXNativeTarget "SwiftGit2-iOSTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 621E66CC1C72958D00A0F352 /* Debug */, - 621E66CD1C72958D00A0F352 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 621E66DE1C729CE500A0F352 /* Build configuration list for PBXNativeTarget "libgit2-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 621E66DF1C729CE500A0F352 /* Debug */, - 621E66E01C729CE500A0F352 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 621E66E91C729EB800A0F352 /* Build configuration list for PBXNativeTarget "OpenSSL-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 621E66EA1C729EB800A0F352 /* Debug */, - 621E66EB1C729EB800A0F352 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 621E66EF1C729EBB00A0F352 /* Build configuration list for PBXNativeTarget "libssh2-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 621E66F01C729EBB00A0F352 /* Debug */, - 621E66F11C729EBB00A0F352 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BEB31F1D1A0D6F7A00F525B9 /* Build configuration list for PBXProject "SwiftGit2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BEB31F371A0D6F7A00F525B9 /* Debug */, - BEB31F381A0D6F7A00F525B9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BEB31F391A0D6F7A00F525B9 /* Build configuration list for PBXNativeTarget "SwiftGit2-OSX" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BEB31F3A1A0D6F7A00F525B9 /* Debug */, - BEB31F3B1A0D6F7A00F525B9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BEB31F3C1A0D6F7A00F525B9 /* Build configuration list for PBXNativeTarget "SwiftGit2-OSXTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BEB31F3D1A0D6F7A00F525B9 /* Debug */, - BEB31F3E1A0D6F7A00F525B9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BEB31F901A0E563900F525B9 /* Build configuration list for PBXNativeTarget "libgit2-OSX" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BEB31F911A0E563900F525B9 /* Debug */, - BEB31F921A0E563900F525B9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C9CE0DD31E0710BD0053205D /* Build configuration list for PBXAggregateTarget "SwiftLint" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C9CE0DD41E0710BD0053205D /* Debug */, - C9CE0DD51E0710BD0053205D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = BEB31F1A1A0D6F7A00F525B9 /* Project object */; -} diff --git a/SwiftGit2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SwiftGit2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/SwiftGit2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-OSX.xcscheme b/SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-OSX.xcscheme deleted file mode 100644 index 6ee99954..00000000 --- a/SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-OSX.xcscheme +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-iOS.xcscheme b/SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-iOS.xcscheme deleted file mode 100644 index 1a87ab43..00000000 --- a/SwiftGit2.xcodeproj/xcshareddata/xcschemes/SwiftGit2-iOS.xcscheme +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SwiftGit2.xcworkspace/contents.xcworkspacedata b/SwiftGit2.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index ee8622b8..00000000 --- a/SwiftGit2.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - diff --git a/SwiftGit2.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SwiftGit2.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/SwiftGit2.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/SwiftGit2/Info.plist b/SwiftGit2/Info.plist deleted file mode 100644 index 9f8153b4..00000000 --- a/SwiftGit2/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2014 GitHub, Inc. All rights reserved. - NSPrincipalClass - - - diff --git a/SwiftGit2/SwiftGit2.h b/SwiftGit2/SwiftGit2.h deleted file mode 100644 index 59b2b646..00000000 --- a/SwiftGit2/SwiftGit2.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// SwiftGit2.h -// SwiftGit2 -// -// Created by Matt Diephouse on 11/7/14. -// Copyright (c) 2014 GitHub, Inc. All rights reserved. -// - -@import Foundation; - -//! Project version number for SwiftGit2. -FOUNDATION_EXPORT double SwiftGit2VersionNumber; - -//! Project version string for SwiftGit2. -FOUNDATION_EXPORT const unsigned char SwiftGit2VersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import diff --git a/SwiftGit2/SwiftGit2.m b/SwiftGit2/SwiftGit2.m deleted file mode 100644 index 3ac50997..00000000 --- a/SwiftGit2/SwiftGit2.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// SwiftGit2.m -// SwiftGit2 -// -// Created by Matt Diephouse on 11/16/14. -// Copyright (c) 2014 GitHub, Inc. All rights reserved. -// - -#import "SwiftGit2.h" -#import "git2.h" - -__attribute__((constructor)) -static void SwiftGit2Init(void) { - git_libgit2_init(); -} diff --git a/SwiftGit2Tests/Info.plist b/SwiftGit2Tests/Info.plist deleted file mode 100644 index ba72822e..00000000 --- a/SwiftGit2Tests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/SwiftGit2Tests/Fixtures/Fixtures.swift b/Tests/SwiftGit2Tests/Fixtures.swift similarity index 84% rename from SwiftGit2Tests/Fixtures/Fixtures.swift rename to Tests/SwiftGit2Tests/Fixtures.swift index fdb24e4b..71df55dd 100644 --- a/SwiftGit2Tests/Fixtures/Fixtures.swift +++ b/Tests/SwiftGit2Tests/Fixtures.swift @@ -33,14 +33,8 @@ final class Fixtures { func setUp() { try! FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil) - #if os(OSX) - let platform = "OSX" - #else - let platform = "iOS" - #endif - let bundleIdentifier = String(format: "org.libgit2.SwiftGit2-%@Tests", arguments: [platform]) - let bundle = Bundle(identifier: bundleIdentifier)! - let zipURLs = bundle.urls(forResourcesWithExtension: "zip", subdirectory: nil)! + let bundle = Bundle.module + let zipURLs = bundle.urls(forResourcesWithExtension: "zip", subdirectory: "Fixtures")! for URL in zipURLs { SSZipArchive.unzipFile(atPath: URL.path, toDestination: directoryURL.path) @@ -55,7 +49,7 @@ final class Fixtures { func repository(named name: String) -> Repository { let url = directoryURL.appendingPathComponent(name, isDirectory: true) - return Repository.at(url).value! + return Repository.at(url).value! } // MARK: - The Fixtures diff --git a/SwiftGit2Tests/Fixtures/Mantle.zip b/Tests/SwiftGit2Tests/Fixtures/Mantle.zip similarity index 100% rename from SwiftGit2Tests/Fixtures/Mantle.zip rename to Tests/SwiftGit2Tests/Fixtures/Mantle.zip diff --git a/SwiftGit2Tests/Fixtures/detached-head.zip b/Tests/SwiftGit2Tests/Fixtures/detached-head.zip similarity index 100% rename from SwiftGit2Tests/Fixtures/detached-head.zip rename to Tests/SwiftGit2Tests/Fixtures/detached-head.zip diff --git a/SwiftGit2Tests/Fixtures/repository-with-status.zip b/Tests/SwiftGit2Tests/Fixtures/repository-with-status.zip similarity index 100% rename from SwiftGit2Tests/Fixtures/repository-with-status.zip rename to Tests/SwiftGit2Tests/Fixtures/repository-with-status.zip diff --git a/SwiftGit2Tests/Fixtures/simple-repository.zip b/Tests/SwiftGit2Tests/Fixtures/simple-repository.zip similarity index 100% rename from SwiftGit2Tests/Fixtures/simple-repository.zip rename to Tests/SwiftGit2Tests/Fixtures/simple-repository.zip diff --git a/SwiftGit2Tests/FixturesSpec.swift b/Tests/SwiftGit2Tests/FixturesSpec.swift similarity index 71% rename from SwiftGit2Tests/FixturesSpec.swift rename to Tests/SwiftGit2Tests/FixturesSpec.swift index c21c4c20..d47f63e6 100644 --- a/SwiftGit2Tests/FixturesSpec.swift +++ b/Tests/SwiftGit2Tests/FixturesSpec.swift @@ -7,15 +7,18 @@ // import Quick +import SwiftGit2 class FixturesSpec: QuickSpec { - override func spec() { + override class func spec() { beforeSuite { + _ = SwiftGit2.initialize() Fixtures.sharedInstance.setUp() } afterSuite { Fixtures.sharedInstance.tearDown() + _ = SwiftGit2.shutdown() } } } diff --git a/SwiftGit2Tests/OIDSpec.swift b/Tests/SwiftGit2Tests/OIDSpec.swift similarity index 98% rename from SwiftGit2Tests/OIDSpec.swift rename to Tests/SwiftGit2Tests/OIDSpec.swift index 90b2621a..54c2549f 100644 --- a/SwiftGit2Tests/OIDSpec.swift +++ b/Tests/SwiftGit2Tests/OIDSpec.swift @@ -11,7 +11,7 @@ import Nimble import Quick class OIDSpec: QuickSpec { - override func spec() { + override class func spec() { describe("OID(string:)") { it("should be nil if string is too short") { expect(OID(string: "123456789012345678901234567890123456789")).to(beNil()) diff --git a/SwiftGit2Tests/ObjectsSpec.swift b/Tests/SwiftGit2Tests/ObjectsSpec.swift similarity index 98% rename from SwiftGit2Tests/ObjectsSpec.swift rename to Tests/SwiftGit2Tests/ObjectsSpec.swift index dc1f2ed7..5b6ff7a7 100644 --- a/SwiftGit2Tests/ObjectsSpec.swift +++ b/Tests/SwiftGit2Tests/ObjectsSpec.swift @@ -6,10 +6,11 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // +import Foundation import SwiftGit2 import Nimble import Quick -import Clibgit2 +import libgit2 private extension Repository { func withGitObject(_ oid: OID, transform: (OpaquePointer) -> T) -> T { @@ -26,7 +27,7 @@ private extension Repository { } class SignatureSpec: FixturesSpec { - override func spec() { + override class func spec() { describe("Signature(signature)") { it("should initialize its properties") { let repo = Fixtures.simpleRepository @@ -88,7 +89,7 @@ class SignatureSpec: FixturesSpec { } class CommitSpec: QuickSpec { - override func spec() { + override class func spec() { describe("Commit(pointer)") { it("should initialize its properties") { let repo = Fixtures.simpleRepository @@ -169,7 +170,7 @@ class CommitSpec: QuickSpec { } class TreeEntrySpec: QuickSpec { - override func spec() { + override class func spec() { describe("Tree.Entry(attributes:object:name:)") { it("should set its properties") { let attributes = Int32(GIT_FILEMODE_BLOB.rawValue) @@ -230,7 +231,7 @@ class TreeEntrySpec: QuickSpec { } class TreeSpec: QuickSpec { - override func spec() { + override class func spec() { describe("Tree(pointer)") { it("should initialize its properties") { let repo = Fixtures.simpleRepository @@ -281,7 +282,7 @@ class TreeSpec: QuickSpec { } class BlobSpec: QuickSpec { - override func spec() { + override class func spec() { describe("Blob(pointer)") { it("should initialize its properties") { let repo = Fixtures.simpleRepository @@ -330,7 +331,7 @@ class BlobSpec: QuickSpec { } class TagSpec: QuickSpec { - override func spec() { + override class func spec() { describe("Tag(pointer)") { it("should set its properties") { let repo = Fixtures.simpleRepository diff --git a/SwiftGit2Tests/ReferencesSpec.swift b/Tests/SwiftGit2Tests/ReferencesSpec.swift similarity index 98% rename from SwiftGit2Tests/ReferencesSpec.swift rename to Tests/SwiftGit2Tests/ReferencesSpec.swift index 311343ac..a0529292 100644 --- a/SwiftGit2Tests/ReferencesSpec.swift +++ b/Tests/SwiftGit2Tests/ReferencesSpec.swift @@ -9,7 +9,7 @@ import SwiftGit2 import Nimble import Quick -import Clibgit2 +import libgit2 private extension Repository { func withGitReference(named name: String, transform: (OpaquePointer) -> T) -> T { @@ -25,7 +25,7 @@ private extension Repository { } class ReferenceSpec: FixturesSpec { - override func spec() { + override class func spec() { describe("Reference(pointer)") { it("should initialize its properties") { let repo = Fixtures.simpleRepository @@ -64,7 +64,7 @@ class ReferenceSpec: FixturesSpec { } class BranchSpec: QuickSpec { - override func spec() { + override class func spec() { describe("Branch(pointer)") { it("should initialize its properties") { let repo = Fixtures.mantleRepository @@ -119,7 +119,7 @@ class BranchSpec: QuickSpec { } class TagReferenceSpec: QuickSpec { - override func spec() { + override class func spec() { describe("TagReference(pointer)") { it("should work with an annotated tag") { let repo = Fixtures.simpleRepository diff --git a/SwiftGit2Tests/RemotesSpec.swift b/Tests/SwiftGit2Tests/RemotesSpec.swift similarity index 97% rename from SwiftGit2Tests/RemotesSpec.swift rename to Tests/SwiftGit2Tests/RemotesSpec.swift index 0f2d66b8..d29bd129 100644 --- a/SwiftGit2Tests/RemotesSpec.swift +++ b/Tests/SwiftGit2Tests/RemotesSpec.swift @@ -9,7 +9,7 @@ import SwiftGit2 import Nimble import Quick -import Clibgit2 +import libgit2 private extension Repository { func withGitRemote(named name: String, transform: (OpaquePointer) -> T) -> T { @@ -25,7 +25,7 @@ private extension Repository { } class RemoteSpec: FixturesSpec { - override func spec() { + override class func spec() { describe("Remote(pointer)") { it("should initialize its properties") { let repo = Fixtures.mantleRepository diff --git a/SwiftGit2Tests/RepositorySpec.swift b/Tests/SwiftGit2Tests/RepositorySpec.swift similarity index 99% rename from SwiftGit2Tests/RepositorySpec.swift rename to Tests/SwiftGit2Tests/RepositorySpec.swift index d51c0b0e..401e4ad9 100644 --- a/SwiftGit2Tests/RepositorySpec.swift +++ b/Tests/SwiftGit2Tests/RepositorySpec.swift @@ -6,6 +6,7 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // +import Foundation import SwiftGit2 import Nimble import Quick @@ -13,7 +14,7 @@ import Quick // swiftlint:disable cyclomatic_complexity class RepositorySpec: FixturesSpec { - override func spec() { + override class func spec() { describe("Repository.Type.at(_:)") { it("should work if the repo exists") { let repo = Fixtures.simpleRepository @@ -980,7 +981,7 @@ class RepositorySpec: FixturesSpec { } } - func temporaryURL(forPurpose purpose: String) -> URL { + static func temporaryURL(forPurpose purpose: String) -> URL { let globallyUniqueString = ProcessInfo.processInfo.globallyUniqueString let path = "\(NSTemporaryDirectory())\(globallyUniqueString)_\(purpose)" return URL(fileURLWithPath: path) diff --git a/SwiftGit2Tests/ResultShims.swift b/Tests/SwiftGit2Tests/ResultShims.swift similarity index 100% rename from SwiftGit2Tests/ResultShims.swift rename to Tests/SwiftGit2Tests/ResultShims.swift diff --git a/libgit2/git2 b/libgit2/git2 deleted file mode 120000 index 718f4d64..00000000 --- a/libgit2/git2 +++ /dev/null @@ -1 +0,0 @@ -../External/libgit2/include/git2 \ No newline at end of file diff --git a/libgit2/git2.h b/libgit2/git2.h deleted file mode 120000 index 0c5d6951..00000000 --- a/libgit2/git2.h +++ /dev/null @@ -1 +0,0 @@ -../External/libgit2/include/git2.h \ No newline at end of file diff --git a/libgit2/module.modulemap b/libgit2/module.modulemap deleted file mode 100644 index fe5729dc..00000000 --- a/libgit2/module.modulemap +++ /dev/null @@ -1,31 +0,0 @@ -module Clibgit2 { - umbrella header "git2.h" - - export * - module * { export * } - - // Exclude headers intended only for Microsoft compilers - exclude header "git2/inttypes.h" - exclude header "git2/stdint.h" - - // Explicit modules for headers not included in the umbrella header: - explicit module cred_helpers { - header "git2/cred_helpers.h" - - export * - } - - explicit module trace { - header "git2/trace.h" - - export * - } - - // Explicit module for the "sys" headers: - explicit module sys { - umbrella "git2/sys" - - export * - module * { export * } - } -} diff --git a/script/bootstrap b/script/bootstrap deleted file mode 100755 index 1f3ea6eb..00000000 --- a/script/bootstrap +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash - -export SCRIPT_DIR=$(dirname "$0") - -## -## Configuration Variables -## - -config () -{ - # A whitespace-separated list of executables that must be present and locatable. - # These will each be installed through Homebrew if not found. - : ${REQUIRED_TOOLS="cmake libssh2 libtool autoconf automake pkg-config"} - - export REQUIRED_TOOLS -} - -## -## Bootstrap Process -## - -main () -{ - config - - local submodules=$(git submodule status) - local result=$? - - if [ "$result" -ne "0" ] - then - exit $result - fi - - if [ -n "$submodules" ] - then - echo "*** Updating submodules..." - update_submodules - fi - - if [ -n "$REQUIRED_TOOLS" ] - then - echo "*** Checking dependencies..." - check_deps - fi -} - -check_deps () -{ - # Check if Homebrew is installed - which -s brew - local result=$? - - if [ "$result" -ne "0" ] - then - echo - echo "Homebrew is not installed (http://brew.sh). You will need to manually ensure the following tools are installed:" - echo " $REQUIRED_TOOLS" - echo - echo "Additionally, the following libssh2 files must be symlinked under /usr/local:" - echo " lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h" - exit $result - fi - - # Ensure that we have libgit2's dependencies installed. - installed=`brew list` - - for tool in $REQUIRED_TOOLS - do - # Skip packages that are already installed. - echo "$installed" | grep -q "$tool" && code=$? || code=$? - - if [ "$code" -eq "0" ] - then - continue - elif [ "$code" -ne "1" ] - then - exit $code - fi - - echo "*** Installing $tool with Homebrew..." - brew install "$tool" - done - - brew_prefix=`brew --prefix` - expected_prefix=/usr/local - - if [ "$brew_prefix" != "$expected_prefix" ] - then - echo "*** Adding soft links into $expected_prefix..." - - products=(lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h) - - for product in "${products[@]}" - do - destination="$expected_prefix/$product" - if [ -e "$destination" ] - then - continue - fi - - sudo mkdir -p "$(dirname "$destination")" - sudo ln -s "$brew_prefix/$product" "$destination" - done - fi -} - -bootstrap_submodule () -{ - local bootstrap="script/bootstrap" - - if [ -e "$bootstrap" ] - then - echo "*** Bootstrapping $name..." - "$bootstrap" >/dev/null - else - update_submodules - fi -} - -update_submodules () -{ - git submodule sync --quiet && \ - git submodule update --init && \ - git submodule foreach --quiet bootstrap_submodule -} - -export -f bootstrap_submodule -export -f update_submodules - -main diff --git a/script/cibuild b/script/cibuild deleted file mode 100755 index 278d9896..00000000 --- a/script/cibuild +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -ex -# -# script/cibuild -# SwiftGit2 -# -# Executes the build and runs tests for Mac and iOS. Designed to be invoked by -# Travis as a matrix build so that the two platform builds can run in parallel. -# -# Dependent tools & scripts: -# - script/bootstrap -# - script/update_libssl_ios -# - [xcodebuild](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html) -# - xcpretty (gem) -# - xcpretty-travis-formatter (gem) -# -# Environment Variables: -# - SCHEME: specifies which Xcode scheme to build. Set to one of the following: -# - SwiftGit2-OSX -# - SwiftGit2-iOS -# - TRAVIS: indicates when the build is being run by travis, used to invoke -# the xcpretty-travis-formatter gem for output. - -if [ -z "$SCHEME" ]; then - echo "The SCHEME environment variable is empty. Please set this to one of:" - echo "- SwiftGit2-OSX" - echo "- SwiftGit2-iOS" - exit 1 -fi - - -## -## Configuration Variables -## - -set -o pipefail -SCRIPT_DIR=$(dirname "$0") -XCWORKSPACE="SwiftGit2.xcworkspace" -XCODE_OPTIONS=$(RUN_CLANG_STATIC_ANALYZER=NO ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO) - -if [ -n "$TRAVIS" ]; then - # Use a special formatter when running on TravisCI - XCPRETTY_FORMAT_OPTIONS="-f `xcpretty-travis-formatter`" -else - XCPRETTY_FORMAT_OPTIONS="--color" -fi - -## -## Build Process -## - -echo "*** Bootstrapping..." -"$SCRIPT_DIR/bootstrap" - -if [ "$SCHEME" == "SwiftGit2-OSX" ]; then - echo "*** Building and testing $SCHEME..." - echo - - xcodebuild -workspace "$XCWORKSPACE" \ - -scheme "$SCHEME" \ - ${XCODE_OPTIONS[*]} \ - build test \ - 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS -elif [ "$SCHEME" == "SwiftGit2-iOS" ]; then - echo "*** Prebuilding OpenSSL" - "$SCRIPT_DIR/update_libssl_ios" - - echo "*** Creating a simulator for testing..." - # Create a new simulator device and reference it by id to avoid xcodebuild exit status 70 with the following errors: - # "The requested device could not be found because no available devices matched the request." - # "The requested device could not be found because multiple devices matched the request." - SIMULATOR_NAME="Custom Simulator" - DEVICE_ID=com.apple.CoreSimulator.SimDeviceType.iPhone-X - RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.iOS-11-4 - DESTINATION_ID=$(xcrun simctl create "$SIMULATOR_NAME" $DEVICE_ID $RUNTIME_ID) - - echo "*** Building and testing $SCHEME..." - echo - - xcodebuild -workspace "$XCWORKSPACE" \ - -scheme "$SCHEME" \ - -destination "id=$DESTINATION_ID" \ - -sdk iphonesimulator \ - ${XCODE_OPTIONS[*]} \ - build test \ - 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS -fi diff --git a/script/clean_externals b/script/clean_externals deleted file mode 100755 index cbaef910..00000000 --- a/script/clean_externals +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -ex - -# -# clean_externals -# SwiftGit2 -# -# Removes the outputs from the various static library targets. -# Necessary when switching platforms/architectures as Xcode does not clean -# these for you. -# - -# A list of external static libraries included in the SwiftGit2 framework -libraries=( - External/libgit2.a - External/libgit2-ios/libgit2-ios.a - External/libssh2-ios/lib/libssh2-ios.a - External/ios-openssl/lib/libssl.a - External/ios-openssl/lib/libcrypto.a - External/ios-openssl/include -) - -rm -vrf "${libraries[@]}" diff --git a/script/ios_build_functions.sh b/script/ios_build_functions.sh deleted file mode 100755 index 578c8692..00000000 --- a/script/ios_build_functions.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR=$(dirname "$0") -source "${SCRIPT_DIR}/xcode_functions.sh" - -function setup_build_environment () -{ - # augment path to help it find cmake installed in /usr/local/bin, - # e.g. via brew. Xcode's Run Script phase doesn't seem to honor - # ~/.MacOSX/environment.plist - PATH="/usr/local/bin:/opt/boxen/homebrew/bin:$PATH" - - pushd "$SCRIPT_DIR/.." > /dev/null - ROOT_PATH="$PWD" - popd > /dev/null - - CLANG="/usr/bin/xcrun clang" - CC="${CLANG}" - CPP="${CLANG} -E" - - # We need to clear this so that cmake doesn't have a conniption - MACOSX_DEPLOYMENT_TARGET="" - - XCODE_MAJOR_VERSION=$(xcode_major_version) - - CAN_BUILD_64BIT="0" - - # If IPHONEOS_DEPLOYMENT_TARGET has not been specified - # setup reasonable defaults to allow running of a build script - # directly (ie not from an Xcode proj) - if [ -z "${IPHONEOS_DEPLOYMENT_TARGET}" ] - then - IPHONEOS_DEPLOYMENT_TARGET="6.0" - fi - - # Determine if we can be building 64-bit binaries - if [ "${XCODE_MAJOR_VERSION}" -ge "5" ] && [ $(echo ${IPHONEOS_DEPLOYMENT_TARGET} '>=' 6.0 | bc -l) == "1" ] - then - CAN_BUILD_64BIT="1" - fi - - ARCHS="i386 armv7 armv7s" - if [ "${CAN_BUILD_64BIT}" -eq "1" ] - then - # For some stupid reason cmake needs simulator - # builds to be first - ARCHS="x86_64 ${ARCHS} arm64" - fi -} - -function build_all_archs () -{ - setup_build_environment - - local setup=$1 - local build_arch=$2 - local finish_build=$3 - - # run the prepare function - eval $setup - - echo "Building for ${ARCHS}" - - for ARCH in ${ARCHS} - do - if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ] - then - PLATFORM="iphonesimulator" - else - PLATFORM="iphoneos" - fi - - SDKVERSION=$(ios_sdk_version) - - if [ "${ARCH}" == "arm64" ] - then - HOST="aarch64-apple-darwin" - else - HOST="${ARCH}-apple-darwin" - fi - - SDKNAME="${PLATFORM}${SDKVERSION}" - SDKROOT="$(sdk_path ${SDKNAME})" - - echo "Building ${LIBRARY_NAME} for ${SDKNAME} ${ARCH}" - echo "Please stand by..." - - # run the per arch build command - eval $build_arch - done - - # finish the build (usually lipo) - eval $finish_build -} diff --git a/script/update_libgit2 b/script/update_libgit2 deleted file mode 100755 index 1be440d3..00000000 --- a/script/update_libgit2 +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/sh - -set -e - -# augment path to help it find cmake installed in /usr/local/bin, -# e.g. via brew. Xcode's Run Script phase doesn't seem to honor -# ~/.MacOSX/environment.plist -PATH="/usr/local/bin:$PATH" - -SCRIPT_DIR=$(dirname "$0") -source "${SCRIPT_DIR}/xcode_functions.sh" - -function setup_build_environment () -{ - # augment path to help it find cmake installed in /usr/local/bin, - # e.g. via brew. Xcode's Run Script phase doesn't seem to honor - # ~/.MacOSX/environment.plist - PATH="/usr/local/bin:$PATH" - - pushd "$SCRIPT_DIR/.." > /dev/null - ROOT_PATH="$PWD" - popd > /dev/null - - CLANG="/usr/bin/xcrun clang" - CC="${CLANG}" - CPP="${CLANG} -E" - - # We need to clear this so that cmake doesn't have a conniption - MACOSX_DEPLOYMENT_TARGET="" - - XCODE_MAJOR_VERSION=$(xcode_major_version) - XCODE_MINOR_VERSION=$(xcode_minor_version) - - CAN_BUILD_ARM="0" - - # Determine if we can be building for ARM Macs - if [ "${XCODE_MAJOR_VERSION}" -ge "13" ] - then - CAN_BUILD_ARM="1" - elif [ "${XCODE_MAJOR_VERSION}" -eq "12" ] && [ "${XCODE_MINOR_VERSION}" -ge "2" ] - then - CAN_BUILD_ARM="1" - fi - - ARCHS="x86_64" - if [ "${CAN_BUILD_ARM}" -eq "1" ] - then - ARCHS="${ARCHS} arm64 arm64e" - fi -} - -function build_all_archs () -{ - setup_build_environment - - local setup=$1 - local build_arch=$2 - local finish_build=$3 - - # run the prepare function - eval $setup - - echo "Building for ${ARCHS}" - - for ARCH in ${ARCHS} - do - PLATFORM="macosx" - SDKVERSION=$(macos_sdk_version) - - SDKNAME="${PLATFORM}${SDKVERSION}" - SDKROOT="$(sdk_path ${SDKNAME})" - - echo "Building ${LIBRARY_NAME} for ${SDKNAME} ${ARCH}" - echo "Please stand by..." - - # run the per arch build command - eval $build_arch - done - - # finish the build (usually lipo) - eval $finish_build -} - -function setup () -{ - if [ "${ROOT_PATH}/External/libgit2-mac/libgit2-mac.a" -nt "${ROOT_PATH}/External/libgit2" ] - then - echo "No update needed." - exit 0 - fi - - LIBRARY_NAME="libgit2" - LIB_PATH="${ROOT_PATH}/External/libgit2-mac" - rm -rf "${LIB_PATH}" - - pushd "${ROOT_PATH}/External/libgit2" > /dev/null -} - -function build_libgit2 () -{ - rm -rf "build" - mkdir "build" - - pushd "build" > /dev/null - - # install the each built arch somewhere sane - INSTALL_PREFIX="${LIB_PATH}/${SDKNAME}-${ARCH}.sdk" - - mkdir -p "${INSTALL_PREFIX}" - - LOG="${INSTALL_PREFIX}/build-libgit2.log" - echo "$LOG" - - MACOSX_DEPLOYMENT_TARGET="10.9" cmake \ - -DBUILD_SHARED_LIBS:BOOL=OFF \ - -DCMAKE_PREFIX_PATH:PATH="${ROOT_PATH}/External/libssh2-mac/bin/${SDKNAME}-${ARCH}.sdk" \ - -DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}/" \ - -DBUILD_CLAR:BOOL=OFF \ - -DTHREADSAFE:BOOL=ON \ - -DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \ - .. >> "${LOG}" 2>&1 - cmake --build . --target install >> "${LOG}" 2>&1 - - # push the built library into the list - BUILT_LIB_PATHS+=("${INSTALL_PREFIX}/lib/libgit2.a") - popd > /dev/null -} - -function fat_binary () -{ - echo "Building fat binary..." - - lipo -create "${BUILT_LIB_PATHS[@]}" -output "${ROOT_PATH}/External/libgit2-mac/libgit2-mac.a" - - echo "Building done." - - popd > /dev/null -} - -build_all_archs setup build_libgit2 fat_binary - -echo "libgit2 has been updated." diff --git a/script/update_libgit2_ios b/script/update_libgit2_ios deleted file mode 100755 index 7732f32e..00000000 --- a/script/update_libgit2_ios +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -set -e - -# source the common build functions -SCRIPT_DIR=$(dirname "$0") -source "${SCRIPT_DIR}/ios_build_functions.sh" - -function setup () -{ - if [ "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" -nt "${ROOT_PATH}/External/libgit2" ] - then - echo "No update needed." - exit 0 - fi - - LIBRARY_NAME="libgit2" - LIB_PATH="${ROOT_PATH}/External/libgit2-ios" - rm -rf "${LIB_PATH}" - - pushd "${ROOT_PATH}/External/libgit2" > /dev/null -} - -function build_libgit2 () -{ - rm -rf "build" - mkdir "build" - - pushd "build" > /dev/null - - # LOL Cmake - if [ "${ARCH}" != "i386" ] && [ "${ARCH}" != "x86_64" ] - then - SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}" - fi - - # install the each built arch somewhere sane - INSTALL_PREFIX="${LIB_PATH}/${SDKNAME}-${ARCH}.sdk" - - mkdir -p "${INSTALL_PREFIX}" - - LOG="${INSTALL_PREFIX}/build-libgit2.log" - echo "$LOG" - - cmake \ - -DCMAKE_C_COMPILER_WORKS:BOOL=ON \ - -DBUILD_SHARED_LIBS:BOOL=OFF \ - -DCMAKE_PREFIX_PATH:PATH="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" \ - -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH:BOOL=ON \ - -DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}/" \ - -DBUILD_CLAR:BOOL=OFF \ - -DTHREADSAFE:BOOL=ON \ - -DCURL:BOOL=OFF \ - -DCMAKE_C_FLAGS:STRING="-fembed-bitcode" \ - "${SYS_ROOT}" \ - -DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \ - .. >> "${LOG}" 2>&1 - cmake --build . --target install >> "${LOG}" 2>&1 - - # push the built library into the list - BUILT_LIB_PATHS+=("${INSTALL_PREFIX}/lib/libgit2.a") - popd > /dev/null -} - -function fat_binary () -{ - echo "Building fat binary..." - - lipo -create "${BUILT_LIB_PATHS[@]}" -output "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" - - echo "Building done." - - popd > /dev/null -} - -build_all_archs setup build_libgit2 fat_binary diff --git a/script/update_libssh2_ios b/script/update_libssh2_ios deleted file mode 100755 index 8dd89c51..00000000 --- a/script/update_libssh2_ios +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -set -e - -# source the common build functions -SCRIPT_DIR=$(dirname "$0") -source "${SCRIPT_DIR}/ios_build_functions.sh" - -function setup () -{ - if [ -f "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" ] - then - echo "No update needed." - exit 0 - fi - LIBRARY_NAME="libssh2" -} - -function build_ssh2 () -{ - mkdir -p "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/src" - - rm -rf "${ROOT_PATH}/External/libssh2-ios/src/libssh2" - cp -R "${ROOT_PATH}/External/libssh2" "${ROOT_PATH}/External/libssh2-ios/src/" - pushd "${ROOT_PATH}/External/libssh2-ios/src/libssh2" > /dev/null - - export CFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" - export CPPFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" - - mkdir -p "${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" - LOG="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/build-libssh2.log" - - echo "${LOG}" - - ./buildconf >> "${LOG}" 2>&1 - ./configure --host=${HOST} --prefix="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" --with-openssl --with-libssl-prefix="${ROOT_PATH}/External/ios-openssl" --disable-shared --enable-static >> "${LOG}" 2>&1 - make >> "${LOG}" 2>&1 - make install >> "${LOG}" 2>&1 - popd > /dev/null - - BUILT_LIBS+=("${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/lib/libssh2.a") -} - -function fat_binary () -{ - echo "Building fat binary..." - - lipo -create "${BUILT_LIBS[@]}" -output "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" - mkdir -p "${ROOT_PATH}/External/libssh2-ios/include/libssh2" - cp -R "${ROOT_PATH}/External/libssh2-ios/bin/iphonesimulator${SDKVERSION}-i386.sdk/include/libssh2.h" "${ROOT_PATH}/External/libssh2-ios/include/libssh2/" - - echo "Building done." -} - -build_all_archs setup build_ssh2 fat_binary diff --git a/script/update_libssl_ios b/script/update_libssl_ios deleted file mode 100755 index 54c0a9a1..00000000 --- a/script/update_libssl_ios +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -# source the common build functions -SCRIPT_DIR=$(dirname "$0") -source "${SCRIPT_DIR}/ios_build_functions.sh" - -function setup () -{ - if [ -f "${ROOT_PATH}/External/ios-openssl/lib/libssl.a" ] && [ -f "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a" ] && [ -d "${ROOT_PATH}/External/ios-openssl/include" ] - then - echo "No update needed." - exit 0 - fi - - LIBRARY_NAME="OpenSSL" - - rm -rf "${ROOT_PATH}/External/ios-openssl/include" "External/ios-openssl/lib" -} - -function cleanup () -{ - rm -rf "/tmp/openssl" - rm -rf "/tmp/openssl-*.log" -} - -function build_ssl () -{ - rm -rf "/tmp/openssl" - cp -r "${ROOT_PATH}/External/openssl" "/tmp/" - pushd "/tmp/openssl" > /dev/null - - LOG="/tmp/openssl-${ARCH}.log" - - if [ "${ARCH}" == "arm64" ] || [ "${ARCH}" == "x86_64" ] - then - HOST="BSD-generic64" - CONFIG="no-gost no-asm enable-ec_nistp_64_gcc_128" - else - HOST="BSD-generic32" - CONFIG="no-gost no-asm" - perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c - fi - echo "$LOG" - - ./Configure ${HOST} ${CONFIG} --openssldir="/tmp/openssl-${ARCH}" >> "${LOG}" 2>&1 - perl -i -pe "s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} -fembed-bitcode |g" Makefile >> "${LOG}" 2>&1 - perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDKROOT} \$1|g" Makefile >> "${LOG}" 2>&1 - make >> "${LOG}" 2>&1 - - make install_sw >> "${LOG}" 2>&1 - popd > /dev/null - rm -rf "/tmp/openssl" - - BUILT_CRYPTO_PATHS+=("/tmp/openssl-${ARCH}/lib/libcrypto.a") - BUILT_SSL_PATHS+=("/tmp/openssl-${ARCH}/lib/libssl.a") -} - -function fat_binary () -{ - echo "Building fat binary..." - - mkdir -p "${ROOT_PATH}/External/ios-openssl/include" - cp -r /tmp/openssl-i386/include/openssl "${ROOT_PATH}/External/ios-openssl/include/" - - mkdir -p "${ROOT_PATH}/External/ios-openssl/lib" - - lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a" - lipo -create "${BUILT_SSL_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libssl.a" - - echo "Building done." -} - -cleanup -build_all_archs setup build_ssl fat_binary -cleanup diff --git a/script/xcode_functions.sh b/script/xcode_functions.sh deleted file mode 100755 index eac0162b..00000000 --- a/script/xcode_functions.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Returns the version # of xcodebuild -# eg. (4.6.3, 5.0, 5.0.1) -function xcode_version () -{ - /usr/bin/xcodebuild -version 2> /dev/null | head -n 1 | awk '{ print $2 }' -} - -# Returns the major version of xcodebuild -# eg. (4, 5, 6) -function xcode_major_version () -{ - xcode_version | awk -F '.' '{ print $1 }' -} - -function xcode_minor_version () -{ - xcode_version | awk -F '.' '{ print $2 }' -} - -# Returns the latest iOS SDK version available via xcodebuild. -function ios_sdk_version () -{ - # The grep command produces output like the following, singling out the - # SDKVersion of just the iPhone* SDKs: - # - # iPhoneOS9.0.sdk - iOS 9.0 (iphoneos9.0) - # SDKVersion: 9.0 - # -- - # iPhoneSimulator9.0.sdk - Simulator - iOS 9.0 (iphonesimulator9.0) - # SDKVersion: 9.0 - - /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }' -} - -function macos_sdk_version () -{ - # The grep command produces output like the following, singling out the - # SDKVersion of just the Mac SDKs: - # - # MacOSX11.0.sdk - macOS 11.0 (macosx11.0) - # SDKVersion: 11.0 - # ... - /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^MacOSX' | tail -n 1 | awk '{ print $2 }' -} - -# Returns the path to the specified iOS SDK name -function sdk_path () -{ - /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -i $1 | grep 'Path:' | awk '{ print $2 }' -} From 9c85a907875d976bbf357cda9f444160e829a489 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Sat, 2 Mar 2024 10:08:57 +0100 Subject: [PATCH 02/21] Build and test on macOS and iOS --- .github/workflows/BuildPR.yml | 26 +++++++++++++++----------- Package.swift | 2 ++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index 8616467b..e05c8213 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -8,20 +8,24 @@ on: jobs: build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - xcode: [ Xcode_15.2 ] - os: [ macos-14 ] + runs-on: macos-14 steps: - name: ls Xcode run: ls -la /Applications/Xcode* - name: Checkout uses: actions/checkout@v4 - name: Set Xcode Version - run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app - - name: Build project - run: swift build - - name: Test project - run: swift test + run: sudo xcode-select -s /Applications/Xcode_15.2.app + - name: Build and test on macOS + run: | + xcodebuild -scheme SwiftGit2 -destination "platform=macOS" build test + - name: Create iPhone Simuilator for testing + env: + SIMULATOR_NAME: "Custom Simulator" + DEVICE_ID: "com.apple.CoreSimulator.SimDeviceType.iPhone-15" + RUNTIME_ID: "com.apple.CoreSimulator.SimRuntime.iOS-17-2" + run: | + xcrun simctl create "$SIMULATOR_NAME" "$DEVICE_ID" "$RUNTIME_ID" + - name: Build and test on iOS + run: | + xcodebuild -scheme SwiftGit2 -destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" build test diff --git a/Package.swift b/Package.swift index a33802f6..a4274ca6 100644 --- a/Package.swift +++ b/Package.swift @@ -4,6 +4,8 @@ import PackageDescription let package = Package( name: "SwiftGit2", + // This is necessary because the test dependencies explicitly specify these platform versions. + platforms: [.macOS(.v10_15), .iOS("15.5"), .tvOS(.v13), .visionOS(.v1)], products: [ .library( name: "SwiftGit2", From ac324ac6e5769b680502ff7d58b48e5990b5b73d Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Fri, 16 Aug 2024 11:54:40 +0200 Subject: [PATCH 03/21] Code style fix: change class SwiftGit2 to caseless enum --- Sources/SwiftGit2/SwiftGit2.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftGit2/SwiftGit2.swift b/Sources/SwiftGit2/SwiftGit2.swift index 6f2186b6..5434d82b 100644 --- a/Sources/SwiftGit2/SwiftGit2.swift +++ b/Sources/SwiftGit2/SwiftGit2.swift @@ -8,7 +8,7 @@ import Foundation import libgit2 -public class SwiftGit2 { +public enum SwiftGit2 { public static func initialize() -> Result { let status = git_libgit2_init() if status < 0 { From baa2b436389646a3edc27376b87c333b73af8f1b Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Fri, 18 Oct 2024 11:10:29 +0200 Subject: [PATCH 04/21] Add libgit2 as a git submodule --- .github/workflows/BuildPR.yml | 3 ++ .gitmodules | 3 ++ Package.resolved | 9 ---- Package.swift | 90 ++++++++++++++++++++++++++++++++++- libgit2 | 1 + 5 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 .gitmodules create mode 160000 libgit2 diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index e05c8213..2f573dd1 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -14,6 +14,9 @@ jobs: run: ls -la /Applications/Xcode* - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive - name: Set Xcode Version run: sudo xcode-select -s /Applications/Xcode_15.2.app - name: Build and test on macOS diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..30eb68a2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libgit2"] + path = libgit2 + url = https://github.com/libgit2/libgit2.git diff --git a/Package.resolved b/Package.resolved index 8cd659d0..7034b462 100644 --- a/Package.resolved +++ b/Package.resolved @@ -18,15 +18,6 @@ "version" : "2.2.0" } }, - { - "identity" : "libgit2", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mbernson/libgit2.git", - "state" : { - "branch" : "spm", - "revision" : "dcfcda4317a38553438b1d875ca1a462f56a4c2d" - } - }, { "identity" : "nimble", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index a4274ca6..42240b97 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,6 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/mbernson/libgit2.git", branch: "spm"), .package(url: "https://github.com/Quick/Quick.git", from: "7.0.0"), .package(url: "https://github.com/Quick/Nimble.git", from: "13.0.0"), .package(url: "https://github.com/ZipArchive/ZipArchive.git", from: "2.5.5"), @@ -28,5 +27,94 @@ let package = Package( dependencies: ["SwiftGit2", "libgit2", "Quick", "Nimble", "ZipArchive"], resources: [.copy("Fixtures")] ), + .target( + name: "libgit2", + path: "libgit2", + exclude: [ + "deps/llhttp/CMakeLists.txt", + "deps/llhttp/LICENSE-MIT", + "deps/pcre/CMakeLists.txt", + "deps/pcre/COPYING", + "deps/pcre/LICENCE", + "deps/pcre/cmake", + "deps/pcre/config.h.in", + "deps/xdiff/CMakeLists.txt", + "deps/zlib/CMakeLists.txt", + "deps/zlib/LICENSE", + "src/libgit2/CMakeLists.txt", + "src/libgit2/experimental.h.in", + "src/libgit2/git2.rc", + "src/util/CMakeLists.txt", + "src/util/git2_features.h.in", + "src/util/hash/builtin.c", + "src/util/hash/builtin.h", + "src/util/hash/collisiondetect.c", + "src/util/hash/collisiondetect.h", + "src/util/hash/openssl.c", + "src/util/hash/openssl.h", + "src/util/hash/win32.c", + "src/util/hash/win32.h", + "src/util/win32", + ], + sources: [ + "deps/llhttp", + "deps/pcre", + "deps/xdiff", + "deps/zlib", + "src/libgit2", + "src/util", + ], + publicHeadersPath: "include", + cSettings: [ + .unsafeFlags([ + // Disable -fmodules flag. Clang finds (`struct entry`) in a different file (`search.h`). + "-fno-modules", + // Disable warning: "implicit conversion loses integer precision" + "-Wno-single-bit-bitfield-constant-conversion", + // Disable warning: "a function definition without a prototype is deprecated" + "-Wno-deprecated-non-prototype", + ]), + + .headerSearchPath("deps/llhttp"), + .headerSearchPath("deps/pcre"), + .headerSearchPath("deps/xdiff"), + .headerSearchPath("deps/zlib"), + .headerSearchPath("src/libgit2"), + .headerSearchPath("src/util"), + + .define("LIBGIT2_NO_FEATURES_H"), + .define("GIT_ARCH_64", to: "1"), + .define("GIT_QSORT_BSD", to: "1"), + .define("GIT_IO_POLL", to: "1"), + + // Git regex configuration + .define("GIT_REGEX_BUILTIN", to: "1"), + .define("PCRE_LINK_SIZE", to: "2"), + .define("SUPPORT_PCRE8", to: "1"), + .define("LINK_SIZE", to: "2"), + .define("PARENS_NEST_LIMIT", to: "250"), + .define("MATCH_LIMIT", to: "10000000"), + .define("MATCH_LIMIT_RECURSION", to: "10000000"), + .define("NEWLINE", to: "10"), // LF + .define("NO_RECURSE", to: "1"), + .define("POSIX_MALLOC_THRESHOLD", to: "10"), + .define("BSR_ANYCRLF", to: "0"), + .define("MAX_NAME_SIZE", to: "32"), + .define("MAX_NAME_COUNT", to: "10000"), + + // Git SSH transport configuration + .define("GIT_SSH", to: "1"), + .define("GIT_SSH_EXEC", to: "1"), + + // Git HTTPS transport configuration + .define("GIT_HTTPS", to: "1"), + .define("GIT_HTTPPARSER_BUILTIN", to: "1"), + .define("GIT_SECURE_TRANSPORT", to: "1"), + + // Git cryptography configuration + .define("GIT_SHA1_COMMON_CRYPTO", to: "1"), + .define("GIT_SHA256_COMMON_CRYPTO", to: "1"), + ] + ), ] ) diff --git a/libgit2 b/libgit2 new file mode 160000 index 00000000..36f7e21a --- /dev/null +++ b/libgit2 @@ -0,0 +1 @@ +Subproject commit 36f7e21ad757a3dacc58cf7944329da6bc1d6e96 From f693cdb5d16a2544edd0da0499e69e9df1518a56 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Fri, 18 Oct 2024 11:27:16 +0200 Subject: [PATCH 05/21] Add back CI test matrix --- .github/workflows/BuildPR.yml | 41 ++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index 2f573dd1..9838acca 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -7,28 +7,43 @@ on: pull_request: jobs: - build: - runs-on: macos-14 + build-macos: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + xcode: [ Xcode_16 ] + os: [ macos-14, macos-15 ] steps: - - name: ls Xcode - run: ls -la /Applications/Xcode* - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - name: Set Xcode Version - run: sudo xcode-select -s /Applications/Xcode_15.2.app + run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app - name: Build and test on macOS run: | xcodebuild -scheme SwiftGit2 -destination "platform=macOS" build test - - name: Create iPhone Simuilator for testing - env: - SIMULATOR_NAME: "Custom Simulator" - DEVICE_ID: "com.apple.CoreSimulator.SimDeviceType.iPhone-15" - RUNTIME_ID: "com.apple.CoreSimulator.SimRuntime.iOS-17-2" - run: | - xcrun simctl create "$SIMULATOR_NAME" "$DEVICE_ID" "$RUNTIME_ID" + + build-ios: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + xcode: [ Xcode_16 ] + os: [ macos-15-xlarge ] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + - name: Set Xcode Version + run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app - name: Build and test on iOS run: | - xcodebuild -scheme SwiftGit2 -destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" build test + PLATFORM="iOS Simulator" + # xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) + DEVICE=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"` + xcodebuild -scheme SwiftGit2 -destination "platform=$PLATFORM,name=$DEVICE" build test From b360c0569a0343f1b57f381288930d7ecb66e008 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Fri, 18 Oct 2024 14:24:52 +0200 Subject: [PATCH 06/21] Add Mac Catalyst platform --- Package.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 42240b97..06a96274 100644 --- a/Package.swift +++ b/Package.swift @@ -4,8 +4,13 @@ import PackageDescription let package = Package( name: "SwiftGit2", - // This is necessary because the test dependencies explicitly specify these platform versions. - platforms: [.macOS(.v10_15), .iOS("15.5"), .tvOS(.v13), .visionOS(.v1)], + platforms: [ + .macOS(.v10_15), + .iOS("15.5"), + .tvOS(.v13), + .visionOS(.v1), + .macCatalyst(.v15), + ], products: [ .library( name: "SwiftGit2", From 995ae7dbdc89c9b48ecd8745050252947663da6b Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Fri, 18 Oct 2024 15:07:07 +0200 Subject: [PATCH 07/21] Update readme --- .github/workflows/BuildPR.yml | 2 +- README.md | 45 ++++++++++++++++------------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index 9838acca..02c76f69 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -1,4 +1,4 @@ -name: pull request +name: Tests on: push: diff --git a/README.md b/README.md index ecb7354e..1274bae7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # SwiftGit2 -[![Build Status](https://travis-ci.org/SwiftGit2/SwiftGit2.svg)](https://travis-ci.org/SwiftGit2/SwiftGit2) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](#carthage) + +[![Build Status](https://github.com/SwiftGit2/SwiftGit2/actions/workflows/BuildPR.yml/badge.svg)](https://github.com/SwiftGit2/SwiftGit2/actions) [![GitHub release](https://img.shields.io/github/release/SwiftGit2/SwiftGit2.svg)](https://github.com/SwiftGit2/SwiftGit2/releases) -![Swift 5.3.x](https://img.shields.io/badge/Swift-5.3.x-orange.svg) +![Swift 5.9.x](https://img.shields.io/badge/Swift-5.9.x-orange.svg) Swift bindings to [libgit2](https://github.com/libgit2/libgit2). @@ -41,37 +41,32 @@ This vastly simplifies the design of long-lived applications, which are the most All methods for reading from or writing to a repository are on SwiftGit’s only `class`: `Repository`. This highlights the failability and mutation of these methods, while freeing up all other instances to be immutable `struct`s and `enum`s. -## Required Tools -To build SwiftGit2, you'll need the following tools installed locally: - -* cmake -* libssh2 -* libtool -* autoconf -* automake -* pkg-config +## Adding SwiftGit2 to your Project +You can add SwiftGit2 to your project using the [Swift Package Manager](https://www.swift.org/documentation/package-manager/). +In Xcode, go to your project settings, then to `Package Dependencies`. Add SwiftGit2 using the URL: ``` -brew install cmake libssh2 libtool autoconf automake pkg-config +https://github.com/SwiftGit2/SwiftGit2.git ``` -## Adding SwiftGit2 to your Project -The easiest way to add SwiftGit2 to your project is to use [Carthage](https://github.com/Carthage/Carthage). Simply add `github "SwiftGit2/SwiftGit2"` to your `Cartfile` and run `carthage update`. +If you're developing an SPM-based project, open your `Package.swift` file and add SwiftGit2 as a dependency: -If you’d like, you can do things the ~~hard~~ old-fashioned way: +```swift +.package(url: "https://github.com/SwiftGit2/SwiftGit2.git", from: "1.0.0") +``` + +And don't forget to reference it from your target: -1. Add SwiftGit2 as a submodule of your project’s repository. -2. Run `git submodule update --init --recursive` to fetch all of SwiftGit2’s depedencies. -3. Add `SwiftGit2.xcodeproj` to your project’s Xcode project or workspace. -4. On the “Build Phases” tab of your application target, add `SwiftGit2.framework` to the “Link Binary With Libraries” phase. SwiftGit2 must also be added to a “Copy Frameworks” build phase. -5. **If you added SwiftGit2 to a project (not a workspace)**, you will also need to add the appropriate SwiftGit2 target to the “Target Dependencies” of your application. +```swift +.target(name: "YourProject", dependencies: ["SwiftGit2"]), +``` ## Building SwiftGit2 Manually -If you want to build a copy of SwiftGit2 without Carthage, possibly for development: +If you want to build and test SwiftGit2 locally for development: 1. Clone SwiftGit2 -2. Run `git submodule update --init --recursive` to clone the submodules -3. Build in Xcode +2. Run `git submodule update --init` to clone the libgit2 submodule +3. Run `swift test` or open the `Package.swift` file to develop and test using Xcode ## Contributions We :heart: to receive pull requests! GitHub makes it easy: @@ -83,4 +78,4 @@ We :heart: to receive pull requests! GitHub makes it easy: All contributions should match GitHub’s [Swift Style Guide](https://github.com/github/swift-style-guide). ## License -SwiftGit2 is available under the MIT license. +SwiftGit2 is available under the [MIT license](https://github.com/SwiftGit2/SwiftGit2/blob/master/LICENSE.md). From a6190fca7a0ccc9142ce40fc6412ade030f34291 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Mon, 18 Nov 2024 13:07:03 +0100 Subject: [PATCH 08/21] Set macOS deployment target to 10.13 Co-authored-by: Christian Tietze --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 06a96274..ff5ad3bd 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "SwiftGit2", platforms: [ - .macOS(.v10_15), + .macOS(.v10_13), .iOS("15.5"), .tvOS(.v13), .visionOS(.v1), From 20b46e76ddeac8388df199f5d77935b3055db58b Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Mon, 18 Nov 2024 13:26:07 +0100 Subject: [PATCH 09/21] Fix compilation on macOS 10.13+ and Xcode 15 (#210) https://github.com/SwiftGit2/SwiftGit2/pull/210#discussion_r1846442039 --- .github/workflows/BuildPR.yml | 4 ++-- SwiftGit2.xcodeproj/project.pbxproj | 8 ++++---- script/update_libgit2 | 13 +++++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index 1c86dd9a..78d6fcee 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -12,8 +12,8 @@ jobs: strategy: fail-fast: false matrix: - xcode: [ Xcode_14.1.0, Xcode_13.3 ] - os: [ macos-12 ] + xcode: [ Xcode_14.3, Xcode_15.2.0 ] + os: [ macos-13 ] architecture: [ x86_64 ] # include: # - xcode: Xcode diff --git a/SwiftGit2.xcodeproj/project.pbxproj b/SwiftGit2.xcodeproj/project.pbxproj index 556ea432..16b48fe7 100644 --- a/SwiftGit2.xcodeproj/project.pbxproj +++ b/SwiftGit2.xcodeproj/project.pbxproj @@ -990,7 +990,7 @@ INSTALL_MODE_FLAG = ""; INSTALL_OWNER = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; SWIFT_VERSION = 5.0; }; name = Debug; @@ -1006,7 +1006,7 @@ INSTALL_MODE_FLAG = ""; INSTALL_OWNER = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; SWIFT_VERSION = 5.0; }; name = Release; @@ -1076,7 +1076,7 @@ baseConfigurationReference = BEB31F531A0D75EE00F525B9 /* macOS-Application.xcconfig */; buildSettings = { INFOPLIST_FILE = SwiftGit2Tests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.13; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -1087,7 +1087,7 @@ baseConfigurationReference = BEB31F531A0D75EE00F525B9 /* macOS-Application.xcconfig */; buildSettings = { INFOPLIST_FILE = SwiftGit2Tests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.13; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; diff --git a/script/update_libgit2 b/script/update_libgit2 index 1be440d3..e3336c95 100755 --- a/script/update_libgit2 +++ b/script/update_libgit2 @@ -5,18 +5,19 @@ set -e # augment path to help it find cmake installed in /usr/local/bin, # e.g. via brew. Xcode's Run Script phase doesn't seem to honor # ~/.MacOSX/environment.plist -PATH="/usr/local/bin:$PATH" +if [[ `uname -m` == 'arm64' ]]; then + echo "** Running on a Apple Silicon M1" + PATH="/opt/homebrew/bin:$PATH" +else + echo "** Running on a Apple x86" + PATH="/usr/local/bin:$PATH" +fi SCRIPT_DIR=$(dirname "$0") source "${SCRIPT_DIR}/xcode_functions.sh" function setup_build_environment () { - # augment path to help it find cmake installed in /usr/local/bin, - # e.g. via brew. Xcode's Run Script phase doesn't seem to honor - # ~/.MacOSX/environment.plist - PATH="/usr/local/bin:$PATH" - pushd "$SCRIPT_DIR/.." > /dev/null ROOT_PATH="$PWD" popd > /dev/null From f4ba5cd3283cd1c40d35b506a1e231ba50cc318c Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Tue, 19 Nov 2024 13:13:13 +0100 Subject: [PATCH 10/21] Shell improvement (#215) See https://github.com/koalaman/shellcheck/wiki/SC2086 --- .travis.yml | 30 ------------------------------ README.md | 1 - script/bootstrap | 6 +++--- script/cibuild | 4 ++-- 4 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 09db92bc..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: objective-c - -os: osx -osx_image: xcode11.4 - -sudo: false # Enable container-based builds - -env: - matrix: - - SCHEME="SwiftGit2-OSX" - - SCHEME="SwiftGit2-iOS" - -matrix: - fast_finish: true - -before_install: - - gem update bundler # https://github.com/bundler/bundler/pull/4981 - - gem install xcpretty - - gem install xcpretty-travis-formatter - -install: script/bootstrap - -script: script/cibuild - -branches: - only: # whitelist - - master - -notifications: - email: false diff --git a/README.md b/README.md index ecb7354e..5b3f6f4f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # SwiftGit2 -[![Build Status](https://travis-ci.org/SwiftGit2/SwiftGit2.svg)](https://travis-ci.org/SwiftGit2/SwiftGit2) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](#carthage) [![GitHub release](https://img.shields.io/github/release/SwiftGit2/SwiftGit2.svg)](https://github.com/SwiftGit2/SwiftGit2/releases) ![Swift 5.3.x](https://img.shields.io/badge/Swift-5.3.x-orange.svg) diff --git a/script/bootstrap b/script/bootstrap index 1f3ea6eb..31bf2d5b 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -62,7 +62,7 @@ check_deps () fi # Ensure that we have libgit2's dependencies installed. - installed=`brew list` + installed=$(brew list) for tool in $REQUIRED_TOOLS do @@ -81,7 +81,7 @@ check_deps () brew install "$tool" done - brew_prefix=`brew --prefix` + brew_prefix=$(brew --prefix) expected_prefix=/usr/local if [ "$brew_prefix" != "$expected_prefix" ] @@ -110,7 +110,7 @@ bootstrap_submodule () if [ -e "$bootstrap" ] then - echo "*** Bootstrapping $name..." + echo "*** Bootstrapping ..." "$bootstrap" >/dev/null else update_submodules diff --git a/script/cibuild b/script/cibuild index 278d9896..4b760b8e 100755 --- a/script/cibuild +++ b/script/cibuild @@ -57,7 +57,7 @@ if [ "$SCHEME" == "SwiftGit2-OSX" ]; then xcodebuild -workspace "$XCWORKSPACE" \ -scheme "$SCHEME" \ - ${XCODE_OPTIONS[*]} \ + "${XCODE_OPTIONS[*]}" \ build test \ 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS elif [ "$SCHEME" == "SwiftGit2-iOS" ]; then @@ -80,7 +80,7 @@ elif [ "$SCHEME" == "SwiftGit2-iOS" ]; then -scheme "$SCHEME" \ -destination "id=$DESTINATION_ID" \ -sdk iphonesimulator \ - ${XCODE_OPTIONS[*]} \ + "${XCODE_OPTIONS[*]}" \ build test \ 2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS fi From 89b08709e43afe30e7803d8af2a639b4da225226 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Fri, 6 Dec 2024 08:19:01 +0100 Subject: [PATCH 11/21] Use an arm64 runner for CI (#212) --- .github/workflows/BuildPR.yml | 16 ++++--- External/libcrypto.a | 1 - External/libssl.a | 1 - SwiftGit2.xcodeproj/project.pbxproj | 4 +- script/bootstrap | 68 ++++++++++++++++++++--------- 5 files changed, 60 insertions(+), 30 deletions(-) delete mode 120000 External/libcrypto.a delete mode 120000 External/libssl.a diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index 78d6fcee..ea39f001 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -14,11 +14,11 @@ jobs: matrix: xcode: [ Xcode_14.3, Xcode_15.2.0 ] os: [ macos-13 ] - architecture: [ x86_64 ] -# include: -# - xcode: Xcode -# os: ARM64 -# architecture: arm64 + include: + - xcode: Xcode_15.4 + os: macos-14 + - xcode: Xcode_16 + os: macos-14 steps: - name: ls Xcode run: ls -la /Applications/Xcode* @@ -27,6 +27,10 @@ jobs: with: fetch-depth: 0 submodules: recursive + - name: get architecture + run: | + echo "ARCHITECTURE=$(uname -m)" >> $GITHUB_ENV + echo $(uname -m) - name: Set XCode Version run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app - name: schemes list @@ -38,4 +42,4 @@ jobs: # - name: cibuild # run: script/cibuild - name: Build project - run: xcodebuild -workspace SwiftGit2.xcworkspace -scheme SwiftGit2-OSX -archivePath ./SwiftGit2 archive ARCHS="${{ matrix.architecture }}" + run: xcodebuild -workspace SwiftGit2.xcworkspace -scheme SwiftGit2-OSX -archivePath ./SwiftGit2 archive ARCHS="${{ env.ARCHITECTURE }}" diff --git a/External/libcrypto.a b/External/libcrypto.a deleted file mode 120000 index fe603c87..00000000 --- a/External/libcrypto.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libcrypto.a \ No newline at end of file diff --git a/External/libssl.a b/External/libssl.a deleted file mode 120000 index e321f326..00000000 --- a/External/libssl.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libssl.a \ No newline at end of file diff --git a/SwiftGit2.xcodeproj/project.pbxproj b/SwiftGit2.xcodeproj/project.pbxproj index 16b48fe7..43b0779d 100644 --- a/SwiftGit2.xcodeproj/project.pbxproj +++ b/SwiftGit2.xcodeproj/project.pbxproj @@ -1028,7 +1028,7 @@ OTHER_LDFLAGS = ( "-force_load", "External/libgit2-mac/libgit2-mac.a", - /usr/local/lib/libssh2.a, + External/libssh2.a, "-lgit2-mac", "-lcrypto", "-lssl", @@ -1058,7 +1058,7 @@ OTHER_LDFLAGS = ( "-force_load", "External/libgit2-mac/libgit2-mac.a", - /usr/local/lib/libssh2.a, + External/libssh2.a, "-lgit2-mac", "-lcrypto", "-lssl", diff --git a/script/bootstrap b/script/bootstrap index 31bf2d5b..70ebe047 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -46,6 +46,7 @@ main () check_deps () { + echo "** check_deps **" # Check if Homebrew is installed which -s brew local result=$? @@ -56,9 +57,17 @@ check_deps () echo "Homebrew is not installed (http://brew.sh). You will need to manually ensure the following tools are installed:" echo " $REQUIRED_TOOLS" echo - echo "Additionally, the following libssh2 files must be symlinked under /usr/local:" + echo "Additionally, the following libssh2 files must be symlinked under /usr/local or /opt/homebrew :" echo " lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h" - exit $result + + if [ ! -z "$CI" ] + then + echo + echo "I will try to install brew now on the github runner" + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + fi fi # Ensure that we have libgit2's dependencies installed. @@ -71,6 +80,7 @@ check_deps () if [ "$code" -eq "0" ] then + echo "*** $tool is available 👍" continue elif [ "$code" -ne "1" ] then @@ -82,26 +92,44 @@ check_deps () done brew_prefix=$(brew --prefix) - expected_prefix=/usr/local - - if [ "$brew_prefix" != "$expected_prefix" ] - then - echo "*** Adding soft links into $expected_prefix..." - - products=(lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h) - - for product in "${products[@]}" - do - destination="$expected_prefix/$product" - if [ -e "$destination" ] - then - continue - fi + if [[ $(uname -m) == 'arm64' ]]; then + echo "** Running on a Apple Silicon M1" + expected_prefix=/opt/homebrew + else + echo "** Running on a Apple x86" + expected_prefix=/usr/local + fi - sudo mkdir -p "$(dirname "$destination")" - sudo ln -s "$brew_prefix/$product" "$destination" - done + install_path="./External" + pwd + set -x + cp "$brew_prefix"/lib/libcrypto.a $install_path + cp "$brew_prefix"/lib/libssl.a $install_path + cp "$brew_prefix"/lib/libssh2.a $install_path + set +x + if [ "$brew_prefix" != "$expected_prefix" ] + then + echo "*** Adding soft links into $expected_prefix..." + + products=(lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h) + + for product in "${products[@]}" + do + destination="$expected_prefix/$product" + if [ -e "$destination" ] + then + continue + fi + + sudo mkdir -p "$(dirname "$destination")" + sudo ln -s "$brew_prefix/$product" "$destination" + done fi + + # openssl@1 is expected + #sslSource=$(find $brew_prefix -name libcrypto.a | grep openssl | sort | head -1 | xargs dirname) + #echo "Find libcrypto.a and take first $sslSource and copy to install_path=$install_path" + #cp $sslSource/* "$install_path" 2>/dev/null | echo "Copy and ignore subdirectory. This makes build work on x86 and arm64" } bootstrap_submodule () From 8526e58864904d4a768d7f76dc0c5256c6c397da Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Tue, 31 Dec 2024 12:03:05 +0100 Subject: [PATCH 12/21] Rename libgit2 import back to Clibgit2 --- Package.swift | 6 +++--- Sources/SwiftGit2/CheckoutStrategy.swift | 2 +- Sources/SwiftGit2/CommitIterator.swift | 2 +- Sources/SwiftGit2/Credentials.swift | 2 +- Sources/SwiftGit2/Diffs.swift | 2 +- Sources/SwiftGit2/Errors.swift | 2 +- Sources/SwiftGit2/Libgit2.swift | 2 +- Sources/SwiftGit2/OID.swift | 2 +- Sources/SwiftGit2/Objects.swift | 2 +- Sources/SwiftGit2/Pointers.swift | 2 +- Sources/SwiftGit2/References.swift | 2 +- Sources/SwiftGit2/Remotes.swift | 2 +- Sources/SwiftGit2/Repository.swift | 2 +- Sources/SwiftGit2/StatusOptions.swift | 2 +- Sources/SwiftGit2/SwiftGit2.swift | 2 +- Tests/SwiftGit2Tests/ObjectsSpec.swift | 2 +- Tests/SwiftGit2Tests/ReferencesSpec.swift | 2 +- Tests/SwiftGit2Tests/RemotesSpec.swift | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Package.swift b/Package.swift index ff5ad3bd..8f784e10 100644 --- a/Package.swift +++ b/Package.swift @@ -25,15 +25,15 @@ let package = Package( targets: [ .target( name: "SwiftGit2", - dependencies: ["libgit2"] + dependencies: ["Clibgit2"] ), .testTarget( name: "SwiftGit2Tests", - dependencies: ["SwiftGit2", "libgit2", "Quick", "Nimble", "ZipArchive"], + dependencies: ["SwiftGit2", "Clibgit2", "Quick", "Nimble", "ZipArchive"], resources: [.copy("Fixtures")] ), .target( - name: "libgit2", + name: "Clibgit2", path: "libgit2", exclude: [ "deps/llhttp/CMakeLists.txt", diff --git a/Sources/SwiftGit2/CheckoutStrategy.swift b/Sources/SwiftGit2/CheckoutStrategy.swift index b8076779..70c41336 100644 --- a/Sources/SwiftGit2/CheckoutStrategy.swift +++ b/Sources/SwiftGit2/CheckoutStrategy.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 /// The flags defining how a checkout should be performed. /// More detail is available in the libgit2 documentation for `git_checkout_strategy_t`. diff --git a/Sources/SwiftGit2/CommitIterator.swift b/Sources/SwiftGit2/CommitIterator.swift index 4f63ecf1..01ae1902 100644 --- a/Sources/SwiftGit2/CommitIterator.swift +++ b/Sources/SwiftGit2/CommitIterator.swift @@ -4,7 +4,7 @@ // import Foundation -import libgit2 +import Clibgit2 public class CommitIterator: IteratorProtocol, Sequence { public typealias Iterator = CommitIterator diff --git a/Sources/SwiftGit2/Credentials.swift b/Sources/SwiftGit2/Credentials.swift index 2ac5884c..d5d89f14 100644 --- a/Sources/SwiftGit2/Credentials.swift +++ b/Sources/SwiftGit2/Credentials.swift @@ -6,7 +6,7 @@ // Copyright © 2016 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 private class Wrapper { let value: T diff --git a/Sources/SwiftGit2/Diffs.swift b/Sources/SwiftGit2/Diffs.swift index 0aed06f2..e4d958b7 100644 --- a/Sources/SwiftGit2/Diffs.swift +++ b/Sources/SwiftGit2/Diffs.swift @@ -6,7 +6,7 @@ // Copyright © 2017 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 public struct StatusEntry { public var status: Diff.Status diff --git a/Sources/SwiftGit2/Errors.swift b/Sources/SwiftGit2/Errors.swift index 0682522f..781ea1a5 100644 --- a/Sources/SwiftGit2/Errors.swift +++ b/Sources/SwiftGit2/Errors.swift @@ -1,5 +1,5 @@ import Foundation -import libgit2 +import Clibgit2 public let libGit2ErrorDomain = "org.libgit2.libgit2" diff --git a/Sources/SwiftGit2/Libgit2.swift b/Sources/SwiftGit2/Libgit2.swift index d544b320..905de9f8 100644 --- a/Sources/SwiftGit2/Libgit2.swift +++ b/Sources/SwiftGit2/Libgit2.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 extension git_strarray { func filter(_ isIncluded: (String) -> Bool) -> [String] { diff --git a/Sources/SwiftGit2/OID.swift b/Sources/SwiftGit2/OID.swift index e3a3e015..beb3f639 100644 --- a/Sources/SwiftGit2/OID.swift +++ b/Sources/SwiftGit2/OID.swift @@ -6,7 +6,7 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 /// An identifier for a Git object. public struct OID { diff --git a/Sources/SwiftGit2/Objects.swift b/Sources/SwiftGit2/Objects.swift index cf2c4cc5..b290e2d7 100644 --- a/Sources/SwiftGit2/Objects.swift +++ b/Sources/SwiftGit2/Objects.swift @@ -7,7 +7,7 @@ // import Foundation -import libgit2 +import Clibgit2 /// A git object. public protocol ObjectType { diff --git a/Sources/SwiftGit2/Pointers.swift b/Sources/SwiftGit2/Pointers.swift index a182771b..d1720bf8 100644 --- a/Sources/SwiftGit2/Pointers.swift +++ b/Sources/SwiftGit2/Pointers.swift @@ -6,7 +6,7 @@ // Copyright (c) 2014 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 /// A pointer to a git object. public protocol PointerType: Hashable { diff --git a/Sources/SwiftGit2/References.swift b/Sources/SwiftGit2/References.swift index 42ca908d..709978d3 100644 --- a/Sources/SwiftGit2/References.swift +++ b/Sources/SwiftGit2/References.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 /// A reference to a git object. public protocol ReferenceType { diff --git a/Sources/SwiftGit2/Remotes.swift b/Sources/SwiftGit2/Remotes.swift index 78ea2612..0f5c026a 100644 --- a/Sources/SwiftGit2/Remotes.swift +++ b/Sources/SwiftGit2/Remotes.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 /// A remote in a git repository. public struct Remote: Hashable { diff --git a/Sources/SwiftGit2/Repository.swift b/Sources/SwiftGit2/Repository.swift index 2d5bf7ef..bc388fdd 100644 --- a/Sources/SwiftGit2/Repository.swift +++ b/Sources/SwiftGit2/Repository.swift @@ -7,7 +7,7 @@ // import Foundation -import libgit2 +import Clibgit2 public typealias CheckoutProgressBlock = (String?, Int, Int) -> Void diff --git a/Sources/SwiftGit2/StatusOptions.swift b/Sources/SwiftGit2/StatusOptions.swift index c4951960..0601866b 100644 --- a/Sources/SwiftGit2/StatusOptions.swift +++ b/Sources/SwiftGit2/StatusOptions.swift @@ -2,7 +2,7 @@ // Copyright © 2020 GitHub, Inc. All rights reserved. // -import libgit2 +import Clibgit2 import Foundation public struct StatusOptions: OptionSet { diff --git a/Sources/SwiftGit2/SwiftGit2.swift b/Sources/SwiftGit2/SwiftGit2.swift index 5434d82b..b28db66b 100644 --- a/Sources/SwiftGit2/SwiftGit2.swift +++ b/Sources/SwiftGit2/SwiftGit2.swift @@ -6,7 +6,7 @@ // import Foundation -import libgit2 +import Clibgit2 public enum SwiftGit2 { public static func initialize() -> Result { diff --git a/Tests/SwiftGit2Tests/ObjectsSpec.swift b/Tests/SwiftGit2Tests/ObjectsSpec.swift index 5b6ff7a7..73a61641 100644 --- a/Tests/SwiftGit2Tests/ObjectsSpec.swift +++ b/Tests/SwiftGit2Tests/ObjectsSpec.swift @@ -10,7 +10,7 @@ import Foundation import SwiftGit2 import Nimble import Quick -import libgit2 +import Clibgit2 private extension Repository { func withGitObject(_ oid: OID, transform: (OpaquePointer) -> T) -> T { diff --git a/Tests/SwiftGit2Tests/ReferencesSpec.swift b/Tests/SwiftGit2Tests/ReferencesSpec.swift index a0529292..4b91f130 100644 --- a/Tests/SwiftGit2Tests/ReferencesSpec.swift +++ b/Tests/SwiftGit2Tests/ReferencesSpec.swift @@ -9,7 +9,7 @@ import SwiftGit2 import Nimble import Quick -import libgit2 +import Clibgit2 private extension Repository { func withGitReference(named name: String, transform: (OpaquePointer) -> T) -> T { diff --git a/Tests/SwiftGit2Tests/RemotesSpec.swift b/Tests/SwiftGit2Tests/RemotesSpec.swift index d29bd129..63a8cbcc 100644 --- a/Tests/SwiftGit2Tests/RemotesSpec.swift +++ b/Tests/SwiftGit2Tests/RemotesSpec.swift @@ -9,7 +9,7 @@ import SwiftGit2 import Nimble import Quick -import libgit2 +import Clibgit2 private extension Repository { func withGitRemote(named name: String, transform: (OpaquePointer) -> T) -> T { From 6d29624acc3e354d1e3f90b0d525d63995ff7dc5 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Tue, 31 Dec 2024 12:45:35 +0100 Subject: [PATCH 13/21] Update test repo URL Update the URL for the test that clones a repository. The repo `github.com/libgit2/libgit2.github.com.git` is over 5GB in size when checked out. Using github.com/libgit2/TestGitRepository.git instead, which is way smaller. --- Tests/SwiftGit2Tests/RepositorySpec.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/SwiftGit2Tests/RepositorySpec.swift b/Tests/SwiftGit2Tests/RepositorySpec.swift index 401e4ad9..bf02563f 100644 --- a/Tests/SwiftGit2Tests/RepositorySpec.swift +++ b/Tests/SwiftGit2Tests/RepositorySpec.swift @@ -125,7 +125,7 @@ class RepositorySpec: FixturesSpec { } it("should be able to clone a remote repository") { - let remoteRepoURL = URL(string: "https://github.com/libgit2/libgit2.github.com.git") + let remoteRepoURL = URL(string: "https://github.com/libgit2/TestGitRepository.git") let localURL = self.temporaryURL(forPurpose: "public-remote-clone") let cloneResult = Repository.clone(from: remoteRepoURL!, to: localURL) From be0600a045eec511d9b72845888f3172e61707e1 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Fri, 7 Mar 2025 17:38:55 +0100 Subject: [PATCH 14/21] Convert init and shutdown to freestanding functions An enum named `SwiftGit2` was used as a namespace before. But that makes it impossible to refer to a fully qualified type name such as `SwiftGit2.Tag`. --- Sources/SwiftGit2/SwiftGit2.swift | 59 ++++++++++--------------- Tests/SwiftGit2Tests/FixturesSpec.swift | 4 +- 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/Sources/SwiftGit2/SwiftGit2.swift b/Sources/SwiftGit2/SwiftGit2.swift index b28db66b..74dfe26d 100644 --- a/Sources/SwiftGit2/SwiftGit2.swift +++ b/Sources/SwiftGit2/SwiftGit2.swift @@ -8,46 +8,33 @@ import Foundation import Clibgit2 -public enum SwiftGit2 { - public static func initialize() -> Result { - let status = git_libgit2_init() - if status < 0 { - return .failure(NSError(gitError: status, pointOfFailure: "git_libgit2_init")) - } else { - return .success(Int(status)) - } +public func SwiftGit2Init() -> Result { + let status = git_libgit2_init() + if status < 0 { + return .failure(NSError(gitError: status, pointOfFailure: "git_libgit2_init")) + } else { + return .success(Int(status)) } +} - public static func shutdown() -> Result { - let status = git_libgit2_shutdown() - if status < 0 { - return .failure(NSError(gitError: status, pointOfFailure: "git_libgit2_shutdown")) - } else { - return .success(Int(status)) - } +public func SwiftGit2Shutdown() -> Result { + let status = git_libgit2_shutdown() + if status < 0 { + return .failure(NSError(gitError: status, pointOfFailure: "git_libgit2_shutdown")) + } else { + return .success(Int(status)) } +} - public static var libgit2Version: String { - var major: Int32 = 0 - var minor: Int32 = 0 - var patch: Int32 = 0 - git_libgit2_version(&major, &minor, &patch) +public func Libgit2Version() -> String { + var major: Int32 = 0 + var minor: Int32 = 0 + var patch: Int32 = 0 + git_libgit2_version(&major, &minor, &patch) - let version: String = [major, minor, patch] - .map(String.init) - .joined(separator: ".") + let version: String = [major, minor, patch] + .map(String.init) + .joined(separator: ".") - return version - } - - private static func errorMessage(_ errorCode: Int32) -> String? { - let last = giterr_last() - if let lastErrorPointer = last { - return String(validatingUTF8: lastErrorPointer.pointee.message) - } else if UInt32(errorCode) == GIT_ERROR_OS.rawValue { - return String(validatingUTF8: strerror(errno)) - } else { - return nil - } - } + return version } diff --git a/Tests/SwiftGit2Tests/FixturesSpec.swift b/Tests/SwiftGit2Tests/FixturesSpec.swift index d47f63e6..6f7b063d 100644 --- a/Tests/SwiftGit2Tests/FixturesSpec.swift +++ b/Tests/SwiftGit2Tests/FixturesSpec.swift @@ -12,13 +12,13 @@ import SwiftGit2 class FixturesSpec: QuickSpec { override class func spec() { beforeSuite { - _ = SwiftGit2.initialize() + _ = SwiftGit2Init() Fixtures.sharedInstance.setUp() } afterSuite { Fixtures.sharedInstance.tearDown() - _ = SwiftGit2.shutdown() + _ = SwiftGit2Shutdown() } } } From deb46a18fa72722bb018ac35597724128078d87d Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Fri, 7 Mar 2025 18:02:49 +0100 Subject: [PATCH 15/21] Fix Xcode selection on CI Use the setup-xcode GitHub Action, which is more reliable than calling `xcode-select` manually. --- .github/workflows/BuildPR.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index ba73301d..662b4dc2 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - xcode: [ Xcode_16 ] + xcode: [ '16' ] os: [ macos-14, macos-15 ] steps: - name: Checkout @@ -21,7 +21,9 @@ jobs: fetch-depth: 0 submodules: recursive - name: Set Xcode Version - run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ matrix.xcode }} - name: Build and test on macOS run: | xcodebuild -scheme SwiftGit2 -destination "platform=macOS" build test @@ -31,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - xcode: [ Xcode_16 ] + xcode: [ '16' ] os: [ macos-15 ] steps: - name: Checkout @@ -40,7 +42,9 @@ jobs: fetch-depth: 0 submodules: recursive - name: Set Xcode Version - run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ matrix.xcode }} - name: Build and test on iOS run: | PLATFORM="iOS Simulator" From 0505abce235236a0233906e7d8b940de5da80387 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Tue, 29 Apr 2025 18:39:45 +0200 Subject: [PATCH 16/21] Fix build with XCode 16 (#216) --- .github/workflows/BuildPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index ea39f001..11d41c10 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -17,7 +17,7 @@ jobs: include: - xcode: Xcode_15.4 os: macos-14 - - xcode: Xcode_16 + - xcode: Xcode_16.2 os: macos-14 steps: - name: ls Xcode From 9c2b20a2328ca42cc1f4ecfde761af0c27715b31 Mon Sep 17 00:00:00 2001 From: Christian Tietze Date: Tue, 29 Apr 2025 18:56:38 +0200 Subject: [PATCH 17/21] Update BuildPR.yml --- .github/workflows/BuildPR.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index ff7c8891..781235ce 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -12,13 +12,8 @@ jobs: strategy: fail-fast: false matrix: - xcode: [ Xcode_14.3, Xcode_15.2.0 ] - os: [ macos-13 ] - include: - - xcode: Xcode_15.4 - os: macos-14 - - xcode: Xcode_16.2 - os: macos-15 + xcode: [ '15', '16' ] + os: [ macos-14, macos-15 ] steps: - name: Checkout uses: actions/checkout@v4 From 1fd572100fd7e5077a0a93af3f445383c2bc253c Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Tue, 29 Apr 2025 21:17:10 +0200 Subject: [PATCH 18/21] Fix build on macOS 15 with Xcode 16 A compilation error was caused by the zlib dependency that is bundled with libgit2. This particular version of zlib fails to compile on Clang 17 with the error "Expected identifier or '('". This problem was fixed in libgit2 v1.9.0 in which they updated zlib. However, libgit2 v1.9.0 introduced a new compilation issue: an unterminated multiline comment, which is fixed in this commit which is not part of any libgit2 release yet: https://github.com/libgit2/libgit2/commit/2fa13adf09c8dd1f334f57023390043ea3f71cb2 When I check out the libgit2 submodule at that commit (and remove a reference to a deprecated constant from SwiftGit2) it is solved. Changes in this commit: * Updates libgit2 to 2fa13adf09c8dd1f334f57023390043ea3f71cb2, this is needed to fix the compilation issues. * Removes reference to deprecated constant `GIT_OBJECT_REF_DELTA`, which wasn't being used in SwiftGit2. --- Package.swift | 1 + Sources/SwiftGit2/Diffs.swift | 2 -- libgit2 | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 8f784e10..c347f7bf 100644 --- a/Package.swift +++ b/Package.swift @@ -47,6 +47,7 @@ let package = Package( "deps/zlib/CMakeLists.txt", "deps/zlib/LICENSE", "src/libgit2/CMakeLists.txt", + "src/libgit2/config.cmake.in", "src/libgit2/experimental.h.in", "src/libgit2/git2.rc", "src/util/CMakeLists.txt", diff --git a/Sources/SwiftGit2/Diffs.swift b/Sources/SwiftGit2/Diffs.swift index e4d958b7..dabf1080 100644 --- a/Sources/SwiftGit2/Diffs.swift +++ b/Sources/SwiftGit2/Diffs.swift @@ -32,8 +32,6 @@ public struct Diff { public var deltas = [Delta]() public struct Delta { - public static let type = GIT_OBJECT_REF_DELTA - public var status: Status public var flags: Flags public var oldFile: File? diff --git a/libgit2 b/libgit2 index 36f7e21a..2fa13adf 160000 --- a/libgit2 +++ b/libgit2 @@ -1 +1 @@ -Subproject commit 36f7e21ad757a3dacc58cf7944329da6bc1d6e96 +Subproject commit 2fa13adf09c8dd1f334f57023390043ea3f71cb2 From 412d1de0a252f0297adcb49970ab30f258a3fa08 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Wed, 30 Apr 2025 10:33:27 +0200 Subject: [PATCH 19/21] Use mxcl/xcodebuild GitHub Action --- .github/workflows/BuildPR.yml | 44 ++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index 781235ce..3892fdef 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -12,42 +12,48 @@ jobs: strategy: fail-fast: false matrix: - xcode: [ '15', '16' ] - os: [ macos-14, macos-15 ] + xcode: + # The '^' stands for a semantic version range + - ^15 + - ^16 + os: + - macos-14 + - macos-15 steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - - name: Set Xcode Version - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ matrix.xcode }} - name: Build and test on macOS - run: | - xcodebuild -scheme SwiftGit2 -destination "platform=macOS" build test + uses: mxcl/xcodebuild@v3 + with: + xcode: ${{ matrix.xcode }} + platform: macOS build-ios: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - xcode: [ '16' ] - os: [ macos-15 ] + xcode: + - ^16 + os: + - macos-15 + platform: + - iOS + platform-version: + # The '^' stands for a semantic version range + - ^18 steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - - name: Set Xcode Version - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ matrix.xcode }} - name: Build and test on iOS - run: | - PLATFORM="iOS Simulator" - # xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) - DEVICE=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"` - xcodebuild -scheme SwiftGit2 -destination "platform=$PLATFORM,name=$DEVICE" build test + uses: mxcl/xcodebuild@v3 + with: + platform-version: ${{ matrix.platform-version }} + platform: ${{ matrix.platform }} + xcode: ${{ matrix.xcode }} From e37a3858ed92e2c50fbbbdd00f954aa4d3e9d407 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Wed, 24 Sep 2025 21:27:11 +0200 Subject: [PATCH 20/21] Add notice to README regarding SPM migration --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1274bae7..4385a921 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # SwiftGit2 +> [!WARNING] +> The SwiftGit2 maintainers are in the process of migrating SwiftGit2 to the Swift Package Manager. +> +> This causes the following breaking changes: +> +> * The Carthage configuration and Xcode project are gone and are longer supported. +> * SwiftGit2 must now be explicitly initialized by the application by calling `SwiftGit2.initialize()`. Its resources may be cleaned up again using `SwfitGit2.shutdown()`. +> * The dependency libssh2 is not yet integrated. The impact is that SwiftGit2 on iOS cannot interact with remote repositories over SSH. (Remotes that use HTTPS are supported using the HTTP client that ships with libgit2.) + [![Build Status](https://github.com/SwiftGit2/SwiftGit2/actions/workflows/BuildPR.yml/badge.svg)](https://github.com/SwiftGit2/SwiftGit2/actions) [![GitHub release](https://img.shields.io/github/release/SwiftGit2/SwiftGit2.svg)](https://github.com/SwiftGit2/SwiftGit2/releases) ![Swift 5.9.x](https://img.shields.io/badge/Swift-5.9.x-orange.svg) @@ -31,7 +40,8 @@ case let .failure(error): ``` ## Design -SwiftGit2 uses value objects wherever possible. That means using Swift’s `struct`s and `enum`s without holding references to libgit2 objects. This has a number of advantages: + +SwiftGit2 uses value types wherever possible. That means using Swift’s `struct`s and `enum`s without holding references to libgit2 objects. This has a number of advantages: 1. Values can be used concurrently. 2. Consuming values won’t result in disk access. @@ -42,9 +52,11 @@ This vastly simplifies the design of long-lived applications, which are the most All methods for reading from or writing to a repository are on SwiftGit’s only `class`: `Repository`. This highlights the failability and mutation of these methods, while freeing up all other instances to be immutable `struct`s and `enum`s. ## Adding SwiftGit2 to your Project + You can add SwiftGit2 to your project using the [Swift Package Manager](https://www.swift.org/documentation/package-manager/). In Xcode, go to your project settings, then to `Package Dependencies`. Add SwiftGit2 using the URL: + ``` https://github.com/SwiftGit2/SwiftGit2.git ``` @@ -61,14 +73,16 @@ And don't forget to reference it from your target: .target(name: "YourProject", dependencies: ["SwiftGit2"]), ``` -## Building SwiftGit2 Manually -If you want to build and test SwiftGit2 locally for development: +## Developing SwiftGit2 + +If you want to build and test SwiftGit2 locally for development purposes: 1. Clone SwiftGit2 2. Run `git submodule update --init` to clone the libgit2 submodule 3. Run `swift test` or open the `Package.swift` file to develop and test using Xcode ## Contributions + We :heart: to receive pull requests! GitHub makes it easy: 1. Fork the repository @@ -78,4 +92,5 @@ We :heart: to receive pull requests! GitHub makes it easy: All contributions should match GitHub’s [Swift Style Guide](https://github.com/github/swift-style-guide). ## License + SwiftGit2 is available under the [MIT license](https://github.com/SwiftGit2/SwiftGit2/blob/master/LICENSE.md). From c14e0fbe8270fd5555c2d62c7b6fbef128b42cb8 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Wed, 24 Sep 2025 21:40:25 +0200 Subject: [PATCH 21/21] Use the correct function names in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4385a921..5dbf3878 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ > This causes the following breaking changes: > > * The Carthage configuration and Xcode project are gone and are longer supported. -> * SwiftGit2 must now be explicitly initialized by the application by calling `SwiftGit2.initialize()`. Its resources may be cleaned up again using `SwfitGit2.shutdown()`. +> * SwiftGit2 must now be explicitly initialized by the application by calling `SwiftGit2Init()`. Its resources may be cleaned up again using `SwiftGit2Shutdown()`. > * The dependency libssh2 is not yet integrated. The impact is that SwiftGit2 on iOS cannot interact with remote repositories over SSH. (Remotes that use HTTPS are supported using the HTTP client that ships with libgit2.) [![Build Status](https://github.com/SwiftGit2/SwiftGit2/actions/workflows/BuildPR.yml/badge.svg)](https://github.com/SwiftGit2/SwiftGit2/actions)