Welcome to mirror list, hosted at ThFree Co, Russian Federation.

build.sh « netcore - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 899dc0b09f33724273cfee26ecf274fedb78ca6a (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env bash

# Stop script if unbound variable found (use ${var:-} if intentional)
set -u

# Stop script if command returns non-zero exit code.
# Prevents hidden errors caused by missing error code propagation.
set -e

usage()
{
  echo "Common settings:"
  echo "  --configuration <value>    Build configuration: 'Debug' or 'Release' (short: -c)"
  echo "  --help                     Print help and exit (short: -h)"
  echo ""

  echo "Actions:"
  echo "  --pack                     Package build outputs into NuGet packages"
  echo "  --test                     Run all unit tests in the solution (short: -t)"
  echo "  --rebuild                  Run ../.autogen.sh"
  echo "  --llvm                     Enable LLVM support"
  echo "  --skipnative               Do not build runtime"
  echo "  --skipmscorlib             Do not build System.Private.CoreLib"
  echo ""

  echo "Command line arguments starting with '/p:' are passed through to MSBuild."
  echo "Arguments can also be passed in with a single hyphen."
}

pack=false
configuration='Debug'
properties=''
force_rebuild=false
test=false
skipmscorlib=false
skipnative=false
autogen_params=''

while [[ $# > 0 ]]; do
  opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
  case "$opt" in
    -help|-h)
      usage
      exit 0
      ;;
    -configuration|-c)
      properties="$properties $1 $2"
      configuration=$2
      shift
      ;;
    -pack)
      pack=true
      ;;
    -test|-t)
      test=true
      ;;
    -rebuild)
      force_rebuild=true
      ;;
    -skipmscorlib)
      skipmscorlib=true
      ;;
    -skipnative)
      skipnative=true
      ;;
    -llvm)
      autogen_params="$autogen_params --enable-llvm"
      ;;
    -p:*|/p:*)
      properties="$properties $1"
      ;;
    -m:*|/m:*)
      properties="$properties $1"
      ;;
    -bl:*|/bl:*)
      properties="$properties $1"
      ;;
    -dl:*|/dl:*)
      properties="$properties $1"
      ;;
    *)
      echo "Invalid argument: $1"
      usage
      exit 1
      ;;
  esac

  shift
done

CPU_COUNT=$(getconf _NPROCESSORS_ONLN || echo 4)

# run .././autogen.sh only once or if "--rebuild" argument is provided
if [[ "$force_rebuild" == "true" || ! -f .configured ]]; then
  (cd .. && ./autogen.sh --with-core=only $autogen_params)
  touch .configured
fi

# build mono runtime
if [ "$skipnative" = "false" ]; then
  make runtime -j$CPU_COUNT
fi

# build System.Private.CoreLib (../mcs/class/System.Private.CoreLib)
if [ "$skipmscorlib" = "false" ]; then
  make bcl CORLIB_BUILD_FLAGS="$properties"
fi

# create a nupkg with runtime and System.Private.CoreLib
if [ "$pack" = "true" ]; then
  make nupkg
fi

# run all xunit tests
if [ "$test" = "true" ]; then
  make update-tests-corefx
  for testdir in corefx/tests/extracted/*; do
    ../scripts/ci/./run-step.sh --label=$(basename $testdir) --timeout=15m make run-tests-corefx-$(basename $testdir)
  done
fi