-
Notifications
You must be signed in to change notification settings - Fork 448
/
package.sh
executable file
·67 lines (57 loc) · 1.51 KB
/
package.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh -eu
Configuration="Release"
if [ $# -lt 1 ]; then
echo "Need path to Unity"
exit 1
fi
if [ $# -gt 1 ]; then
case x"$2" in
xdebug | xDebug)
Configuration="Debug"
;;
esac
fi
pushd unity/PackageProject/Assets
git clean -xdf
popd
pushd src
git clean -xdf
popd
OS="Mac"
if [ -e "c:\\" ]; then
OS="Windows"
fi
if [ x"$OS" == x"Windows" ]; then
if [ -f "$1/Editor/Unity.exe" ]; then
Unity="$1/Editor/Unity.exe"
else
echo "Can't find Unity in $1"
exit 1
fi
else
if [ -f "$1/Unity.app/Contents/MacOS/Unity" ]; then
Unity="$1/Unity.app/Contents/MacOS/Unity"
elif [ -f "$1/Unity" ]; then
Unity="$1/Unity"
else
echo "Can't find Unity in $1"
exit 1
fi
fi
if [ x"$OS" == x"Windows" ]; then
common/nuget restore GitHub.Unity.sln
else
nuget restore GitHub.Unity.sln
fi
xbuild GitHub.Unity.sln /property:Configuration=$Configuration
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/deleteme*
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.pdb
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.pdb.meta
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.xml
Version=`sed -En 's,.*GitHubForUnityVersion = "(.*)".*,\1,p' common/SolutionInfo.cs`
commitcount=`git rev-list --count HEAD`
commit=`git log -n1 --pretty=format:%h`
Version="${Version}.${commitcount}-${commit}"
Version=$Version
export GITHUB_UNITY_DISABLE=1
"$Unity" -batchmode -projectPath "`pwd`/unity/PackageProject" -exportPackage Assets/Plugins/GitHub/Editor github-for-unity-$Version.unitypackage -force-free -quit