Skip to content

Commit

Permalink
Update with PRs from corefx impacting what tests build against.
Browse files Browse the repository at this point in the history
* PR dotnet/corefx#7604 :: Enable project reference to package dependency conversion for test builds.
* PR dornet/corefx#8014 :: Set exit codes for wrapper scripts if there is an error.
  • Loading branch information
StephenBonikowsky committed May 2, 2016
1 parent 99cd9e1 commit 31bfbfa
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 34 deletions.
2 changes: 1 addition & 1 deletion build-packages.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ echo msbuild.exe %~dp0src\packages.builds !options! !allargs! >> %packagesLog%
call msbuild.exe %~dp0src\packages.builds !options! !allargs!
if NOT [%ERRORLEVEL%]==[0] (
echo ERROR: An error occurred while building packages, see %packagesLog% for more details.
exit /b
exit /b 1
)

echo Done Building Packages.
Expand Down
2 changes: 1 addition & 1 deletion build-tests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ echo msbuild.exe %~dp0src\tests.builds !options! !allargs! >> %buildTests%
call msbuild.exe %~dp0src\tests.builds !options! !allargs!
if NOT [%ERRORLEVEL%]==[0] (
echo ERROR: An error occurred while building the tests, see %buildTests% for more details.
exit /b
exit /b 1
)

echo Done Building tests.
Expand Down
4 changes: 2 additions & 2 deletions init-tools.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> "%INIT_TOOLS_
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> "%INIT_TOOLS_LOG%"
if NOT exist "%DOTNET_LOCAL_PATH%" (
echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details.
goto :EOF
exit /b 1
)

:afterdotnetrestore
Expand All @@ -55,7 +55,7 @@ echo Running: "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_
call "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> "%INIT_TOOLS_LOG%"
if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" (
echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details.
goto :EOF
exit /b 1
)

:afterbuildtoolsrestore
Expand Down
6 changes: 3 additions & 3 deletions publish-packages.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ REM ensure that msbuild is available
echo Running init-tools.cmd
call %~dp0init-tools.cmd

echo msbuild.exe %~dp0src\publish.builds !options! !allargs! >> %packagesLog%
call msbuild.exe %~dp0src\publish.builds !options! !allargs!
echo msbuild.exe %~dp0src\publish.proj !options! !allargs! >> %packagesLog%
call msbuild.exe %~dp0src\publish.proj !options! !allargs!
if NOT [%ERRORLEVEL%]==[0] (
echo ERROR: An error occurred while publishing packages, see %packagesLog% for more details.
exit /b
exit /b 1
)

echo Done publishing packages.
Expand Down
4 changes: 2 additions & 2 deletions publish-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ fi
echo "Running init-tools.sh"
$working_tree_root/init-tools.sh

echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.builds $options $allargs" >> $publish_packages_log
$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.builds $options $allargs
echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $allargs" >> $publish_packages_log
$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $allargs

if [ $? -ne 0 ]; then
echo -e "\nAn error occurred. Aborting publish-packages.sh ." >> $publish_packages_log
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions src/syncAzure.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

<PropertyGroup>
<ContainerNamePrefix Condition="'$(ContainerNamePrefix)' == ''">corefx-$(PreReleaseLabel)</ContainerNamePrefix>
<ContainerName Condition="'$(ContainerNamePrefix)' != '' and '$(BuildNumberMajor)' != '' and '$(BuildNumberMinor)' != ''">$(ContainerNamePrefix)-$(BuildNumberMajor)-$(BuildNumberMinor)</ContainerName>
<DownloadDirectory>$(PackagesDir)AzureTransfer</DownloadDirectory>
</PropertyGroup>

<Import Project="$(ToolsDir)SyncCloudContent.targets" />

<Target Name="ValidateRequiredProperties">
<Error Condition="'$(CloudDropAccountName)' == ''" Text="Missing property CloudDropAccountName." />
<Error Condition="'$(CloudDropAccessToken)' == ''" Text="Missing property CloudDropAccessToken." />
</Target>

<Target Name="Build" DependsOnTargets="ValidateRequiredProperties;DownloadBlobsFromAzureTargets" />
</Project>
73 changes: 48 additions & 25 deletions sync.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,94 @@ set synclog=sync.log
echo Running Sync.cmd %* > %synclog%

set options=/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=%synclog%
set targets=BatchRestorePackages
set unprocessedBuildArgs=
set allargs=%*
set thisArgs=

set src=false
set packages=false
set tests=false
set azureBlobs=false

if [%1]==[] (
set src=true
set packages=true
set tests=false
goto Begin
)

set src=false
set packages=false

:Loop
if [%1]==[] goto Begin

if /I [%1]==[/?] goto Usage

if /I [%1] == [/p] (
set packages=true
set thisArgs=%thisArgs%%1
set thisArgs=!thisArgs!%1
goto Next
)

if /I [%1] == [/s] (
set src=true
set thisArgs=%thisArgs%%1
set thisArgs=!thisArgs!%1
goto Next
)

