Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6148d1b3d4 | |||
| 27d2f38b6a | |||
| f04fe39df5 | |||
| c2e903a521 | |||
| 8a8eef6e54 | |||
| 4cee705dd9 | |||
| 77ae788bf6 | |||
| 158ba52f3d | |||
| 782a1fad2f | |||
| 386a21f46c | |||
| e77e3e17db | |||
| 3ce0d32a3b | |||
| 2adf4e1d35 | |||
| b0e94f89fe | |||
| 52b602674b | |||
| c7f4a14ae4 | |||
| 775b054be0 | |||
| 5b8f53263e | |||
| 4949d68379 | |||
| c6d8fa3b07 | |||
| 0c79b59fb0 | |||
| f69eee9b9b | |||
| 9e90f7c3ba | |||
| 71cbc53e75 | |||
| 6058febb36 | |||
| 39aca8e650 | |||
| 1e7c415fd2 | |||
| c181172606 | |||
| a7653667f4 | |||
| 3bbff975c0 | |||
| 6fb4054d38 | |||
| db091b107e | |||
| e76de59957 | |||
| e7315035df | |||
| 9343544dc9 | |||
| 2b7899198d | |||
| 11ca78320d | |||
| f00bb4699a | |||
| d176b1afaf | |||
| 3ebe0d82a8 | |||
| 8c461732df | |||
| bcccf31665 | |||
| edbd64318c | |||
| b620e0c08e | |||
| dc6a307153 | |||
| ac7f35a976 | |||
| cbb2207031 | |||
| 712cfc50ea | |||
| b253e02ac8 | |||
| 3dc0712e24 | |||
| 827ec79117 | |||
| 08c382a327 | |||
| f577819044 | |||
| 0842b80a3d | |||
| 734d25c15b | |||
| 84e7f996ae | |||
| ab0f592aed | |||
| ed618c6fbc | |||
| 17a0b7514d | |||
| 1e57a9ff00 | |||
| e78fe86a34 | |||
| c8a192f18b | |||
| e7656b1d88 | |||
| 62d0e15491 | |||
| 5ec4722a20 | |||
| c5cbf4cc17 | |||
| b87b66f11a | |||
| 571cdef3c4 | |||
| cc4833b334 |
@@ -1,3 +1,6 @@
|
||||
.vscode/
|
||||
.build/
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
@@ -20,6 +23,7 @@ DerivedData
|
||||
*.idea*
|
||||
|
||||
External/libgit2*.a
|
||||
External/libgit2-mac
|
||||
External/ios-openssl
|
||||
External/libgit2-ios
|
||||
External/libssh2-ios
|
||||
|
||||
@@ -19,3 +19,5 @@
|
||||
[submodule "External/openssl"]
|
||||
path = External/openssl
|
||||
url = https://github.com/openssl/openssl.git
|
||||
[submodule "libgit2"]
|
||||
url = https://github.com/libgit2/libgit2.git
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
language: objective-c
|
||||
|
||||
os: osx
|
||||
osx_image: xcode10.2
|
||||
osx_image: xcode11.4
|
||||
|
||||
sudo: false # Enable container-based builds
|
||||
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
github "jspahrsummers/xcconfigs" ~> 1.0
|
||||
github "Quick/Quick" ~> 2.0
|
||||
github "Quick/Nimble" ~> 8.0
|
||||
github "jspahrsummers/xcconfigs" ~> 1.1
|
||||
github "Quick/Quick" ~> 7.0
|
||||
github "Quick/Nimble" ~> 12.0
|
||||
github "ZipArchive/ZipArchive" ~> 2.0
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
github "Quick/Nimble" "v8.0.1"
|
||||
github "Quick/Quick" "v2.0.0"
|
||||
github "ZipArchive/ZipArchive" "v2.1.5"
|
||||
github "jspahrsummers/xcconfigs" "1.0"
|
||||
github "Quick/Nimble" "v12.3.0"
|
||||
github "Quick/Quick" "v7.3.0"
|
||||
github "ZipArchive/ZipArchive" "2.5.5"
|
||||
github "jspahrsummers/xcconfigs" "1.1"
|
||||
|
||||
Vendored
+1
-1
Submodule Carthage/Checkouts/Nimble updated: 43304bf2b1...edaedc1ec8
Vendored
+1
-1
Submodule Carthage/Checkouts/Quick updated: 0b4ed6c706...ef9aaf3f63
Vendored
+1
-1
Submodule Carthage/Checkouts/ZipArchive updated: 6017baba3c...79d4dc9729
Vendored
+1
-1
Submodule Carthage/Checkouts/xcconfigs updated: d0f8992afa...4ced0ad5a9
Vendored
+1
-1
@@ -1 +1 @@
|
||||
/usr/local/opt/openssl/lib/libcrypto.a
|
||||
/opt/homebrew/opt/openssl/lib/libcrypto.a
|
||||
Vendored
+1
-1
Submodule External/libgit2 updated: f23dc5b29f...a2bde63741
Vendored
+1
-1
@@ -1 +1 @@
|
||||
/usr/local/opt/openssl/lib/libssl.a
|
||||
/opt/homebrew/opt/openssl/lib/libssl.a
|
||||
@@ -2,24 +2,31 @@
|
||||
[](https://travis-ci.org/SwiftGit2/SwiftGit2)
|
||||
[](#carthage)
|
||||
[](https://github.com/SwiftGit2/SwiftGit2/releases)
|
||||

|
||||

|
||||
|
||||
Swift bindings to [libgit2](https://github.com/libgit2/libgit2).
|
||||
|
||||
```swift
|
||||
let URL: NSURL = ...
|
||||
let repo = Repository.at(URL)
|
||||
if let repo = repo.value {
|
||||
let latestCommit: Result<Commit, NSError> = repo
|
||||
let URL: URL = ...
|
||||
let result = Repository.at(URL)
|
||||
switch result {
|
||||
case let .success(repo):
|
||||
let latestCommit = repo
|
||||
.HEAD()
|
||||
.flatMap { repo.commit($0.oid) }
|
||||
if let commit = latestCommit.value {
|
||||
.flatMap {
|
||||
repo.commit($0.oid)
|
||||
}
|
||||
|
||||
switch latestCommit {
|
||||
case let .success(commit):
|
||||
print("Latest Commit: \(commit.message) by \(commit.author.name)")
|
||||
} else {
|
||||
print("Could not get commit: \(latestCommit.error)")
|
||||
|
||||
case let .failure(error):
|
||||
print("Could not get commit: \(error)")
|
||||
}
|
||||
} else {
|
||||
println("Could not open repository: \(repo.error)")
|
||||
|
||||
case let .failure(error):
|
||||
print("Could not open repository: \(error)")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -44,6 +51,10 @@ To build SwiftGit2, you'll need the following tools installed locally:
|
||||
* automake
|
||||
* pkg-config
|
||||
|
||||
```
|
||||
brew install cmake libssh2 libtool autoconf automake pkg-config
|
||||
```
|
||||
|
||||
## 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`.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
@@ -26,6 +26,10 @@
|
||||
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 */; };
|
||||
50A6835E2ADE7C2B00FDB557 /* libgit2.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50A6835C2ADE7C2300FDB557 /* libgit2.xcframework */; };
|
||||
50A6835F2ADE7C2B00FDB557 /* libgit2.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 50A6835C2ADE7C2300FDB557 /* libgit2.xcframework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
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 */; };
|
||||
@@ -123,19 +127,30 @@
|
||||
remoteGlobalIDString = BEB31F221A0D6F7A00F525B9;
|
||||
remoteInfo = "SwiftGit2-OSX";
|
||||
};
|
||||
BEB31F941A0E56E200F525B9 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = BEB31F1A1A0D6F7A00F525B9 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = BEB31F8E1A0E563900F525B9;
|
||||
remoteInfo = libgit2;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
50A682E52ADBF65F00FDB557 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
50A6835F2ADE7C2B00FDB557 /* libgit2.xcframework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
232861421F4A3A2E00276D65 /* Diffs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Diffs.swift; sourceTree = "<group>"; };
|
||||
237731C61F46542B0020A3FE /* repository-with-status.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "repository-with-status.zip"; sourceTree = "<group>"; };
|
||||
25499A996CA7BD416620A397 /* CommitIterator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommitIterator.swift; sourceTree = "<group>"; };
|
||||
3F5181B0258FE7D10048F1EF /* StatusOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusOptions.swift; sourceTree = "<group>"; };
|
||||
50A682D82AD9901000FDB557 /* script */ = {isa = PBXFileReference; lastKnownFileType = folder; path = script; sourceTree = "<group>"; };
|
||||
50A6835A2ADD33CE00FDB557 /* libgit2-mac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libgit2-mac.a"; path = "External/libgit2-mac/libgit2-mac.a"; sourceTree = "<group>"; };
|
||||
50A6835C2ADE7C2300FDB557 /* libgit2.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = libgit2.xcframework; path = "External/libgit2-ios/libgit2.xcframework"; sourceTree = "<group>"; };
|
||||
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; };
|
||||
@@ -183,7 +198,6 @@
|
||||
BEB31F571A0D75EE00F525B9 /* macOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-StaticLibrary.xcconfig"; sourceTree = "<group>"; };
|
||||
BEB31F581A0D75EE00F525B9 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
BEB31F6C1A0D78F300F525B9 /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
@@ -202,6 +216,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
621E67001C72A60B00A0F352 /* libz.tbd in Frameworks */,
|
||||
50A6835E2ADE7C2B00FDB557 /* libgit2.xcframework in Frameworks */,
|
||||
621E66FE1C72A5FF00A0F352 /* libiconv.tbd in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -240,6 +255,15 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
50A682D92AD994C500FDB557 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50A6835C2ADE7C2300FDB557 /* libgit2.xcframework */,
|
||||
50A6835A2ADD33CE00FDB557 /* libgit2-mac.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
621E66D41C72965C00A0F352 /* Mac */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -273,12 +297,14 @@
|
||||
BEB31F191A0D6F7A00F525B9 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50A682D82AD9901000FDB557 /* script */,
|
||||
BEB31F251A0D6F7A00F525B9 /* SwiftGit2 */,
|
||||
BEB31F261A0D6F7A00F525B9 /* Supporting Files */,
|
||||
BEB31F321A0D6F7A00F525B9 /* SwiftGit2Tests */,
|
||||
BEB31FA11A0E63C100F525B9 /* Libraries */,
|
||||
BEB31F411A0D75EE00F525B9 /* Configuration */,
|
||||
BEB31F241A0D6F7A00F525B9 /* Products */,
|
||||
50A682D92AD994C500FDB557 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
usesTabs = 1;
|
||||
@@ -288,7 +314,6 @@
|
||||
children = (
|
||||
BEB31F231A0D6F7A00F525B9 /* SwiftGit2.framework */,
|
||||
BEB31F2E1A0D6F7A00F525B9 /* SwiftGit2-OSXTests.xctest */,
|
||||
BEB31F8F1A0E563900F525B9 /* libgit2.a */,
|
||||
621E66B41C72958800A0F352 /* SwiftGit2.framework */,
|
||||
621E66CE1C72958D00A0F352 /* SwiftGit2-iOSTests.xctest */,
|
||||
621E66E11C729CE500A0F352 /* libgit2.a */,
|
||||
@@ -315,6 +340,7 @@
|
||||
BECB5F691A56F19900999413 /* References.swift */,
|
||||
BECB5F6D1A57284700999413 /* Remotes.swift */,
|
||||
25499A996CA7BD416620A397 /* CommitIterator.swift */,
|
||||
3F5181B0258FE7D10048F1EF /* StatusOptions.swift */,
|
||||
);
|
||||
path = SwiftGit2;
|
||||
sourceTree = "<group>";
|
||||
@@ -459,6 +485,7 @@
|
||||
621E669F1C72958800A0F352 /* Sources */,
|
||||
621E66AA1C72958800A0F352 /* Frameworks */,
|
||||
621E66AE1C72958800A0F352 /* Headers */,
|
||||
50A682E52ADBF65F00FDB557 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -539,6 +566,7 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = BEB31F391A0D6F7A00F525B9 /* Build configuration list for PBXNativeTarget "SwiftGit2-OSX" */;
|
||||
buildPhases = (
|
||||
50A682DD2AD9959500FDB557 /* Update libgit2 */,
|
||||
BEB31F1E1A0D6F7A00F525B9 /* Sources */,
|
||||
BEB31F1F1A0D6F7A00F525B9 /* Frameworks */,
|
||||
BEB31F201A0D6F7A00F525B9 /* Headers */,
|
||||
@@ -546,7 +574,6 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
BEB31F951A0E56E200F525B9 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "SwiftGit2-OSX";
|
||||
productName = "SwiftGit2-OSX";
|
||||
@@ -571,21 +598,6 @@
|
||||
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 */
|
||||
@@ -593,7 +605,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 1010;
|
||||
LastUpgradeCheck = 1220;
|
||||
ORGANIZATIONNAME = "GitHub, Inc";
|
||||
TargetAttributes = {
|
||||
621E66611C72958800A0F352 = {
|
||||
@@ -610,9 +622,6 @@
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
LastSwiftMigration = 1020;
|
||||
};
|
||||
BEB31F8E1A0E563900F525B9 = {
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
};
|
||||
C9CE0DD21E0710BD0053205D = {
|
||||
CreatedOnToolsVersion = 8.2;
|
||||
ProvisioningStyle = Automatic;
|
||||
@@ -636,7 +645,6 @@
|
||||
BEB31F2D1A0D6F7A00F525B9 /* SwiftGit2-OSXTests */,
|
||||
621E66611C72958800A0F352 /* SwiftGit2-iOS */,
|
||||
621E66B61C72958D00A0F352 /* SwiftGit2-iOSTests */,
|
||||
BEB31F8E1A0E563900F525B9 /* libgit2-OSX */,
|
||||
621E66DC1C729CE500A0F352 /* libgit2-iOS */,
|
||||
621E66E71C729EB800A0F352 /* OpenSSL-iOS */,
|
||||
621E66ED1C729EBB00A0F352 /* libssh2-iOS */,
|
||||
@@ -671,21 +679,44 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
50A682DD2AD9959500FDB557 /* Update libgit2 */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Update libgit2";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(SRCROOT)/External/libgit2-mac/libgit2-mac.a",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "script/update_libgit2\n";
|
||||
};
|
||||
621E66DD1C729CE500A0F352 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(SRCROOT)/External/libgit2-ios/libgit2.xcframework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = script/update_libgit2_ios;
|
||||
shellScript = "script/update_libgit2_ios\n";
|
||||
};
|
||||
621E66E81C729EB800A0F352 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -695,10 +726,11 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = script/update_libssl_ios;
|
||||
shellScript = "script/update_libssl_ios\n";
|
||||
};
|
||||
621E66EE1C729EBB00A0F352 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -708,23 +740,11 @@
|
||||
);
|
||||
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;
|
||||
shellScript = "script/update_libssh2_ios\n";
|
||||
};
|
||||
C9CE0DD61E0710C20053205D /* Lint Sources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -735,7 +755,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint --lenient\nelse\n echo \"warning: SwiftLint is not installed\"\nfi";
|
||||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint --lenient\nelse\n echo \"warning: SwiftLint is not installed\"\nfi\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
@@ -756,6 +776,7 @@
|
||||
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;
|
||||
@@ -791,6 +812,7 @@
|
||||
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;
|
||||
@@ -838,11 +860,6 @@
|
||||
target = BEB31F221A0D6F7A00F525B9 /* SwiftGit2-OSX */;
|
||||
targetProxy = BEB31F301A0D6F7A00F525B9 /* PBXContainerItemProxy */;
|
||||
};
|
||||
BEB31F951A0E56E200F525B9 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = BEB31F8E1A0E563900F525B9 /* libgit2-OSX */;
|
||||
targetProxy = BEB31F941A0E56E200F525B9 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
@@ -850,6 +867,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = BEB31F501A0D75EE00F525B9 /* iOS-Framework.xcconfig */;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/External/libgit2-ios";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/External/libgit2/include",
|
||||
"$(inherited)",
|
||||
@@ -862,9 +880,6 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-force_load",
|
||||
"External/libgit2-ios/libgit2-ios.a",
|
||||
"-lgit2-ios",
|
||||
"-lssl",
|
||||
"-lcrypto",
|
||||
"-lssh2-ios",
|
||||
@@ -879,6 +894,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = BEB31F501A0D75EE00F525B9 /* iOS-Framework.xcconfig */;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/External/libgit2-ios";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/External/libgit2/include",
|
||||
"$(inherited)",
|
||||
@@ -891,9 +907,6 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-force_load",
|
||||
"External/libgit2-ios/libgit2-ios.a",
|
||||
"-lgit2-ios",
|
||||
"-lssl",
|
||||
"-lcrypto",
|
||||
"-lssh2-ios",
|
||||
@@ -928,6 +941,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */;
|
||||
buildSettings = {
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
PRODUCT_NAME = git2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -936,6 +950,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = BEB31F511A0D75EE00F525B9 /* iOS-StaticLibrary.xcconfig */;
|
||||
buildSettings = {
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
PRODUCT_NAME = git2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -976,12 +991,13 @@
|
||||
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;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -991,12 +1007,13 @@
|
||||
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;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
@@ -1011,14 +1028,14 @@
|
||||
);
|
||||
INFOPLIST_FILE = SwiftGit2/Info.plist;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
External,
|
||||
"External/libgit2-mac",
|
||||
External/,
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/External/libgit2-mac",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lgit2",
|
||||
"-force_load",
|
||||
External/libgit2.a,
|
||||
/usr/local/lib/libssh2.a,
|
||||
/opt/homebrew/lib/libssh2.a,
|
||||
"-lgit2-mac",
|
||||
"-lcrypto",
|
||||
"-lssl",
|
||||
"-lcurl",
|
||||
@@ -1026,6 +1043,7 @@
|
||||
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;
|
||||
};
|
||||
@@ -1039,14 +1057,14 @@
|
||||
);
|
||||
INFOPLIST_FILE = SwiftGit2/Info.plist;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
External,
|
||||
"External/libgit2-mac",
|
||||
External/,
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/External/libgit2-mac",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-lgit2",
|
||||
"-force_load",
|
||||
External/libgit2.a,
|
||||
/usr/local/lib/libssh2.a,
|
||||
/opt/homebrew/lib/libssh2.a,
|
||||
"-lgit2-mac",
|
||||
"-lcrypto",
|
||||
"-lssl",
|
||||
"-lcurl",
|
||||
@@ -1054,6 +1072,7 @@
|
||||
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;
|
||||
};
|
||||
@@ -1062,7 +1081,6 @@
|
||||
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)";
|
||||
};
|
||||
@@ -1073,28 +1091,11 @@
|
||||
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 = {
|
||||
PRODUCT_NAME = git2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BEB31F921A0E563900F525B9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = BEB31F571A0D75EE00F525B9 /* macOS-StaticLibrary.xcconfig */;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = git2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C9CE0DD41E0710BD0053205D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -1184,15 +1185,6 @@
|
||||
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 = (
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
LastUpgradeVersion = "1220"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -41,6 +41,15 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "BEB31F221A0D6F7A00F525B9"
|
||||
BuildableName = "SwiftGit2.framework"
|
||||
BlueprintName = "SwiftGit2-OSX"
|
||||
ReferencedContainer = "container:SwiftGit2.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@@ -53,17 +62,6 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "BEB31F221A0D6F7A00F525B9"
|
||||
BuildableName = "SwiftGit2.framework"
|
||||
BlueprintName = "SwiftGit2-OSX"
|
||||
ReferencedContainer = "container:SwiftGit2.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -84,8 +82,6 @@
|
||||
ReferencedContainer = "container:SwiftGit2.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
LastUpgradeVersion = "1220"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -41,6 +41,15 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "621E66611C72958800A0F352"
|
||||
BuildableName = "SwiftGit2.framework"
|
||||
BlueprintName = "SwiftGit2-iOS"
|
||||
ReferencedContainer = "container:SwiftGit2.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@@ -53,17 +62,6 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "621E66611C72958800A0F352"
|
||||
BuildableName = "SwiftGit2.framework"
|
||||
BlueprintName = "SwiftGit2-iOS"
|
||||
ReferencedContainer = "container:SwiftGit2.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -84,8 +82,6 @@
|
||||
ReferencedContainer = "container:SwiftGit2.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
public class CommitIterator: IteratorProtocol, Sequence {
|
||||
public typealias Iterator = CommitIterator
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Copyright © 2016 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
private class Wrapper<T> {
|
||||
let value: T
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Copyright © 2017 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
public struct StatusEntry {
|
||||
public var status: Diff.Status
|
||||
@@ -32,7 +32,7 @@ public struct Diff {
|
||||
public var deltas = [Delta]()
|
||||
|
||||
public struct Delta {
|
||||
public static let type = GIT_OBJ_REF_DELTA
|
||||
public static let type = GIT_OBJECT_REF_DELTA
|
||||
|
||||
public var status: Status
|
||||
public var flags: Flags
|
||||
@@ -50,7 +50,7 @@ public struct Diff {
|
||||
public struct File {
|
||||
public var oid: OID
|
||||
public var path: String
|
||||
public var size: Int64
|
||||
public var size: UInt64
|
||||
public var flags: Flags
|
||||
|
||||
public init(_ diffFile: git_diff_file) {
|
||||
@@ -94,7 +94,7 @@ public struct Diff {
|
||||
}
|
||||
public let rawValue: UInt32
|
||||
|
||||
public static let binary = Flags(rawValue: 0)
|
||||
public static let binary = Flags([])
|
||||
public static let notBinary = Flags(rawValue: 1 << 0)
|
||||
public static let validId = Flags(rawValue: 1 << 1)
|
||||
public static let exists = Flags(rawValue: 1 << 2)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Foundation
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
public let libGit2ErrorDomain = "org.libgit2.libgit2"
|
||||
|
||||
@@ -42,7 +42,7 @@ private func errorMessage(_ errorCode: Int32) -> String? {
|
||||
let last = giterr_last()
|
||||
if let lastErrorPointer = last {
|
||||
return String(validatingUTF8: lastErrorPointer.pointee.message)
|
||||
} else if UInt32(errorCode) == GITERR_OS.rawValue {
|
||||
} else if UInt32(errorCode) == GIT_ERROR_OS.rawValue {
|
||||
return String(validatingUTF8: strerror(errno))
|
||||
} else {
|
||||
return nil
|
||||
|
||||
@@ -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] {
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
/// A git object.
|
||||
public protocol ObjectType {
|
||||
static var type: git_otype { get }
|
||||
static var type: git_object_t { get }
|
||||
|
||||
/// The OID of the object.
|
||||
var oid: OID { get }
|
||||
@@ -84,7 +84,7 @@ extension Signature: Hashable {
|
||||
|
||||
/// A git commit.
|
||||
public struct Commit: ObjectType, Hashable {
|
||||
public static let type = GIT_OBJ_COMMIT
|
||||
public static let type = GIT_OBJECT_COMMIT
|
||||
|
||||
/// The OID of the commit.
|
||||
public let oid: OID
|
||||
@@ -120,7 +120,7 @@ public struct Commit: ObjectType, Hashable {
|
||||
|
||||
/// A git tree.
|
||||
public struct Tree: ObjectType, Hashable {
|
||||
public static let type = GIT_OBJ_TREE
|
||||
public static let type = GIT_OBJECT_TREE
|
||||
|
||||
/// An entry in a `Tree`.
|
||||
public struct Entry: Hashable {
|
||||
@@ -176,7 +176,7 @@ extension Tree.Entry: CustomStringConvertible {
|
||||
|
||||
/// A git blob.
|
||||
public struct Blob: ObjectType, Hashable {
|
||||
public static let type = GIT_OBJ_BLOB
|
||||
public static let type = GIT_OBJECT_BLOB
|
||||
|
||||
/// The OID of the blob.
|
||||
public let oid: OID
|
||||
@@ -195,7 +195,7 @@ public struct Blob: ObjectType, Hashable {
|
||||
|
||||
/// An annotated git tag.
|
||||
public struct Tag: ObjectType, Hashable {
|
||||
public static let type = GIT_OBJ_TAG
|
||||
public static let type = GIT_OBJECT_TAG
|
||||
|
||||
/// The OID of the tag.
|
||||
public let oid: OID
|
||||
|
||||
+15
-15
@@ -6,15 +6,15 @@
|
||||
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
/// A pointer to a git object.
|
||||
public protocol PointerType: Hashable {
|
||||
/// The OID of the referenced object.
|
||||
var oid: OID { get }
|
||||
|
||||
/// The libgit2 `git_otype` of the referenced object.
|
||||
var type: git_otype { get }
|
||||
/// The libgit2 `git_object_t` of the referenced object.
|
||||
var type: git_object_t { get }
|
||||
}
|
||||
|
||||
public extension PointerType {
|
||||
@@ -48,29 +48,29 @@ public enum Pointer: PointerType {
|
||||
}
|
||||
}
|
||||
|
||||
public var type: git_otype {
|
||||
public var type: git_object_t {
|
||||
switch self {
|
||||
case .commit:
|
||||
return GIT_OBJ_COMMIT
|
||||
return GIT_OBJECT_COMMIT
|
||||
case .tree:
|
||||
return GIT_OBJ_TREE
|
||||
return GIT_OBJECT_TREE
|
||||
case .blob:
|
||||
return GIT_OBJ_BLOB
|
||||
return GIT_OBJECT_BLOB
|
||||
case .tag:
|
||||
return GIT_OBJ_TAG
|
||||
return GIT_OBJECT_TAG
|
||||
}
|
||||
}
|
||||
|
||||
/// Create an instance with an OID and a libgit2 `git_otype`.
|
||||
init?(oid: OID, type: git_otype) {
|
||||
/// Create an instance with an OID and a libgit2 `git_object_t`.
|
||||
init?(oid: OID, type: git_object_t) {
|
||||
switch type {
|
||||
case GIT_OBJ_COMMIT:
|
||||
case GIT_OBJECT_COMMIT:
|
||||
self = .commit(oid)
|
||||
case GIT_OBJ_TREE:
|
||||
case GIT_OBJECT_TREE:
|
||||
self = .tree(oid)
|
||||
case GIT_OBJ_BLOB:
|
||||
case GIT_OBJECT_BLOB:
|
||||
self = .blob(oid)
|
||||
case GIT_OBJ_TAG:
|
||||
case GIT_OBJECT_TAG:
|
||||
self = .tag(oid)
|
||||
default:
|
||||
return nil
|
||||
@@ -96,7 +96,7 @@ extension Pointer: CustomStringConvertible {
|
||||
public struct PointerTo<T: ObjectType>: PointerType {
|
||||
public let oid: OID
|
||||
|
||||
public var type: git_otype {
|
||||
public var type: git_object_t {
|
||||
return T.type
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
@@ -107,7 +107,7 @@ public struct Branch: ReferenceType, Hashable {
|
||||
longName = String(validatingUTF8: git_reference_name(pointer))!
|
||||
|
||||
var oid: OID
|
||||
if git_reference_type(pointer).rawValue == GIT_REF_SYMBOLIC.rawValue {
|
||||
if git_reference_type(pointer).rawValue == GIT_REFERENCE_SYMBOLIC.rawValue {
|
||||
var resolved: OpaquePointer? = nil
|
||||
let success = git_reference_resolve(&resolved, pointer)
|
||||
guard success == GIT_OK.rawValue else {
|
||||
@@ -178,7 +178,7 @@ public enum TagReference: ReferenceType, Hashable {
|
||||
var oid = git_reference_target(pointer).pointee
|
||||
|
||||
var pointer: OpaquePointer? = nil
|
||||
let result = git_object_lookup(&pointer, repo, &oid, GIT_OBJ_TAG)
|
||||
let result = git_object_lookup(&pointer, repo, &oid, GIT_OBJECT_TAG)
|
||||
if result == GIT_OK.rawValue {
|
||||
self = .annotated(name, Tag(pointer!))
|
||||
} else {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+24
-22
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
public typealias CheckoutProgressBlock = (String?, Int, Int) -> Void
|
||||
|
||||
@@ -206,7 +206,7 @@ public final class Repository {
|
||||
///
|
||||
/// Returns the result of calling `transform` or an error if the object
|
||||
/// cannot be loaded.
|
||||
private func withGitObject<T>(_ oid: OID, type: git_otype,
|
||||
private func withGitObject<T>(_ oid: OID, type: git_object_t,
|
||||
transform: (OpaquePointer) -> Result<T, NSError>) -> Result<T, NSError> {
|
||||
var pointer: OpaquePointer? = nil
|
||||
var oid = oid.oid
|
||||
@@ -221,11 +221,11 @@ public final class Repository {
|
||||
return value
|
||||
}
|
||||
|
||||
private func withGitObject<T>(_ oid: OID, type: git_otype, transform: (OpaquePointer) -> T) -> Result<T, NSError> {
|
||||
private func withGitObject<T>(_ oid: OID, type: git_object_t, transform: (OpaquePointer) -> T) -> Result<T, NSError> {
|
||||
return withGitObject(oid, type: type) { Result.success(transform($0)) }
|
||||
}
|
||||
|
||||
private func withGitObjects<T>(_ oids: [OID], type: git_otype, transform: ([OpaquePointer]) -> Result<T, NSError>) -> Result<T, NSError> {
|
||||
private func withGitObjects<T>(_ oids: [OID], type: git_object_t, transform: ([OpaquePointer]) -> Result<T, NSError>) -> Result<T, NSError> {
|
||||
var pointers = [OpaquePointer]()
|
||||
defer {
|
||||
for pointer in pointers {
|
||||
@@ -254,7 +254,7 @@ public final class Repository {
|
||||
///
|
||||
/// Returns a `Blob`, `Commit`, `Tag`, or `Tree` if one exists, or an error.
|
||||
public func object(_ oid: OID) -> Result<ObjectType, NSError> {
|
||||
return withGitObject(oid, type: GIT_OBJ_ANY) { object in
|
||||
return withGitObject(oid, type: GIT_OBJECT_ANY) { object in
|
||||
let type = git_object_type(object)
|
||||
if type == Blob.type {
|
||||
return Result.success(Blob(object))
|
||||
@@ -270,7 +270,7 @@ public final class Repository {
|
||||
domain: "org.libgit2.SwiftGit2",
|
||||
code: 1,
|
||||
userInfo: [
|
||||
NSLocalizedDescriptionKey: "Unrecognized git_otype '\(type)' for oid '\(oid)'.",
|
||||
NSLocalizedDescriptionKey: "Unrecognized git_object_t '\(type)' for oid '\(oid)'.",
|
||||
]
|
||||
)
|
||||
return Result.failure(error)
|
||||
@@ -283,7 +283,7 @@ public final class Repository {
|
||||
///
|
||||
/// Returns the blob if it exists, or an error.
|
||||
public func blob(_ oid: OID) -> Result<Blob, NSError> {
|
||||
return withGitObject(oid, type: GIT_OBJ_BLOB) { Blob($0) }
|
||||
return withGitObject(oid, type: GIT_OBJECT_BLOB) { Blob($0) }
|
||||
}
|
||||
|
||||
/// Loads the commit with the given OID.
|
||||
@@ -292,7 +292,7 @@ public final class Repository {
|
||||
///
|
||||
/// Returns the commit if it exists, or an error.
|
||||
public func commit(_ oid: OID) -> Result<Commit, NSError> {
|
||||
return withGitObject(oid, type: GIT_OBJ_COMMIT) { Commit($0) }
|
||||
return withGitObject(oid, type: GIT_OBJECT_COMMIT) { Commit($0) }
|
||||
}
|
||||
|
||||
/// Loads the tag with the given OID.
|
||||
@@ -301,7 +301,7 @@ public final class Repository {
|
||||
///
|
||||
/// Returns the tag if it exists, or an error.
|
||||
public func tag(_ oid: OID) -> Result<Tag, NSError> {
|
||||
return withGitObject(oid, type: GIT_OBJ_TAG) { Tag($0) }
|
||||
return withGitObject(oid, type: GIT_OBJECT_TAG) { Tag($0) }
|
||||
}
|
||||
|
||||
/// Loads the tree with the given OID.
|
||||
@@ -310,7 +310,7 @@ public final class Repository {
|
||||
///
|
||||
/// Returns the tree if it exists, or an error.
|
||||
public func tree(_ oid: OID) -> Result<Tree, NSError> {
|
||||
return withGitObject(oid, type: GIT_OBJ_TREE) { Tree($0) }
|
||||
return withGitObject(oid, type: GIT_OBJECT_TREE) { Tree($0) }
|
||||
}
|
||||
|
||||
/// Loads the referenced object from the pointer.
|
||||
@@ -588,9 +588,10 @@ public final class Repository {
|
||||
|
||||
/// Stage the file(s) under the specified path.
|
||||
public func add(path: String) -> Result<(), NSError> {
|
||||
let dir = path
|
||||
var dirPointer = UnsafeMutablePointer<Int8>(mutating: (dir as NSString).utf8String)
|
||||
var paths = git_strarray(strings: &dirPointer, count: 1)
|
||||
var dirPointer = UnsafeMutablePointer<Int8>(mutating: (path as NSString).utf8String)
|
||||
var paths = withUnsafeMutablePointer(to: &dirPointer) {
|
||||
git_strarray(strings: $0, count: 1)
|
||||
}
|
||||
return unsafeIndex().flatMap { index in
|
||||
defer { git_index_free(index) }
|
||||
let addResult = git_index_add_all(index, &paths, 0, nil, nil)
|
||||
@@ -795,7 +796,7 @@ public final class Repository {
|
||||
}
|
||||
|
||||
if oldTree != nil && newTree != nil {
|
||||
return withGitObjects([oldTree!.oid, newTree!.oid], type: GIT_OBJ_TREE) { objects in
|
||||
return withGitObjects([oldTree!.oid, newTree!.oid], type: GIT_OBJECT_TREE) { objects in
|
||||
var diff: OpaquePointer? = nil
|
||||
let diffResult = git_diff_tree_to_tree(&diff,
|
||||
self.pointer,
|
||||
@@ -805,7 +806,7 @@ public final class Repository {
|
||||
return processTreeToTreeDiff(diffResult, diff: diff)
|
||||
}
|
||||
} else if let tree = oldTree {
|
||||
return withGitObject(tree.oid, type: GIT_OBJ_TREE, transform: { tree in
|
||||
return withGitObject(tree.oid, type: GIT_OBJECT_TREE, transform: { tree in
|
||||
var diff: OpaquePointer? = nil
|
||||
let diffResult = git_diff_tree_to_tree(&diff,
|
||||
self.pointer,
|
||||
@@ -815,7 +816,7 @@ public final class Repository {
|
||||
return processTreeToTreeDiff(diffResult, diff: diff)
|
||||
})
|
||||
} else if let tree = newTree {
|
||||
return withGitObject(tree.oid, type: GIT_OBJ_TREE, transform: { tree in
|
||||
return withGitObject(tree.oid, type: GIT_OBJECT_TREE, transform: { tree in
|
||||
var diff: OpaquePointer? = nil
|
||||
let diffResult = git_diff_tree_to_tree(&diff,
|
||||
self.pointer,
|
||||
@@ -857,7 +858,7 @@ public final class Repository {
|
||||
}
|
||||
|
||||
private func safeTreeForCommitId(_ oid: OID) -> Result<Tree, NSError> {
|
||||
return withGitObject(oid, type: GIT_OBJ_COMMIT) { commit in
|
||||
return withGitObject(oid, type: GIT_OBJECT_COMMIT) { commit in
|
||||
let treeId = git_commit_tree_id(commit)
|
||||
return tree(OID(treeId!.pointee))
|
||||
}
|
||||
@@ -867,14 +868,14 @@ public final class Repository {
|
||||
private func unsafeTreeForCommitId(_ oid: OID) -> Result<OpaquePointer, NSError> {
|
||||
var commit: OpaquePointer? = nil
|
||||
var oid = oid.oid
|
||||
let commitResult = git_object_lookup(&commit, self.pointer, &oid, GIT_OBJ_COMMIT)
|
||||
let commitResult = git_object_lookup(&commit, self.pointer, &oid, GIT_OBJECT_COMMIT)
|
||||
guard commitResult == GIT_OK.rawValue else {
|
||||
return .failure(NSError(gitError: commitResult, pointOfFailure: "git_object_lookup"))
|
||||
}
|
||||
|
||||
var tree: OpaquePointer? = nil
|
||||
let treeId = git_commit_tree_id(commit)
|
||||
let treeResult = git_object_lookup(&tree, self.pointer, treeId, GIT_OBJ_TREE)
|
||||
let treeResult = git_object_lookup(&tree, self.pointer, treeId, GIT_OBJECT_TREE)
|
||||
|
||||
git_object_free(commit)
|
||||
|
||||
@@ -887,7 +888,7 @@ public final class Repository {
|
||||
|
||||
// MARK: - Status
|
||||
|
||||
public func status() -> Result<[StatusEntry], NSError> {
|
||||
public func status(options: StatusOptions = [.includeUntracked]) -> Result<[StatusEntry], NSError> {
|
||||
var returnArray = [StatusEntry]()
|
||||
|
||||
// Do this because GIT_STATUS_OPTIONS_INIT is unavailable in swift
|
||||
@@ -896,12 +897,13 @@ public final class Repository {
|
||||
guard optionsResult == GIT_OK.rawValue else {
|
||||
return .failure(NSError(gitError: optionsResult, pointOfFailure: "git_status_init_options"))
|
||||
}
|
||||
var options = pointer.move()
|
||||
var listOptions = pointer.move()
|
||||
listOptions.flags = options.rawValue
|
||||
pointer.deallocate()
|
||||
|
||||
var unsafeStatus: OpaquePointer? = nil
|
||||
defer { git_status_list_free(unsafeStatus) }
|
||||
let statusResult = git_status_list_new(&unsafeStatus, self.pointer, &options)
|
||||
let statusResult = git_status_list_new(&unsafeStatus, self.pointer, &listOptions)
|
||||
guard statusResult == GIT_OK.rawValue, let unwrapStatusResult = unsafeStatus else {
|
||||
return .failure(NSError(gitError: statusResult, pointOfFailure: "git_status_list_new"))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// Copyright © 2020 GitHub, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import Clibgit2
|
||||
import Foundation
|
||||
|
||||
public struct StatusOptions: OptionSet {
|
||||
public let rawValue: UInt32
|
||||
|
||||
public init(rawValue: UInt32) {
|
||||
self.rawValue = rawValue
|
||||
}
|
||||
|
||||
public static let includeUntracked = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_INCLUDE_UNTRACKED.rawValue
|
||||
)
|
||||
public static let includeIgnored = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_INCLUDE_IGNORED.rawValue
|
||||
)
|
||||
public static let includeUnmodified = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_INCLUDE_UNMODIFIED.rawValue
|
||||
)
|
||||
public static let excludeSubmodules = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_EXCLUDE_SUBMODULES.rawValue
|
||||
)
|
||||
public static let recurseUntrackedDirs = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS.rawValue
|
||||
)
|
||||
public static let disablePathSpecMatch = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH.rawValue
|
||||
)
|
||||
public static let recurseIgnoredDirs = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_RECURSE_IGNORED_DIRS.rawValue
|
||||
)
|
||||
public static let renamesHeadToIndex = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX.rawValue
|
||||
)
|
||||
public static let renamesIndexToWorkDir = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR.rawValue
|
||||
)
|
||||
public static let sortCasesSensitively = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_SORT_CASE_SENSITIVELY.rawValue
|
||||
)
|
||||
public static let sortCasesInSensitively = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY.rawValue
|
||||
)
|
||||
public static let renamesFromRewrites = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_RENAMES_FROM_REWRITES.rawValue
|
||||
)
|
||||
public static let noRefresh = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_NO_REFRESH.rawValue
|
||||
)
|
||||
public static let updateIndex = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_UPDATE_INDEX.rawValue
|
||||
)
|
||||
public static let includeUnreadable = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_INCLUDE_UNREADABLE.rawValue
|
||||
)
|
||||
public static let includeUnreadableAsUntracked = StatusOptions(
|
||||
rawValue: GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED.rawValue
|
||||
)
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
import Quick
|
||||
|
||||
class FixturesSpec: QuickSpec {
|
||||
override func spec() {
|
||||
override class func spec() {
|
||||
beforeSuite {
|
||||
Fixtures.sharedInstance.setUp()
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import SwiftGit2
|
||||
import Nimble
|
||||
import Quick
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
private extension Repository {
|
||||
func withGitObject<T>(_ oid: OID, transform: (OpaquePointer) -> T) -> T {
|
||||
@@ -17,7 +17,7 @@ private extension Repository {
|
||||
var oid = oid.oid
|
||||
|
||||
var pointer: OpaquePointer? = nil
|
||||
git_object_lookup(&pointer, repository, &oid, GIT_OBJ_ANY)
|
||||
git_object_lookup(&pointer, repository, &oid, GIT_OBJECT_ANY)
|
||||
let result = transform(pointer!)
|
||||
git_object_free(pointer)
|
||||
|
||||
@@ -25,8 +25,8 @@ private extension Repository {
|
||||
}
|
||||
}
|
||||
|
||||
class SignatureSpec: QuickSpec {
|
||||
override func spec() {
|
||||
class SignatureSpec: FixturesSpec {
|
||||
override class func spec() {
|
||||
describe("Signature(signature)") {
|
||||
it("should initialize its properties") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
@@ -88,7 +88,7 @@ class SignatureSpec: QuickSpec {
|
||||
}
|
||||
|
||||
class CommitSpec: QuickSpec {
|
||||
override func spec() {
|
||||
override class func spec() {
|
||||
describe("Commit(pointer)") {
|
||||
it("should initialize its properties") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
@@ -169,7 +169,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 +230,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 +281,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 +330,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
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import SwiftGit2
|
||||
import Nimble
|
||||
import Quick
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
private extension Repository {
|
||||
func withGitReference<T>(named name: String, transform: (OpaquePointer) -> T) -> T {
|
||||
@@ -24,8 +24,8 @@ private extension Repository {
|
||||
}
|
||||
}
|
||||
|
||||
class ReferenceSpec: QuickSpec {
|
||||
override func spec() {
|
||||
class ReferenceSpec: FixturesSpec {
|
||||
override class func spec() {
|
||||
describe("Reference(pointer)") {
|
||||
it("should initialize its properties") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
@@ -64,7 +64,7 @@ class ReferenceSpec: QuickSpec {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import SwiftGit2
|
||||
import Nimble
|
||||
import Quick
|
||||
import libgit2
|
||||
import Clibgit2
|
||||
|
||||
private extension Repository {
|
||||
func withGitRemote<T>(named name: String, transform: (OpaquePointer) -> T) -> T {
|
||||
@@ -24,8 +24,8 @@ private extension Repository {
|
||||
}
|
||||
}
|
||||
|
||||
class RemoteSpec: QuickSpec {
|
||||
override func spec() {
|
||||
class RemoteSpec: FixturesSpec {
|
||||
override class func spec() {
|
||||
describe("Remote(pointer)") {
|
||||
it("should initialize its properties") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
|
||||
@@ -12,8 +12,8 @@ import Quick
|
||||
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
|
||||
class RepositorySpec: QuickSpec {
|
||||
override func spec() {
|
||||
class RepositorySpec: FixturesSpec {
|
||||
override class func spec() {
|
||||
describe("Repository.Type.at(_:)") {
|
||||
it("should work if the repo exists") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
@@ -776,7 +776,7 @@ class RepositorySpec: QuickSpec {
|
||||
}
|
||||
|
||||
it("Should accurately report status for repositories with status") {
|
||||
let expectedCount = 5
|
||||
let expectedCount = 6
|
||||
let expectedNewFilePaths = [
|
||||
"stage-file-1",
|
||||
"stage-file-2",
|
||||
@@ -791,6 +791,9 @@ class RepositorySpec: QuickSpec {
|
||||
"stage-file-4",
|
||||
"stage-file-5",
|
||||
]
|
||||
let expectedUntrackedFiles = [
|
||||
"unstaged-file",
|
||||
]
|
||||
|
||||
let repoWithStatus = Fixtures.sharedInstance.repository(named: "repository-with-status")
|
||||
let branchWithStatus = repoWithStatus.localBranch(named: "master").value!
|
||||
@@ -800,16 +803,28 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
var newFilePaths: [String] = []
|
||||
for status in statuses {
|
||||
newFilePaths.append((status.headToIndex?.newFile?.path)!)
|
||||
if let path = status.headToIndex?.newFile?.path {
|
||||
newFilePaths.append(path)
|
||||
}
|
||||
}
|
||||
var oldFilePaths: [String] = []
|
||||
for status in statuses {
|
||||
oldFilePaths.append((status.headToIndex?.oldFile?.path)!)
|
||||
if let path = status.headToIndex?.oldFile?.path {
|
||||
oldFilePaths.append(path)
|
||||
}
|
||||
}
|
||||
|
||||
var newUntrackedFilePaths: [String] = []
|
||||
for status in statuses {
|
||||
if let path = status.indexToWorkDir?.newFile?.path {
|
||||
newUntrackedFilePaths.append(path)
|
||||
}
|
||||
}
|
||||
|
||||
expect(statuses.count).to(equal(expectedCount))
|
||||
expect(newFilePaths).to(equal(expectedNewFilePaths))
|
||||
expect(oldFilePaths).to(equal(expectedOldFilePaths))
|
||||
expect(newUntrackedFilePaths).to(equal(expectedUntrackedFiles))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,7 +980,7 @@ class RepositorySpec: QuickSpec {
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module libgit2 {
|
||||
module Clibgit2 {
|
||||
umbrella header "git2.h"
|
||||
|
||||
export *
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ check_deps ()
|
||||
done
|
||||
|
||||
brew_prefix=`brew --prefix`
|
||||
expected_prefix=/usr/local
|
||||
expected_prefix=/opt/homebrew
|
||||
|
||||
if [ "$brew_prefix" != "$expected_prefix" ]
|
||||
then
|
||||
|
||||
+2
-2
@@ -69,8 +69,8 @@ elif [ "$SCHEME" == "SwiftGit2-iOS" ]; then
|
||||
# "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-5
|
||||
RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.iOS-10-2
|
||||
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..."
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# augment path to help it find cmake via homebrew
|
||||
PATH="/opt/homebrew/bin:/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:/opt/boxen/homebrew/bin:$PATH"
|
||||
|
||||
pushd "$SCRIPT_DIR/.." > /dev/null
|
||||
ROOT_PATH="$PWD"
|
||||
popd > /dev/null
|
||||
@@ -22,7 +20,7 @@ function setup_build_environment ()
|
||||
MACOSX_DEPLOYMENT_TARGET=""
|
||||
|
||||
XCODE_MAJOR_VERSION=$(xcode_major_version)
|
||||
|
||||
|
||||
CAN_BUILD_64BIT="0"
|
||||
|
||||
# If IPHONEOS_DEPLOYMENT_TARGET has not been specified
|
||||
@@ -30,28 +28,30 @@ function setup_build_environment ()
|
||||
# directly (ie not from an Xcode proj)
|
||||
if [ -z "${IPHONEOS_DEPLOYMENT_TARGET}" ]
|
||||
then
|
||||
IPHONEOS_DEPLOYMENT_TARGET="6.0"
|
||||
IPHONEOS_DEPLOYMENT_TARGET="12.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"
|
||||
ARCHS=""
|
||||
if [ "${CAN_BUILD_64BIT}" -eq "1" ]
|
||||
then
|
||||
# For some stupid reason cmake needs simulator
|
||||
# builds to be first
|
||||
ARCHS="x86_64 ${ARCHS} arm64"
|
||||
else
|
||||
ARCHS="i386 ${ARCHS} armv7 armv7s"
|
||||
fi
|
||||
}
|
||||
|
||||
function build_all_archs ()
|
||||
{
|
||||
setup_build_environment
|
||||
|
||||
|
||||
local setup=$1
|
||||
local build_arch=$2
|
||||
local finish_build=$3
|
||||
@@ -63,11 +63,15 @@ function build_all_archs ()
|
||||
|
||||
for ARCH in ${ARCHS}
|
||||
do
|
||||
if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]
|
||||
PLATFORMS=""
|
||||
if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ] || [ "${ARCH}" == "arm64" ]
|
||||
then
|
||||
PLATFORM="iphonesimulator"
|
||||
else
|
||||
PLATFORM="iphoneos"
|
||||
PLATFORMS="${PLATFORMS} iphonesimulator"
|
||||
fi
|
||||
|
||||
if [ "${ARCH}" == "arm64" ]
|
||||
then
|
||||
PLATFORMS="${PLATFORMS} iphoneos"
|
||||
fi
|
||||
|
||||
SDKVERSION=$(ios_sdk_version)
|
||||
@@ -79,17 +83,21 @@ function build_all_archs ()
|
||||
HOST="${ARCH}-apple-darwin"
|
||||
fi
|
||||
|
||||
SDKNAME="${PLATFORM}${SDKVERSION}"
|
||||
SDKROOT="$(ios_sdk_path ${SDKNAME})"
|
||||
|
||||
echo "Building ${LIBRARY_NAME} for ${SDKNAME} ${ARCH}"
|
||||
echo "Please stand by..."
|
||||
echo "Building ${ARCH} for ${PLATFORMS}"
|
||||
|
||||
# run the per arch build command
|
||||
eval $build_arch
|
||||
for PLATFORM in ${PLATFORMS}
|
||||
do
|
||||
SDKNAME="${PLATFORM}${SDKVERSION}"
|
||||
SDKROOT="$(sdk_path ${SDKNAME})"
|
||||
|
||||
echo "Building ${LIBRARY_NAME} for ${SDKNAME} ${ARCH} on ${PLATFORM}"
|
||||
echo "Please stand by..."
|
||||
|
||||
# run the per arch build command
|
||||
eval $build_arch
|
||||
done
|
||||
done
|
||||
|
||||
# finish the build (usually lipo)
|
||||
eval $finish_build
|
||||
}
|
||||
|
||||
|
||||
+102
-26
@@ -1,38 +1,114 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
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"
|
||||
# augment path to help it find cmake via homebrew
|
||||
PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
|
||||
if [ "External/libgit2.a" -nt "External/libgit2" ]
|
||||
then
|
||||
echo "No update needed."
|
||||
exit 0
|
||||
fi
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
source "${SCRIPT_DIR}/xcode_functions.sh"
|
||||
|
||||
cd "External/libgit2"
|
||||
function setup_build_environment ()
|
||||
{
|
||||
pushd "$SCRIPT_DIR/.." > /dev/null
|
||||
ROOT_PATH="$PWD"
|
||||
popd > /dev/null
|
||||
|
||||
if [ -d "build" ]; then
|
||||
CLANG="/usr/bin/xcrun clang"
|
||||
CC="${CLANG}"
|
||||
CPP="${CLANG} -E"
|
||||
|
||||
MACOSX_DEPLOYMENT_TARGET="10.13"
|
||||
|
||||
XCODE_MAJOR_VERSION=$(xcode_major_version)
|
||||
XCODE_MINOR_VERSION=$(xcode_minor_version)
|
||||
|
||||
if [ "${XCODE_MAJOR_VERSION}" -lt "14" ]
|
||||
then
|
||||
echo "Requires Xcode 14 or newer."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCHS="x86_64 arm64"
|
||||
}
|
||||
|
||||
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"
|
||||
fi
|
||||
mkdir "build"
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
pushd "build" > /dev/null
|
||||
|
||||
cmake -DBUILD_SHARED_LIBS:BOOL=OFF \
|
||||
-DLIBSSH2_INCLUDE_DIRS:PATH=/usr/local/include/ \
|
||||
-DBUILD_CLAR:BOOL=OFF \
|
||||
-DTHREADSAFE:BOOL=ON \
|
||||
..
|
||||
cmake --build .
|
||||
# install the each built arch somewhere sane
|
||||
INSTALL_PREFIX="${LIB_PATH}/${SDKNAME}-${ARCH}.sdk"
|
||||
|
||||
product="libgit2.a"
|
||||
install_path="../../${product}"
|
||||
if [ "${product}" -nt "${install_path}" ]; then
|
||||
cp -v "${product}" "${install_path}"
|
||||
fi
|
||||
mkdir -p "${INSTALL_PREFIX}"
|
||||
|
||||
LOG="${INSTALL_PREFIX}/build-libgit2.log"
|
||||
echo "$LOG"
|
||||
|
||||
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}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="${MACOSX_DEPLOYMENT_TARGET}" \
|
||||
.. >> "${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
|
||||
}
|
||||
|
||||
setup_build_environment
|
||||
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
|
||||
build_libgit2
|
||||
done
|
||||
|
||||
fat_binary
|
||||
|
||||
echo "libgit2 has been updated."
|
||||
|
||||
@@ -8,7 +8,7 @@ source "${SCRIPT_DIR}/ios_build_functions.sh"
|
||||
|
||||
function setup ()
|
||||
{
|
||||
if [ "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" -nt "${ROOT_PATH}/External/libgit2" ]
|
||||
if [ "${ROOT_PATH}/External/libgit2-ios/libgit2.xcframework" -nt "${ROOT_PATH}/External/libgit2" ]
|
||||
then
|
||||
echo "No update needed."
|
||||
exit 0
|
||||
@@ -49,11 +49,14 @@ function build_libgit2 ()
|
||||
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH:BOOL=ON \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}/" \
|
||||
-DBUILD_CLAR:BOOL=OFF \
|
||||
-DBUILD_TESTS:BOOL=OFF \
|
||||
-DREGEX_BACKEND:STRING="builtin" \
|
||||
-DTHREADSAFE:BOOL=ON \
|
||||
-DCURL:BOOL=OFF \
|
||||
-DCMAKE_C_FLAGS:STRING="-fembed-bitcode" \
|
||||
"${SYS_ROOT}" \
|
||||
-DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="${IPHONEOS_DEPLOYMENT_TARGET}" \
|
||||
.. >> "${LOG}" 2>&1
|
||||
cmake --build . --target install >> "${LOG}" 2>&1
|
||||
|
||||
@@ -64,13 +67,72 @@ function build_libgit2 ()
|
||||
|
||||
function fat_binary ()
|
||||
{
|
||||
echo "Building fat binary..."
|
||||
echo "Building fat binary for simulator..."
|
||||
|
||||
lipo -create "${BUILT_LIB_PATHS[@]}" -output "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a"
|
||||
# Collect all simulator build paths
|
||||
for path in "${BUILT_LIB_PATHS[@]}"
|
||||
do
|
||||
case "$path" in
|
||||
*libgit2-ios/iphonesimulator* )
|
||||
SIMULATOR_LIB_PATHS+=("$path")
|
||||
# Remember one header location (headers are the same, so overwriting doesn't matter)
|
||||
base_dir=$(dirname $(dirname "${path}"))
|
||||
HEADER_PATH="${base_dir}/include/git2.h"
|
||||
;;
|
||||
* )
|
||||
# Ignore libs build for the actual phone
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
SIMULATOR_LIB_DIR="${ROOT_PATH}/External/libgit2-ios/iphonesimulator"
|
||||
mkdir -p "${SIMULATOR_LIB_DIR}"
|
||||
|
||||
echo "... from ${SIMULATOR_LIB_PATHS[@]}"
|
||||
lipo -create "${SIMULATOR_LIB_PATHS[@]}" -output "${SIMULATOR_LIB_DIR}/libgit2.a"
|
||||
|
||||
echo "Copying shared simulator header from ${HEADER_PATH}"
|
||||
cp "${HEADER_PATH}" "${SIMULATOR_LIB_DIR}/libgit2.h"
|
||||
|
||||
echo "Building done."
|
||||
}
|
||||
|
||||
function xcframework ()
|
||||
{
|
||||
echo "Building XCFramework..."
|
||||
|
||||
for path in "${BUILT_LIB_PATHS[@]}"
|
||||
do
|
||||
case "$path" in
|
||||
*libgit2-ios/iphonesimulator* )
|
||||
# Skip simulator library binaries
|
||||
;;
|
||||
* )
|
||||
args+=("-library" "${path}")
|
||||
base_dir=$(dirname $(dirname "${path}"))
|
||||
args+=("-headers" "${base_dir}/include/git2.h")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
args+=("-library" "${SIMULATOR_LIB_DIR}/libgit2.a")
|
||||
args+=("-headers" "${SIMULATOR_LIB_DIR}/libgit2.h")
|
||||
|
||||
echo "... from ${args[@]}"
|
||||
xcodebuild -create-xcframework \
|
||||
"${args[@]}" \
|
||||
-output "${ROOT_PATH}/External/libgit2-ios/libgit2.xcframework"
|
||||
|
||||
echo "Building done."
|
||||
}
|
||||
|
||||
|
||||
function combine_all_the_binaries ()
|
||||
{
|
||||
fat_binary
|
||||
xcframework
|
||||
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
build_all_archs setup build_libgit2 fat_binary
|
||||
build_all_archs setup build_libgit2 combine_all_the_binaries
|
||||
|
||||
@@ -16,7 +16,7 @@ function setup ()
|
||||
LIBRARY_NAME="libssh2"
|
||||
}
|
||||
|
||||
function build_ssh2 ()
|
||||
function build_ssh2 ()
|
||||
{
|
||||
mkdir -p "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/src"
|
||||
|
||||
@@ -47,7 +47,7 @@ function 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/"
|
||||
cp -R "${ROOT_PATH}/External/libssh2-ios/bin/iphonesimulator${SDKVERSION}-x86_64.sdk/include/libssh2.h" "${ROOT_PATH}/External/libssh2-ios/include/libssh2/"
|
||||
|
||||
echo "Building done."
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@ 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 ()
|
||||
{
|
||||
@@ -26,11 +31,22 @@ function ios_sdk_version ()
|
||||
# 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 }'
|
||||
/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 ios_sdk_path ()
|
||||
function sdk_path ()
|
||||
{
|
||||
/usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -i $1 | grep 'Path:' | awk '{ print $2 }'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user