Add build.sh for non-Windows builds

Update docs building on non-Windows operating systems.
This commit is contained in:
Alexander Köplinger 2021-07-19 11:25:37 +02:00 коммит произвёл Matt Connew
Родитель 72e4a35229
Коммит eae4527694
5 изменённых файлов: 104 добавлений и 75 удалений

Просмотреть файл

@ -17,8 +17,8 @@ Following are just quick summaries of those steps.
Building the WCF product and running the unit tests can be done with just these scripts from the root of the GitHub repo:
```
./clean.sh -all
./build.sh
./build.sh -test
```
This will build the product from scratch, run all the unit tests, and place all the results in the file `msbuild.log`
@ -31,7 +31,6 @@ To run the scenario tests ("OuterLoops") cross platform, you must first ensure t
Then on the non-Windows machine where you want to run the tests, use these scripts:
```
./clean.sh -all
./build.sh -outerloop -- /p:ServiceUri={URL-to-WCF-service}
```

17
build.sh Executable file
Просмотреть файл

@ -0,0 +1,17 @@
#!/usr/bin/env bash
source="${BASH_SOURCE[0]}"
# resolve $SOURCE until the file is no longer a symlink
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
"$scriptroot/eng/build.sh" $@

Просмотреть файл

@ -1,38 +0,0 @@
@if not defined _echo @echo off
setlocal EnableDelayedExpansion
echo Stop VBCSCompiler.exe execution.
for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq VBCSCompiler.exe" /fo csv') do taskkill /f /PID %%~F
echo Cleanup StopWcfSelfHostedSvc.cmd
call src\System.Private.ServiceModel\tools\scripts\StopWcfSelfHostedSvc.cmd
type SelfHostedWcfServiceCleanup.log
:: Strip all dashes off the argument and use invariant
:: compare to match as many versions of "all" that we can
:: All other argument validation happens inside Run.exe
set NO_DASHES_ARG=%1
if not defined NO_DASHES_ARG goto no_args
if /I [%NO_DASHES_ARG:-=%] == [all] (
echo Cleaning entire working directory ...
call git clean -xdf
exit /b !ERRORLEVEL!
)
:no_args
if [%1]==[] set __args=-b
call %~dp0run.cmd clean %__args% %*
exit /b %ERRORLEVEL%
:Usage
echo.
echo Repository cleaning script.
echo.
echo Options:
echo -b - Deletes the binary output directory.
echo -p - Deletes the repo-local nuget package directory.
echo -c - Deletes the user-local nuget package cache.
echo -all - Combines all of the above.
echo.
echo If no option is specified then clean.cmd -b is implied.
exit /b 1

Просмотреть файл

@ -1,35 +0,0 @@
#!/usr/bin/env bash
usage()
{
echo "Usage: clean [options]"
echo "Cleans the local dev environment."
echo
echo " -b Delete the binary output directory."
echo " -p Delete the repo-local NuGet package directory."
echo " -c Delete the user-local NuGet package caches."
echo " -all Cleans the root directory."
echo
echo "If no option is specified, then \"clean.sh -b\" is implied."
exit 1
}
if [ "$1" == "-?" ] || [ "$1" == "-h" ]; then
usage
fi
__working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "$*" == "-all" ]
then
echo "Removing all untracked files in the working tree"
git clean -xdf $__working_tree_root
exit $?
fi
if [ $# == 0 ]; then
__args=-b
fi
$__working_tree_root/run.sh clean $__args $*
exit $?

86
eng/build.sh Executable file
Просмотреть файл

@ -0,0 +1,86 @@
#!/usr/bin/env bash
set -ue
source="${BASH_SOURCE[0]}"
# resolve $source until the file is no longer a symlink
while [[ -h "$source" ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
usage()
{
echo "Common settings:"
echo " --configuration <value> Build configuration: Debug or Release (short: -c)"
echo " --verbosity <value> MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
echo " --binaryLog Output binary log (short: -bl)"
echo " --help Print help and exit (short: -h)"
echo ""
echo "Actions (defaults to --restore --build):"
echo " --restore Restore dependencies (short: -r)"
echo " --build Build all source projects (short: -b)"
echo " --rebuild Rebuild all source projects"
echo " --test Run all unit tests (short: -t)"
echo " --pack Package build outputs into NuGet packages"
echo " --sign Sign build outputs"
echo " --publish Publish artifacts (e.g. symbols)"
echo " --clean Clean the solution"
echo ""
}
arguments=''
extraargs=''
# Check if an action is passed in
declare -a actions=("r" "restore" "b" "build" "rebuild" "t" "test" "pack" "sign" "publish" "clean")
actInt=($(comm -12 <(printf '%s\n' "${actions[@]/#/-}" | sort) <(printf '%s\n' "${@/#--/-}" | sort)))
while [[ $# > 0 ]]; do
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
case "$opt" in
-help|-h|-\?|/?)
usage
exit 0
;;
-configuration|-c)
if [ -z ${2+x} ]; then
echo "No configuration supplied. See help (--help) for supported configurations." 1>&2
exit 1
fi
passedConfig="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
case "$passedConfig" in
debug|release)
val="$(tr '[:lower:]' '[:upper:]' <<< ${passedConfig:0:1})${passedConfig:1}"
;;
*)
echo "Unsupported configuration '$2'."
echo "The allowed values are Debug or Release."
exit 1
;;
esac
arguments="$arguments /p:ConfigurationGroup=$val -configuration $val"
shift 2
;;
*)
extraargs="$extraargs $1"
shift 1
;;
esac
done
if [ ${#actInt[@]} -eq 0 ]; then
arguments="-restore -build $arguments"
fi
arguments="$arguments $extraargs"
"$scriptroot/common/build.sh" $arguments