Update BuildTools and init-tools scripts.

Using the latest 2.0.0 BuildTools and the latest init-tools scripts from corefx.
This commit is contained in:
Eric Erhardt 2017-09-29 14:27:12 -05:00
Родитель 091bdd2890
Коммит b9b9aaeb26
6 изменённых файлов: 120 добавлений и 117 удалений

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

@ -1 +1 @@
2.0.0-servicing-02026-05 2.0.0-servicing-02029-02

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

@ -12,9 +12,6 @@ set BUILD_TOOLS_PATH=%PACKAGES_DIR%Microsoft.DotNet.BuildTools\%BUILDTOOLS_VERSI
set INIT_TOOLS_RESTORE_PROJECT=%~dp0init-tools.msbuild set INIT_TOOLS_RESTORE_PROJECT=%~dp0init-tools.msbuild
set BUILD_TOOLS_SEMAPHORE=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION%\init-tools.completed set BUILD_TOOLS_SEMAPHORE=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION%\init-tools.completed
:: We do not want to run the first-time experience.
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
:: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated :: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated
if [%1]==[force] ( if [%1]==[force] (
if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%" if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%"
@ -29,10 +26,24 @@ if exist "%BUILD_TOOLS_SEMAPHORE%" (
if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%" if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%"
if exist "%DotNetBuildToolsDir%" (
echo Using tools from '%DotNetBuildToolsDir%'.
mklink /j "%TOOLRUNTIME_DIR%" "%DotNetBuildToolsDir%"
if not exist "%DOTNET_CMD%" (
echo ERROR: Ensure that '%DotNetBuildToolsDir%' contains the .NET Core SDK at '%DOTNET_PATH%'
exit /b 1
)
echo Done initializing tools.
echo Using tools from '%DotNetBuildToolsDir%'. > "%BUILD_TOOLS_SEMAPHORE%"
exit /b 0
)
echo Running %0 > "%INIT_TOOLS_LOG%" echo Running %0 > "%INIT_TOOLS_LOG%"
set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt" set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt"
if exist "%DOTNET_CMD%" goto :afterdotnetinstall if exist "%DOTNET_CMD%" goto :afterdotnetrestore
echo Installing dotnet cli... echo Installing dotnet cli...
if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%" if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%"
@ -46,7 +57,7 @@ if NOT exist "%DOTNET_LOCAL_PATH%" (
exit /b 1 exit /b 1
) )
:afterdotnetinstall :afterdotnetrestore
if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore
echo Restoring BuildTools version %BUILDTOOLS_VERSION%... echo Restoring BuildTools version %BUILDTOOLS_VERSION%...

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

@ -12,119 +12,109 @@ __BUILD_TOOLS_PACKAGE_VERSION=$(cat $__scriptpath/BuildToolsVersion.txt)
__DOTNET_TOOLS_VERSION=$(cat $__scriptpath/DotnetCLIVersion.txt) __DOTNET_TOOLS_VERSION=$(cat $__scriptpath/DotnetCLIVersion.txt)
__BUILD_TOOLS_PATH=$__PACKAGES_DIR/microsoft.dotnet.buildtools/$__BUILD_TOOLS_PACKAGE_VERSION/lib __BUILD_TOOLS_PATH=$__PACKAGES_DIR/microsoft.dotnet.buildtools/$__BUILD_TOOLS_PACKAGE_VERSION/lib
__INIT_TOOLS_RESTORE_PROJECT=$__scriptpath/init-tools.msbuild __INIT_TOOLS_RESTORE_PROJECT=$__scriptpath/init-tools.msbuild
__INIT_TOOLS_DONE_MARKER_DIR=$__TOOLRUNTIME_DIR/$__BUILD_TOOLS_PACKAGE_VERSION __BUILD_TOOLS_SEMAPHORE=$__TOOLRUNTIME_DIR/$__BUILD_TOOLS_PACKAGE_VERSION/init-tools.complete
__INIT_TOOLS_DONE_MARKER=$__INIT_TOOLS_DONE_MARKER_DIR/done
# We do not want to run the first-time experience. if [ -e $__BUILD_TOOLS_SEMAPHORE ]; then
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 echo "Tools are already initialized"
return #return instead of exit because this script is inlined in other scripts which we don't want to exit
if [ -z "$__DOTNET_PKG" ]; then
if [ "$(uname -m | grep "i[3456]86")" = "i686" ]; then
echo "Warning: build not supported on 32 bit Unix"
fi
OSName=$(uname -s)
case $OSName in
Darwin)
OS=OSX
__DOTNET_PKG=dotnet-dev-osx-x64
ulimit -n 2048
;;
Linux)
__DOTNET_PKG=dotnet-dev-linux-x64
OS=Linux
if [ -e /etc/redhat-release ]; then
redhatRelease=$(</etc/redhat-release)
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
__DOTNET_PKG=dotnet-dev-rhel.6-x64
fi
fi
;;
*)
echo "Unsupported OS '$OSName' detected. Downloading linux-x64 tools."
OS=Linux
__DOTNET_PKG=dotnet-dev-linux-x64
;;
esac
fi fi
if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then if [ -e $__TOOLRUNTIME_DIR ]; then rm -rf -- $__TOOLRUNTIME_DIR; fi
__PATCH_CLI_NUGET_FRAMEWORKS=0
if [ -e $__TOOLRUNTIME_DIR ]; then rm -rf -- $__TOOLRUNTIME_DIR; fi if [ -d "$DotNetBuildToolsDir" ]; then
echo "Running: $__scriptpath/init-tools.sh" > $__init_tools_log echo "Using tools from '$DotNetBuildToolsDir'."
ln -s "$DotNetBuildToolsDir" "$__TOOLRUNTIME_DIR"
if [ ! -e $__DOTNET_PATH ]; then if [ ! -e "$__DOTNET_CMD" ]; then
echo "ERROR: Ensure that $DotNetBuildToolsDir contains the .NET Core SDK at $__DOTNET_PATH"
mkdir -p "$__DOTNET_PATH" exit 1
if [ -n "$DOTNET_TOOLSET_DIR" ] && [ -d "$DOTNET_TOOLSET_DIR/$__DOTNET_TOOLS_VERSION" ]; then
echo "Copying $DOTNET_TOOLSET_DIR/$__DOTNET_TOOLS_VERSION to $__DOTNET_PATH" >> $__init_tools_log
cp -r $DOTNET_TOOLSET_DIR/$__DOTNET_TOOLS_VERSION/* $__DOTNET_PATH
elif [ -n "$DOTNET_TOOL_DIR" ] && [ -d "$DOTNET_TOOL_DIR" ]; then
echo "Copying $DOTNET_TOOL_DIR to $__DOTNET_PATH" >> $__init_tools_log
cp -r $DOTNET_TOOL_DIR/* $__DOTNET_PATH
else
echo "Installing dotnet cli..."
__DOTNET_LOCATION="https://dotnetcli.azureedge.net/dotnet/Sdk/${__DOTNET_TOOLS_VERSION}/${__DOTNET_PKG}.${__DOTNET_TOOLS_VERSION}.tar.gz"
# curl has HTTPS CA trust-issues less often than wget, so lets try that first.
echo "Installing '${__DOTNET_LOCATION}' to '$__DOTNET_PATH/dotnet.tar'" >> $__init_tools_log
which curl > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
wget -q -O $__DOTNET_PATH/dotnet.tar ${__DOTNET_LOCATION}
else
curl --retry 10 -sSL --create-dirs -o $__DOTNET_PATH/dotnet.tar ${__DOTNET_LOCATION}
fi
cd $__DOTNET_PATH
tar -xf $__DOTNET_PATH/dotnet.tar
cd $__scriptpath
__PATCH_CLI_NUGET_FRAMEWORKS=1
fi
fi fi
if [ -n "$BUILD_TOOLS_TOOLSET_DIR" ] && [ -d "$BUILD_TOOLS_TOOLSET_DIR/$__BUILD_TOOLS_PACKAGE_VERSION" ]; then
echo "Copying $BUILD_TOOLS_TOOLSET_DIR/$__BUILD_TOOLS_PACKAGE_VERSION to $__TOOLRUNTIME_DIR" >> $__init_tools_log
cp -r $BUILD_TOOLS_TOOLSET_DIR/$__BUILD_TOOLS_PACKAGE_VERSION/* $__TOOLRUNTIME_DIR
elif [ -n "$BUILD_TOOLS_TOOL_DIR" ] && [ -d "$BUILD_TOOLS_TOOL_DIR" ]; then
echo "Copying $BUILD_TOOLS_TOOL_DIR to $__TOOLRUNTIME_DIR" >> $__init_tools_log
cp -r $BUILD_TOOLS_TOOL_DIR/* $__TOOLRUNTIME_DIR
else
if [ ! -e $__BUILD_TOOLS_PATH ]; then
echo "Restoring BuildTools version $__BUILD_TOOLS_PACKAGE_VERSION..."
echo "Running: $__DOTNET_CMD restore \"$__INIT_TOOLS_RESTORE_PROJECT\" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION" >> $__init_tools_log
$__DOTNET_CMD restore "$__INIT_TOOLS_RESTORE_PROJECT" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION >> $__init_tools_log
if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then echo "ERROR: Could not restore build tools correctly. See '$__init_tools_log' for more details."1>&2; fi
fi
echo "Initializing BuildTools..."
echo "Running: $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR" >> $__init_tools_log
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
chmod +x $__BUILD_TOOLS_PATH/init-tools.sh
$__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR >> $__init_tools_log
if [ "$?" != "0" ]; then
echo "ERROR: An error occured when trying to initialize the tools. Please check '$__init_tools_log' for more details."1>&2
exit 1
fi
fi
echo "Making all .sh files executable under Tools."
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
ls $__scriptpath/Tools/*.sh | xargs chmod +x
ls $__scriptpath/Tools/scripts/docker/*.sh | xargs chmod +x
Tools/crossgen.sh $__scriptpath/Tools
mkdir -p $__INIT_TOOLS_DONE_MARKER_DIR
touch $__INIT_TOOLS_DONE_MARKER
echo "Done initializing tools." echo "Done initializing tools."
else mkdir -p "$(dirname "$__BUILD_TOOLS_SEMAPHORE")" && touch $__BUILD_TOOLS_SEMAPHORE
echo "Tools are already initialized" exit 0
fi fi
echo "Running: $__scriptpath/init-tools.sh" > $__init_tools_log
if [ ! -e $__DOTNET_PATH ]; then
if [ -z "$__DOTNET_PKG" ]; then
if [ "$(uname -m | grep "i[3456]86")" = "i686" ]; then
echo "Warning: build not supported on 32 bit Unix"
fi
OSName=$(uname -s)
case $OSName in
Darwin)
OS=OSX
__DOTNET_PKG=dotnet-dev-osx-x64
ulimit -n 2048
;;
Linux)
__DOTNET_PKG=dotnet-dev-linux-x64
OS=Linux
if [ -e /etc/redhat-release ]; then
redhatRelease=$(</etc/redhat-release)
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
__DOTNET_PKG=dotnet-dev-rhel.6-x64
fi
fi
;;
*)
echo "Unsupported OS '$OSName' detected. Downloading linux-x64 tools."
OS=Linux
__DOTNET_PKG=dotnet-dev-linux-x64
;;
esac
fi
mkdir -p "$__DOTNET_PATH"
echo "Installing dotnet cli..."
__DOTNET_LOCATION="https://dotnetcli.azureedge.net/dotnet/Sdk/${__DOTNET_TOOLS_VERSION}/${__DOTNET_PKG}.${__DOTNET_TOOLS_VERSION}.tar.gz"
# curl has HTTPS CA trust-issues less often than wget, so lets try that first.
echo "Installing '${__DOTNET_LOCATION}' to '$__DOTNET_PATH/dotnet.tar'" >> $__init_tools_log
which curl > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
wget -q -O $__DOTNET_PATH/dotnet.tar ${__DOTNET_LOCATION}
else
curl --retry 10 -sSL --create-dirs -o $__DOTNET_PATH/dotnet.tar ${__DOTNET_LOCATION}
fi
cd $__DOTNET_PATH
tar -xf $__DOTNET_PATH/dotnet.tar
cd $__scriptpath
fi
if [ ! -e $__BUILD_TOOLS_PATH ]; then
echo "Restoring BuildTools version $__BUILD_TOOLS_PACKAGE_VERSION..."
echo "Running: $__DOTNET_CMD restore \"$__INIT_TOOLS_RESTORE_PROJECT\" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION" >> $__init_tools_log
$__DOTNET_CMD restore "$__INIT_TOOLS_RESTORE_PROJECT" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION >> $__init_tools_log
if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then echo "ERROR: Could not restore build tools correctly. See '$__init_tools_log' for more details."1>&2; fi
fi
echo "Initializing BuildTools..."
echo "Running: $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR" >> $__init_tools_log
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
chmod +x $__BUILD_TOOLS_PATH/init-tools.sh
$__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR >> $__init_tools_log
if [ "$?" != "0" ]; then
echo "ERROR: An error occured when trying to initialize the tools. Please check '$__init_tools_log' for more details."1>&2
exit 1
fi
echo "Making all .sh files executable under Tools."
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
ls $__scriptpath/Tools/*.sh | xargs chmod +x
ls $__scriptpath/Tools/scripts/docker/*.sh | xargs chmod +x
Tools/crossgen.sh $__scriptpath/Tools
mkdir -p "$(dirname "$__BUILD_TOOLS_SEMAPHORE")" && touch $__BUILD_TOOLS_SEMAPHORE
echo "Done initializing tools."

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

@ -17,7 +17,5 @@ if not exist "%_VSCOMNTOOLS%" (
call "%_VSCOMNTOOLS%\VsDevCmd.bat" call "%_VSCOMNTOOLS%\VsDevCmd.bat"
:Run :Run
:: We do not want to run the first-time experience.
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
powershell -NoProfile -ExecutionPolicy unrestricted -Command "%~dp0run.ps1 -- %*" powershell -NoProfile -ExecutionPolicy unrestricted -Command "%~dp0run.ps1 -- %*"
exit /b %ERRORLEVEL% exit /b %ERRORLEVEL%

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

@ -2,6 +2,9 @@
$toolsLocalPath = Join-Path $PSScriptRoot "Tools" $toolsLocalPath = Join-Path $PSScriptRoot "Tools"
$restorePackagesPath = Join-Path $PSScriptRoot "packages" $restorePackagesPath = Join-Path $PSScriptRoot "packages"
# We do not want to run the first-time experience.
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$initTools = Join-Path $PSScriptRoot "init-tools.cmd" $initTools = Join-Path $PSScriptRoot "init-tools.cmd"
& $initTools & $initTools

5
run.sh
Просмотреть файл

@ -11,11 +11,12 @@ invocation='echo "Calling: ${FUNCNAME[0]}"'
__scriptpath=$(cd "$(dirname "$0")"; pwd -P) __scriptpath=$(cd "$(dirname "$0")"; pwd -P)
__toolsLocalPath=$__scriptpath/Tools __toolsLocalPath=$__scriptpath/Tools
# We do not want to run the first-time experience.
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$__scriptpath/init-tools.sh $__scriptpath/init-tools.sh
__dotnet=$__toolsLocalPath/dotnetcli/dotnet __dotnet=$__toolsLocalPath/dotnetcli/dotnet
# We do not want to run the first-time experience.
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$__dotnet $__toolsLocalPath/run.exe $* $__dotnet $__toolsLocalPath/run.exe $*
exit $? exit $?