@@ -17,47 +17,100 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
17
17
usage ()
18
18
{
19
19
echo " Common settings:"
20
- echo " --subset Build a subset, print available subsets with -subset help (short: -s)"
21
- echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS"
22
- echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm"
23
- echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)"
24
- echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)"
25
- echo " --librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)"
26
- echo " --projects <value> Project or solution file(s) to build"
27
- echo " --verbosity MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
28
- echo " --binaryLog Output binary log (short: -bl)"
29
- echo " --cross Optional argument to signify cross compilation"
30
- echo " --help Print help and exit (short: -h)"
20
+ echo " --arch Target platform: x86, x64, arm, armel, arm64 or wasm."
21
+ echo " [Default: Your machine's architecture.]"
22
+ echo " --binaryLog (-bl) Output binary log."
23
+ echo " --cross Optional argument to signify cross compilation."
24
+ echo " --configuration (-c) Build configuration: Debug, Release or Checked."
25
+ echo " Checked is exclusive to the CLR subset. It is the same as Debug, except code is"
26
+ echo " compiled with optimizations enabled."
27
+ echo " [Default: Debug]"
28
+ echo " --help (-h) Print help and exit."
29
+ echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release."
30
+ echo " [Default: Debug]"
31
+ echo " --os Target operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android,"
32
+ echo " Browser, NetBSD or SunOS."
33
+ echo " [Default: Your machine's OS.]"
34
+ echo " --projects <value> Project or solution file(s) to build."
35
+ echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked."
36
+ echo " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is"
37
+ echo " compiled with optimizations enabled."
38
+ echo " [Default: Debug]"
39
+ echo " --subset (-s) Build a subset, print available subsets with -subset help."
40
+ echo " '--subset' can be omitted if the subset is given as the first argument."
41
+ echo " [Default: Builds the entire repo.]"
42
+ echo " --verbosity (-v) MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]."
43
+ echo " [Default: Minimal]"
31
44
echo " "
32
45
33
46
echo " Actions (defaults to --restore --build):"
34
- echo " --restore Restore dependencies (short: -r)"
35
- echo " --build Build all source projects (short: -b)"
36
- echo " --rebuild Rebuild all source projects"
37
- echo " --test Build and run tests (short: -t)"
38
- echo " --pack Package build outputs into NuGet packages"
39
- echo " --sign Sign build outputs"
40
- echo " --publish Publish artifacts (e.g. symbols)"
41
- echo " --clean Clean the solution"
47
+ echo " --build (-b) Build all source projects."
48
+ echo " This assumes --restore has been run already."
49
+ echo " --clean Clean the solution."
50
+ echo " --pack Package build outputs into NuGet packages."
51
+ echo " --publish Publish artifacts (e.g. symbols)."
52
+ echo " This assumes --build has been run already."
53
+ echo " --rebuild Rebuild all source projects."
54
+ echo " --restore (-r) Restore dependencies."
55
+ echo " --sign Sign build outputs."
56
+ echo " --test (-t) Incrementally builds and runs tests."
57
+ echo " Use in conjuction with --testnobuild to only run tests."
42
58
echo " "
43
59
44
60
echo " Libraries settings:"
45
- echo " --framework Build framework: net5.0 or net472 (short: -f)"
46
- echo " --coverage Collect code coverage when testing"
47
- echo " --testscope Test scope, allowed values: innerloop, outerloop, all"
48
- echo " --testnobuild Skip building tests when invoking -test"
49
- echo " --allconfigurations Build packages for all build configurations"
61
+ echo " --allconfigurations Build packages for all build configurations."
62
+ echo " --coverage Collect code coverage when testing."
63
+ echo " --framework (-f) Build framework: net5.0 or net472."
64
+ echo " [Default: net5.0]"
65
+ echo " --testnobuild Skip building tests when invoking -test."
66
+ echo " --testscope Test scope, allowed values: innerloop, outerloop, all."
50
67
echo " "
51
68
52
69
echo " Native build settings:"
53
- echo " --clang Optional argument to build using clang in PATH (default)"
54
- echo " --clangx.y Optional argument to build using clang version x.y"
70
+ echo " --clang Optional argument to build using clang in PATH (default)."
71
+ echo " --clangx Optional argument to build using clang version x (used for Clang 7 and newer)."
72
+ echo " --clangx.y Optional argument to build using clang version x.y (used for Clang 6 and older)."
55
73
echo " --cmakeargs User-settable additional arguments passed to CMake."
56
- echo " --gcc Optional argument to build using gcc in PATH (default)"
57
- echo " --gccx.y Optional argument to build using gcc version x.y"
74
+ echo " --gcc Optional argument to build using gcc in PATH (default)."
75
+ echo " --gccx.y Optional argument to build using gcc version x.y."
76
+ echo " "
58
77
59
78
echo " Command line arguments starting with '/p:' are passed through to MSBuild."
60
79
echo " Arguments can also be passed in with a single hyphen."
80
+ echo " "
81
+
82
+ echo " Here are some quick examples. These assume you are on a Linux x64 machine:"
83
+ echo " "
84
+ echo " * Build CoreCLR for Linux x64 on Release configuration:"
85
+ echo " ./build.sh clr -c release"
86
+ echo " "
87
+ echo " * Build Debug libraries with a Release runtime for Linux x64."
88
+ echo " ./build.sh clr+libs -rc release"
89
+ echo " "
90
+ echo " * Build Release libraries and their tests with a Checked runtime for Linux x64, and run the tests."
91
+ echo " ./build.sh clr+libs+libs.tests -rc checked -lc release -test"
92
+ echo " "
93
+ echo " * Build CoreCLR for Linux x64 on Debug configuration using Clang 9."
94
+ echo " ./build.sh clr -clang9"
95
+ echo " "
96
+ echo " * Build CoreCLR for Linux x64 on Debug configuration using GCC 8.4."
97
+ echo " ./build.sh clr -gcc8.4"
98
+ echo " "
99
+ echo " * Cross-compile CoreCLR runtime for Linux ARM64 on Release configuration."
100
+ echo " ./build.sh clr.runtime -arch arm64 -c release -cross"
101
+ echo " "
102
+ echo " However, for this example, you need to already have ROOTFS_DIR set up."
103
+ echo " Further information on this can be found here:"
104
+ echo " https://github.com/dotnet/runtime/blob/master/docs/workflow/building/coreclr/linux-instructions.md"
105
+ echo " "
106
+ echo " * Build Mono runtime for Linux x64 on Release configuration."
107
+ echo " ./build.sh mono -c release"
108
+ echo " "
109
+ echo " It's important to mention that to build Mono for the first time,"
110
+ echo " you need to build the CLR and Libs subsets beforehand."
111
+ echo " This is done automatically if a full build is performed at first."
112
+ echo " "
113
+ echo " For more general information, check out https://github.com/dotnet/runtime/blob/master/docs/workflow/README.md"
61
114
}
62
115
63
116
initDistroRid ()
@@ -79,6 +132,11 @@ initDistroRid()
79
132
initDistroRidGlobal ${targetOs} ${buildArch} ${isPortableBuild} ${passedRootfsDir}
80
133
}
81
134
135
+ showSubsetHelp ()
136
+ {
137
+ " $scriptroot /common/build.sh" " -restore" " -build" " /p:Subset=help" " /clp:nosummary"
138
+ }
139
+
82
140
arguments=' '
83
141
cmakeargs=' '
84
142
extraargs=' '
@@ -95,6 +153,11 @@ while [[ $# > 0 ]]; do
95
153
opt=" $( echo " ${1/# --/ -} " | awk ' {print tolower($0)}' ) "
96
154
97
155
if [[ $firstArgumentChecked -eq 0 && $opt =~ ^[a-zA-Z.+]+$ ]]; then
156
+ if [ $opt == " help" ]; then
157
+ showSubsetHelp
158
+ exit 0
159
+ fi
160
+
98
161
arguments=" $arguments /p:Subset=$1 "
99
162
shift 1
100
163
continue
@@ -110,9 +173,14 @@ while [[ $# > 0 ]]; do
110
173
111
174
-subset|-s)
112
175
if [ -z ${2+x} ]; then
113
- arguments= " $arguments /p:Subset=help "
114
- shift 1
176
+ showSubsetHelp
177
+ exit 0
115
178
else
179
+ passedSubset=" $( echo " $2 " | awk ' {print tolower($0)}' ) "
180
+ if [ $passedSubset == " help" ]; then
181
+ showSubsetHelp
182
+ exit 0
183
+ fi
116
184
arguments=" $arguments /p:Subset=$2 "
117
185
shift 2
118
186
fi
0 commit comments