Skip to content

Commit

Permalink
Update build scripts based on changes in corefx.
Browse files Browse the repository at this point in the history
* Including build tools version and dotnet CLI version.
  • Loading branch information
StephenBonikowsky committed Mar 23, 2016
1 parent 0c6de6d commit 7b1a6a0
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 61 deletions.
2 changes: 1 addition & 1 deletion BuildToolsVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.25-prerelease-00188
1.0.25-prerelease-00206
2 changes: 1 addition & 1 deletion DotnetCLIVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0.001504
1.0.0.001718
19 changes: 11 additions & 8 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REM DelayedExpansion needed to allow %ERRORLEVEL% to be set/used multiple times
:: Note: We've disabled node reuse because it causes file locking issues.
:: The issue is that we extend the build with our own targets which
:: means that that rebuilding cannot successfully delete the task
:: assembly.
:: assembly.

:: *** start WCF Content ***
set outloop=false
Expand Down Expand Up @@ -65,11 +65,13 @@ if "%__buildSpec%"=="managed" goto :BuildManaged
:BuildNative
:: Run the Native Windows build
echo [%time%] Building Native Libraries...
call %~dp0src\native\Windows\build-native.cmd %__args% >nativebuild.log
IF ERRORLEVEL 1 (
echo Native component build failed see nativebuild.log for more details.
) else (
echo [%time%] Successfully built Native Libraries.
IF EXIST "%~dp0src\native\Windows\build-native.cmd" (
call %~dp0src\native\Windows\build-native.cmd %__args% >nativebuild.log
IF ERRORLEVEL 1 (
echo Native component build failed see nativebuild.log for more details.
) else (
echo [%time%] Successfully built Native Libraries.
)
)

:: If we only wanted to build the native components, exit
Expand All @@ -85,8 +87,8 @@ set Platform=
:: Log build command line
set _buildproj=%~dp0build.proj
set _buildlog=%~dp0msbuild.log
set _binclashLoggerDll=%~dp0Tools\net45\Microsoft.DotNet.Build.Tasks.dll
set _binclashlog=%~dp0binclash.log
set _binclashLoggerDll=%~dp0Tools\net45\Microsoft.DotNet.Build.Tasks.dll
set _binclashlog=%~dp0binclash.log
set _buildprefix=echo
set _buildpostfix=^> "%_buildlog%"

Expand Down Expand Up @@ -118,6 +120,7 @@ set BUILDERRORLEVEL=!ERRORLEVEL!
goto :eof

:AfterBuild

echo.
:: Pull the build summary from the log file
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%_buildlog%"
Expand Down
3 changes: 2 additions & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<!-- Capture OSGroup passed to command line for setting default FilterToOSGroup value below -->
<_OriginalOSGroup>$(OSGroup)</_OriginalOSGroup>
</PropertyGroup>

<Import Project="dir.props" />

<!-- required to build the projects in their specified order -->
Expand All @@ -17,6 +16,8 @@
<!-- For the root traversal default filter the OSGroup to the OSEnvironment which is the OS we are running on -->
<FilterToOSGroup Condition="'$(_OriginalOSGroup)' == ''">$(OSEnvironment)</FilterToOSGroup>
</Project>
<!-- signing must happen before packaging -->
<!-- <Project Include="src\sign.builds" /> This does not currently work in WCF repo -->
<Project Include="src\packages.builds">
<!-- When we do a traversal build we build all libraries prior to building packages -->
<AdditionalProperties>BuildPackageLibraryReferences=false</AdditionalProperties>
Expand Down
97 changes: 55 additions & 42 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/usr/bin/env bash

# This file is leveraged from the corefx report
# Some content such as anything related to building "native"
# Does not apply to WCF and is therefore a no op

usage()
{
echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [verbose] [clangx.y] [platform] [cross]"
echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [verbose] [clangx.y] [platform] [cross] [skiptests] [cmakeargs]"
echo "managed - optional argument to build the managed code"
echo "native - optional argument to build the native code"
echo "The following arguments affect native builds only:"
Expand All @@ -18,6 +14,8 @@ usage()
echo "platform can be: FreeBSD, Linux, NetBSD, OSX, Windows"
echo "cross - optional argument to signify cross compilation,"
echo " - will use ROOTFS_DIR environment variable if set."
echo "skiptests - skip the tests in the './bin/*/*Tests/' subdirectory."
echo "cmakeargs - user-settable additional arguments passed to CMake."
exit 1
}

Expand Down Expand Up @@ -103,14 +101,14 @@ prepare_native_build()
fi
}

