Skip to content

Commit c6f23c3

Browse files
lolgearCykelero
authored andcommitted
Scripts. Update-Xcode should enable mandatory option git_ssh. (#8)
* scripts: update-xcode mandatory git_ssh option has been added. * scripts: update-xcode cleanup.
1 parent bf113b6 commit c6f23c3

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

update-xcode.sh

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
#!/bin/sh
22

3-
SHOULD_OPEN_XCODE=$1
3+
SCRIPT_DIRECTORY=$(dirname $0)
44

5-
export MACOSX_DEPLOYMENT_TARGET=10.10 # Must match GitUp
5+
rm -rf "$SCRIPT_DIRECTORY/xcode"
6+
mkdir "$SCRIPT_DIRECTORY/xcode"
67

7-
rm -rf "xcode"
8-
mkdir "xcode"
9-
cd "xcode"
10-
cmake -G "Xcode" ..
8+
MACOSX_DEPLOYMENT_TARGET=10.10 cmake -S "$SCRIPT_DIRECTORY" -B "$SCRIPT_DIRECTORY/xcode" -G "Xcode"
119

12-
# We should copy a features.h file
10+
# We should copy a features.h file
1311
# from ./xcode/src/git2/sys/features.h
1412
# to ./git2/sys/features.h
1513

16-
cd ../
17-
mv "./xcode/src/git2/sys/features.h" "./include/git2/sys/features.h"
14+
mv "$SCRIPT_DIRECTORY/xcode/src/git2/sys/features.h" "$SCRIPT_DIRECTORY/include/git2/sys/features.h"
1815

19-
# And open Xcode if needed.
20-
if [ -z "$SHOULD_OPEN_XCODE" ]
21-
then
22-
echo "Run Xcode if you need 'xed ./xcode/libgit2.xcodeproj'"
23-
else
24-
open "./xcode/libgit2.xcodeproj"
16+
# And also add GIT_SSH and GIT_SSH_MEMORY_CREDENTIALS
17+
# We should add them via Package.swift, but let's do it after SPM adds plugin support.
18+
file="$SCRIPT_DIRECTORY/include/git2/sys/features.h"
19+
20+
if ! grep -q "#define GIT_SSH_MEMORY_CREDENTIALS\b" "$file" ; then
21+
echo "#define GIT_SSH_MEMORY_CREDENTIALS 1" >> "$file"
22+
fi
23+
24+
if ! grep -q "#define GIT_SSH\b" "$file" ; then
25+
echo "#define GIT_SSH 1" >> "$file"
2526
fi

0 commit comments

Comments
 (0)