Skip to content

Commit

Permalink
Add build.sh for non-Windows builds
Browse files Browse the repository at this point in the history
Update docs building on non-Windows operating systems.
  • Loading branch information
akoeplinger authored and mconnew committed Aug 26, 2021
1 parent 72e4a35 commit eae4527
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 75 deletions.
3 changes: 1 addition & 2 deletions Documentation/building/cross-platform-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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}
```

Expand Down
17 changes: 17 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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" $@
38 changes: 0 additions & 38 deletions clean.cmd

This file was deleted.

35 changes: 0 additions & 35 deletions clean.sh

This file was deleted.

86 changes: 86 additions & 0 deletions eng/build.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eae4527

Please sign in to comment.