-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·50 lines (39 loc) · 1.29 KB
/
build.sh
File metadata and controls
executable file
·50 lines (39 loc) · 1.29 KB
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
#! /usr/bin/env bash
set -e
buildCiRunNumber=${1:-0}
buildCiBranchSuffix=${2:-}
buildCiBranchSuffix=$(echo "$buildCiBranchSuffix" | sed 's/[^a-zA-Z]/-/g')
echo "Build number: $buildCiRunNumber"
echo "Branch suffix: $buildCiBranchSuffix"
# Check for the programs we need to do the build
if ! (which git && which cargo && which dotnet)>/dev/null
then
echo "git, cargo and dotnet are rquired for compilation" 1>&2
exit 1
fi
# Work out the platform we are building on, and the RID which goes
# along with it.
case `uname` in
Darwin) rid="osx"
platform="Darwin"
;;
Linux) rid="linux"
platform="Linux"
;;
*) echo "Unrecognised platform `uname`" 1>&2
exit 1;
;;
esac
# log out the RID decided on
echo "Compiling for $rid on $platform"
# Make sure the source is up to date
git submodule init && git submodule update
# Ask cargo to build us the libary. We only care about the
# regex-capi part of the crate.
(cd rure/regex-capi/ && cargo build --release)
# create a folder for the package to reside in
rm -rf runtimes
mkdir -p runtimes/$rid/native/
cp -r rure/target/release/librure* runtimes/$rid/native/
# Pack it all up
dotnet pack IronRure.Batteries-$platform.csproj -c Release -o bin/artifacts /p:BuildCiRunNumber=${buildCiRunNumber} /p:BuildCiBranchSuffix=${buildCiBranchSuffix}