-
Notifications
You must be signed in to change notification settings - Fork 514
/
create-make-config.sh
executable file
·45 lines (34 loc) · 1.76 KB
/
create-make-config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash -eu
set -o pipefail
IFS=$'\n\t '
OUTPUT=Make.config.inc
OUTPUT_FILE=Make.config.inc.tmp
rm -f "$OUTPUT_FILE" "$OUTPUT"
LANG=C
export LANG
# Compute commit distances
printf "IOS_COMMIT_DISTANCE:=$(git log $(git blame -- ./Make.versions HEAD | grep IOS_PACKAGE_VERSION= | sed 's/ .*//' )..HEAD --oneline | wc -l | sed 's/ //g')\n" >> "$OUTPUT_FILE"
printf "MAC_COMMIT_DISTANCE:=$(git log $(git blame -- ./Make.versions HEAD | grep MAC_PACKAGE_VERSION= | sed 's/ .*//' )..HEAD --oneline | wc -l | sed 's/ //g')\n" >> "$OUTPUT_FILE"
for platform in $ALL_DOTNET_PLATFORMS; do
PLATFORM=$(echo "$platform" | tr '[:lower:]' '[:upper:]')
COMMIT=$(git blame -- ./Make.versions HEAD | grep "${PLATFORM}_NUGET_OS_VERSION=" | sed 's/ .*//')
COMMIT_DISTANCE=$(git log "$COMMIT..HEAD" --oneline | wc -l | sed -e 's/ //g')
TOTAL_DISTANCE=$((NUGET_VERSION_COMMIT_DISTANCE_START+COMMIT_DISTANCE))
printf "${PLATFORM}_NUGET_COMMIT_DISTANCE:=$TOTAL_DISTANCE\\n" >> "$OUTPUT_FILE"
done
STABLE_COMMIT=$(git blame -L '/^[#[:blank:]]*NUGET_RELEASE_BRANCH=/,+1' -- ./Make.config HEAD | sed 's/ .*//')
STABLE_COMMIT_DISTANCE=$(git log "$STABLE_COMMIT..HEAD" --oneline | wc -l | sed -e 's/ //g')
STABLE_TOTAL_DISTANCE=$((STABLE_COMMIT_DISTANCE+NUGET_VERSION_STABLE_COMMIT_DISTANCE_START))
printf "NUGET_STABLE_COMMIT_DISTANCE:=$STABLE_TOTAL_DISTANCE\\n" >> "$OUTPUT_FILE"
# Detect ccache
if which ccache > /dev/null 2>&1; then
printf "ENABLE_CCACHE=1\n" >> "$OUTPUT_FILE"
printf "export CCACHE_BASEDIR=$(cd .. && pwd)\n" >> "$OUTPUT_FILE"
echo "Found ccache on the system, enabling it"
fi
# Detect maccore / xamarin
if test -d ../maccore; then
printf "ENABLE_XAMARIN=1\n" >> "$OUTPUT_FILE"
echo "Detected the maccore repository, automatically enabled the Xamarin build"
fi
mv "$OUTPUT_FILE" "$OUTPUT"