if /I [%1] == [/t] (
set tests=true
set options=%options% /p:BuildTestsAgainstPackages=true
set targets=BatchGenerateTestProjectJsons;%targets%
set thisArgs=%thisArgs%%1
set packages=true
set thisArgs=!thisArgs!%1
goto Next
)

set unprocessedBuildArgs=%unprocessedBuildArgs% %1
if /I [%1] == [/ab] (
set azureBlobs=true
set thisArgs=!thisArgs!%1
goto Next
)

set unprocessedBuildArgs=!unprocessedBuildArgs! %1

:Next
shift /1
goto Loop

:Begin

echo Running init-tools.cmd
call %~dp0init-tools.cmd

if [%src%] == [true] (
echo Fetching git database from remote repos ...
call git fetch --all -p -v >> %synclog% 2>&1
if NOT [%ERRORLEVEL%]==[0] (
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while fetching remote source code, see %synclog% for more details.
exit /b
exit /b 1
)
)

if [%tests%] == [true] (
echo Generating Test project.json's and Restoring all packages ...
) else (
if [%packages%] == [true] (
echo Restoring all packages ...
if [%azureBlobs%] == [true] (
echo Connecting and downloading packages from Azure BLOB ...
echo msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs! >> %synclog%
call msbuild.exe %~dp0src\syncAzure.proj !options! !unprocessedBuildArgs!
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while downloading packages from Azure BLOB, see %synclog% for more details. There may have been networking problems so please try again in a few minutes.
exit /b 1
)
)
set options=%options% /t:%targets% /p:RestoreDuringBuild=true
echo msbuild.exe %~dp0build.proj %options% %unprocessedBuildArgs% >> %synclog%
call msbuild.exe %~dp0build.proj %options% %unprocessedBuildArgs%
if NOT [%ERRORLEVEL%]==[0] (
echo ERROR: An error occurred while syncing packages, see %synclog% for more details. There may have been networking problems so please try again in a few minutes.
exit /b

set targets=BatchRestorePackages
if [%tests%] == [true] (
set options=!options! /p:BuildTestsAgainstPackages=true
set targets=BatchGenerateTestProjectJsons;!targets!
)

if [%packages%] == [true] (
set options=!options! /t:!targets! /p:RestoreDuringBuild=true
echo msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs! >> %synclog%
call msbuild.exe %~dp0build.proj !options! !unprocessedBuildArgs!
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while syncing packages, see %synclog% for more details. There may have been networking problems so please try again in a few minutes.
exit /b 1
)
)

echo Done Syncing.
Expand All @@ -93,5 +108,13 @@ echo Options:
echo /s - Fetches source history from all configured remotes
echo (git fetch --all -p -v)
echo /p - Restores all nuget packages for repository
echo /t - Generates tests project.json files and then it restores all nuget packages for repository.
echo /ab - Downloads the latests product packages from Azure.
echo The following properties are required:
echo /p:CloudDropAccountName="Account name"
echo /p:CloudDropAccessToken="Access token"
echo To download a specific group of product packages, specify:
echo /p:BuildNumberMajor
echo /p:BuildNumberMinor
echo.
echo If no option is specified then sync.cmd /s /p is implied.
22 changes: 22 additions & 0 deletions sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ usage()
echo " -s Fetch source history from all configured remotes"
echo " (git fetch --all -p -v)"
echo " -p Restore all NuGet packages for the repository"
echo " -ab Downloads the latests product packages from Azure."
echo " The following properties are required:'"
echo " /p:CloudDropAccountName='Account name'"
echo " /p:CloudDropAccessToken='Access token'"
echo " To download a specific group of product packages, specify:"
echo " /p:BuildNumberMajor"
echo " /p:BuildNumberMinor"
echo
echo "If no option is specified, then \"sync.sh -p -s\" is implied."
exit 1
Expand Down Expand Up @@ -39,6 +46,9 @@ do
-s)
sync_src=true
;;
-ab)
azure_blobs=true
;;
*)
unprocessedBuildArgs="$unprocessedBuildArgs $1"
esac
Expand All @@ -58,6 +68,18 @@ if [ "$sync_src" == true ]; then
fi
fi

if [ "$azure_blobs" == true ]; then
echo "Connecting and downloading packages from Azure BLOB ..."
echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/syncAzure.proj $options $unprocessedBuildArgs" >> $sync_log
$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/syncAzure.proj $options $unprocessedBuildArgs
if [ $? -ne 0 ]
then
echo -e "\nDownload from Azure failed. Aborting sync." >> $sync_log
echo "ERROR: An error occurred while downloading packages from Azure BLOB; see $sync_log for more details. There may have been networking problems, so please try again in a few minutes."
exit 1
fi
fi

if [ "$sync_packages" == true ]; then
options="$options /t:BatchRestorePackages /p:RestoreDuringBuild=true"
echo "Restoring all packages..."
Expand Down

0 comments on commit 31bfbfa

Please sign in to comment.