Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Split scripts for installing dotnet vs BuildTools
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung committed May 30, 2019
1 parent 074c4c2 commit 965bf14
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 17 deletions.
1 change: 1 addition & 0 deletions UpdatePublishedVersions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ param(
# A pattern matching all packages in the set that the versions repository should be set to.
[Parameter(Mandatory=$true)][string]$nupkgPath)

& "$PSScriptRoot\init-tools.cmd"
& "$PSScriptRoot\dotnet.cmd" msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false `
/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll`;LogFile=binclash.log `
/p:RestoreDefaultOptimizationDataPackage=false `
Expand Down
3 changes: 2 additions & 1 deletion build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,8 @@ fi
# init the target distro name
initTargetDistroRid

# Override tool directory
# Restore Build Tools
source $__ProjectRoot/init-tools.sh

if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") && (-z "$__BuildTestWrappersOnly") ]]; then
build_Tests
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ restore_optdata()
# Parse the optdata package versions out of msbuild so that we can pass them on to CMake
local DotNetCli="$__ProjectRoot/.dotnet/dotnet"
if [ ! -f $DotNetCli ]; then
source "$__ProjectRoot/init-tools.sh"
source "$__ProjectRoot/init-dotnet.sh"
if [ $? != 0 ]; then
echo "Failed to restore buildtools."
echo "Failed to install dotnet."
exit 1
fi
fi
Expand Down
6 changes: 3 additions & 3 deletions dotnet.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ set DOTNET_MULTILEVEL_LOOKUP=0
:: Disable first run since we do not need all ASP.NET packages restored.
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

:: Restore the Tools directory
call %~dp0init-tools.cmd
REM :: Install dotnet
call %~dp0\init-dotnet.cmd
if NOT [%ERRORLEVEL%]==[0] (
exit /b 1
exit /b %ERRORLEVEL%
)

pushd %~dp0
Expand Down
4 changes: 2 additions & 2 deletions dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export DOTNET_MULTILEVEL_LOOKUP=0
# Disable first run since we want to control all package sources
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

echo "Running init-tools.sh"
source $working_tree_root/init-tools.sh
echo "Running init-dotnet.sh"
source $working_tree_root/init-dotnet.sh

dotnet=$working_tree_root/.dotnet/dotnet

Expand Down
13 changes: 13 additions & 0 deletions init-dotnet.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@if not defined _echo @echo off
setlocal

echo Installing dotnet using Arcade...
set PS_DOTNET_INSTALL_SCRIPT=". %~dp0eng\configure-toolset.ps1; . %~dp0eng\common\tools.ps1; InitializeBuildTool"
echo running: powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT%
powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT%
if NOT [%ERRORLEVEL%] == [0] (
echo Failed to install dotnet using Arcade.
exit /b %ERRORLEVEL%
)

exit /b 0
15 changes: 15 additions & 0 deletions init-dotnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

__scriptpath=$(cd "$(dirname "$0")"; pwd -P)

echo "Installing dotnet using Arcade..."

source $__scriptpath/eng/configure-toolset.sh
source $__scriptpath/eng/common/tools.sh

InitializeBuildTool

if [ $? != 0 ]; then
echo "Failed to install dotnet using Arcade"
exit $?
fi
5 changes: 1 addition & 4 deletions init-tools.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ echo "init-tools.cmd: Setting arch to %_Arch% for build tools"

:ArchSet

echo Installing dotnet cli...
set PS_DOTNET_INSTALL_SCRIPT=". %~dp0eng\configure-toolset.ps1; . %~dp0eng\common\tools.ps1; InitializeBuildTool"
if NOT exist "%DOTNET_CMD%" (
echo running: powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT%
powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT%
call %~dp0init-dotnet.cmd
if NOT exist "%DOTNET_CMD%" (
echo ERROR: Could not install dotnet cli correctly. 1>&2
goto :error
Expand Down
6 changes: 1 addition & 5 deletions init-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ esac
__PKG_RID=$__PKG_RID-$__PKG_ARCH

if [ ! -e "$__DOTNET_CMD" ]; then
source $__scriptpath/eng/configure-toolset.sh
source $__scriptpath/eng/common/tools.sh

InitializeBuildTool

source $__scriptpath/init-dotnet.sh
if [ ! -e "$__DOTNET_CMD" ]; then
echo "ERROR: Ensure arcade dotnet install did not install dotnet at $__DOTNET_CMD"
exit 1
Expand Down

0 comments on commit 965bf14

Please sign in to comment.