build_managed_corefx()
build_managed()
{
__buildproj=$__scriptpath/build.proj
__buildlog=$__scriptpath/msbuild.log
__binclashlog=$__scriptpath/binclash.log
__binclashloggerdll=$__scriptpath/Tools/Microsoft.DotNet.Build.Tasks.dll

$__scriptpath/Tools/corerun $__scriptpath/Tools/MSBuild.exe "$__buildproj" /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__buildlog" "/l:BinClashLogger,$__binclashloggerdll;LogFile=$__binclashlog" /t:Build /p:ConfigurationGroup=$__BuildType /p:OSGroup=$__BuildOS /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) /p:TestNugetRuntimeId=$__TestNugetRuntimeId $__UnprocessedBuildArgs
$__scriptpath/Tools/corerun $__scriptpath/Tools/MSBuild.exe "$__buildproj" /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__buildlog" "/l:BinClashLogger,$__binclashloggerdll;LogFile=$__binclashlog" /t:Build /p:ConfigurationGroup=$__BuildType /p:OSGroup=$__BuildOS /p:SkipTests=$__SkipTests /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) /p:TestNugetRuntimeId=$__TestNugetRuntimeId $__UnprocessedBuildArgs
BUILDERRORLEVEL=$?

echo
Expand All @@ -120,16 +118,16 @@ build_managed_corefx()
echo Build Exit Code = $BUILDERRORLEVEL
}

build_native_corefx()
build_native()
{
# All set to commence the build

echo "Commencing build of corefx native components for $__BuildOS.$__BuildArch.$__BuildType"
cd "$__IntermediatesDir"

# Regenerate the CMake solution
echo "Invoking cmake with arguments: \"$__nativeroot\" $__CMakeArgs"
"$__nativeroot/gen-buildsys-clang.sh" "$__nativeroot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__CMakeArgs
echo "Invoking cmake with arguments: \"$__nativeroot\" $__CMakeArgs $__CMakeExtraArgs"
"$__nativeroot/gen-buildsys-clang.sh" "$__nativeroot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__CMakeArgs "$__CMakeExtraArgs"

# Check that the makefiles were created.

Expand Down Expand Up @@ -253,21 +251,26 @@ esac
__BuildOS=$__HostOS
__BuildType=Debug
__CMakeArgs=DEBUG
__CMakeExtraArgs=""

BUILDERRORLEVEL=0

# Set the various build properties here so that CMake and MSBuild can pick them up
__UnprocessedBuildArgs=
__CleanBuild=false
__CrossBuild=0
__SkipTests=false
__VerboseBuild=false
__ClangMajorVersion=3
__ClangMinorVersion=5

for i in "$@"
do
lowerI="$(echo $i | awk '{print tolower($0)}')"
case $lowerI in
while :; do
if [ $# -le 0 ]; then
break
fi

lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-?|-h|--help)
usage
exit 1
Expand All @@ -281,19 +284,15 @@ for i in "$@"
x86)
__BuildArch=x86
;;

x64)
__BuildArch=x64
;;

arm)
__BuildArch=arm
;;

arm64)
__BuildArch=arm64
;;

debug)
__BuildType=Debug
;;
Expand Down Expand Up @@ -346,9 +345,23 @@ for i in "$@"
cross)
__CrossBuild=1
;;
skiptests)
__SkipTests=true
;;
cmakeargs)
if [ -n "$2" ]; then
__CMakeExtraArgs="$2"
shift
else
echo "ERROR: 'cmakeargs' requires a non-empty option argument"
exit 1
fi
;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
esac

shift
done

# If neither managed nor native are passed as arguments, default to building both
Expand All @@ -365,6 +378,10 @@ if [ "$__BuildOS" != "$__HostOS" ]; then
__buildnative=false
fi

if [ ! -e "$__nativeroot" ]; then
__buildnative=false
fi

# Set the remaining variables based upon the determined build configuration
__IntermediatesDir="$__rootbinpath/obj/$__BuildOS.$__BuildArch.$__BuildType/Native"
__BinDir="$__rootbinpath/$__BuildOS.$__BuildArch.$__BuildType/Native"
Expand All @@ -373,24 +390,6 @@ __BinDir="$__rootbinpath/$__BuildOS.$__BuildArch.$__BuildType/Native"

setup_dirs

if $__buildmanaged; then

# Prepare the system

prepare_managed_build

# Build the corefx native components.

build_managed_corefx

# Build complete
fi

# If managed build failed, exit with the status code of the managed build
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi

# Configure environment if we are doing a cross compile.
if [ "$__CrossBuild" == 1 ]; then
export CROSSCOMPILE=1
Expand All @@ -410,14 +409,28 @@ if $__buildnative; then
prepare_native_build

# Build the corefx native components.
# *** start WCF Content ***

# WCF does not have a native component, comment out next command
# build_native_corefx

# *** end WCF Content ***
build_native

# Build complete
fi

if $__buildmanaged; then

# Prepare the system

prepare_managed_build

# Build the corefx native components.

build_managed

# Build complete
fi

# If managed build failed, exit with the status code of the managed build
if [ $BUILDERRORLEVEL != 0 ]; then
exit $BUILDERRORLEVEL
fi

exit $BUILDERRORLEVEL
Loading

0 comments on commit 7b1a6a0

Please sign in to comment.