-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23180 from khyperia/build_sh
Create build.sh
- Loading branch information
Showing
3 changed files
with
131 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
# Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
set -e | ||
set -u | ||
|
||
usage() | ||
{ | ||
echo "Main interface to running builds on Mac/Linux" | ||
echo "Usage: build.sh [options]" | ||
echo "" | ||
echo "Options" | ||
echo " --debug Build Debug (default)" | ||
echo " --release Build Release" | ||
echo " --restore Restore projects required to build" | ||
echo " --build Build all projects" | ||
echo " --test Run unit tests" | ||
echo " --build-bootstrap Build the bootstrap compilers" | ||
echo " --use-bootstrap Use the built bootstrap compilers when running main build" | ||
echo " --bootstrap Implies --build-bootstrap and --use-bootstrap" | ||
} | ||
|
||
this_dir="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
source "${this_dir}"/build/scripts/build-utils.sh | ||
root_path="$(get_repo_dir)" | ||
binaries_path="${root_path}"/Binaries | ||
bootstrap_path="${binaries_path}"/Bootstrap | ||
bootstrap_framework=netcoreapp2.0 | ||
|
||
build_configuration=Debug | ||
restore=false | ||
build=false | ||
test_=false | ||
build_bootstrap=false | ||
use_bootstrap=false | ||
|
||
# LTTNG is the logging infrastructure used by coreclr. Need this variable set | ||
# so it doesn't output warnings to the console. | ||
export LTTNG_HOME="$HOME" | ||
|
||
while [[ $# > 0 ]] | ||
do | ||
opt="$(echo "$1" | awk '{print tolower($0)}')" | ||
case "$opt" in | ||
-h|--help) | ||
usage | ||
exit 1 | ||
;; | ||
--debug) | ||
build_configuration=Debug | ||
shift 1 | ||
;; | ||
--release) | ||
build_configuration=Release | ||
shift 1 | ||
;; | ||
--restore) | ||
restore=true | ||
shift 1 | ||
;; | ||
--build) | ||
build=true | ||
shift 1 | ||
;; | ||
--test) | ||
test_=true | ||
shift 1 | ||
;; | ||
--build-bootstrap) | ||
build_bootstrap=true | ||
shift 1 | ||
;; | ||
--use-bootstrap) | ||
use_bootstrap=true | ||
shift 1 | ||
;; | ||
--bootstrap) | ||
build_bootstrap=true | ||
use_bootstrap=true | ||
shift 1 | ||
;; | ||
*) | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [[ "$restore" == true ]] | ||
then | ||
"${root_path}"/build/scripts/restore.sh | ||
fi | ||
|
||
build_args="--no-restore -c ${build_configuration} /nologo /maxcpucount:1" | ||
|
||
if [[ "$build_bootstrap" == true ]] | ||
then | ||
echo "Building bootstrap toolset" | ||
bootstrap_build_args="${build_args} /p:UseShippingAssemblyVersion=true /p:InitialDefineConstants=BOOTSTRAP" | ||
dotnet publish "${root_path}"/src/Compilers/CSharp/csc -o "${bootstrap_path}/bincore" --framework ${bootstrap_framework} ${bootstrap_build_args} "/bl:${binaries_path}/BootstrapCsc.binlog" | ||
dotnet publish "${root_path}"/src/Compilers/VisualBasic/vbc -o "${bootstrap_path}/bincore" --framework ${bootstrap_framework} ${bootstrap_build_args} "/bl:${binaries_path}/BootstrapVbc.binlog" | ||
dotnet publish "${root_path}"/src/Compilers/Server/VBCSCompiler -o "${bootstrap_path}/bincore" --framework ${bootstrap_framework} ${bootstrap_build_args} "/bl:${binaries_path}/BootstrapVBCSCompiler.binlog" | ||
dotnet publish "${root_path}"/src/Compilers/Core/MSBuildTask -o "${bootstrap_path}" ${bootstrap_build_args} "/bl:${binaries_path}/BoostrapMSBuildTask.binlog" | ||
fi | ||
|
||
if [[ "${use_bootstrap}" == true ]] | ||
then | ||
build_args+=" /p:BootstrapBuildPath=${bootstrap_path}" | ||
fi | ||
|
||
if [[ "${build}" == true ]] | ||
then | ||
echo "Building Compilers.sln" | ||
dotnet build "${root_path}"/Compilers.sln ${build_args} "/bl:${binaries_path}/Build.binlog" | ||
fi | ||
|
||
if [[ "${test_}" == true ]] | ||
then | ||
"${root_path}"/build/scripts/tests.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters