Remove dependency on run.exe
Our build scripts were pulling down all of buildtools and run.exe in service of "clean.{cmd|sh}". While having consisent commands across the repos is a good thing to strive for, we are pulling down a bunch of additional stuff we don't need for simple commands that have well known analogs (e.g. git clean). If we had been all in on run.exe, this might have made sense, but we aren't, so it feels like something we should clean up. By doing this, we can stop downloading bootstrap from github when we build (super dangerous anyway because changes in buildtools could have broken us). In addition, I changed the way we install dotnet to just invoke the script in `scripts/obtain/` instead of downloading a version from GitHub. This makes local development of changes to obtain easier and removes yet another place we had to download a script.
This commit is contained in:
parent
2cc5612fec
commit
b6a2c01cf6
12 changed files with 39 additions and 253 deletions
|
@ -1 +0,0 @@
|
|||
1.0.0-preview2-1-003177
|
|
@ -1,2 +0,0 @@
|
|||
microsoft.dotnet.buildtools=1.0.27-prerelease-01316-08
|
||||
microsoft.dotnet.buildtools.run=1.0.0-prerelease-00807-04
|
|
@ -52,7 +52,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4
|
|||
build\Package.targets = build\Package.targets
|
||||
build\Prepare.targets = build\Prepare.targets
|
||||
build\Publish.targets = build\Publish.targets
|
||||
build\Run.targets = build\Run.targets
|
||||
build\sdks\sdks.csproj = build\sdks\sdks.csproj
|
||||
build\Signing.proj = build\Signing.proj
|
||||
build\Stage0.props = build\Stage0.props
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
<Import Project="build/Package.targets" />
|
||||
<Import Project="build/Test.targets" />
|
||||
<Import Project="build/Publish.targets" />
|
||||
<Import Project="build/Run.targets" />
|
||||
|
||||
<Import Project="build/InitRepo.targets" />
|
||||
</Project>
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<Target Name="CleanArtifacts" >
|
||||
<RemoveDir Directories="$(BaseOutputDirectory)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CleanRepo">
|
||||
<Exec Command="git clean -fdx" WorkingDirectory="$(RepoRoot)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
12
clean.cmd
12
clean.cmd
|
@ -1,12 +0,0 @@
|
|||
@echo off
|
||||
|
||||
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
if "%~1"=="" (
|
||||
@call run.cmd clean -?
|
||||
@exit /b 1
|
||||
) else (
|
||||
@call run.cmd clean %*
|
||||
@exit /b %ERRORLEVEL%
|
||||
)
|
22
clean.sh
22
clean.sh
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
REPOROOT="$DIR"
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
"$REPOROOT/run.sh" clean -?
|
||||
else
|
||||
"$REPOROOT/run.sh" clean "$@"
|
||||
fi
|
83
config.json
83
config.json
|
@ -1,83 +0,0 @@
|
|||
{
|
||||
"settings": {
|
||||
"Project": {
|
||||
"description": "Project where the commands are going to be applied.",
|
||||
"valueType": "passThrough",
|
||||
"values": [],
|
||||
"defaultValue": ""
|
||||
},
|
||||
"CleanArtifacts": {
|
||||
"description": "MsBuild target that deletes the artifacts output directory.",
|
||||
"valueType": "target",
|
||||
"values": [],
|
||||
"defaultValue": ""
|
||||
},
|
||||
"CleanPackages": {
|
||||
"description": "MsBuild target that deletes the repo-local nuget package directory.",
|
||||
"valueType": "target",
|
||||
"values": [],
|
||||
"defaultValue": ""
|
||||
},
|
||||
"CleanPackagesCache": {
|
||||
"description": "MsBuild target that deletes the user-local nuget package cache.",
|
||||
"valueType": "target",
|
||||
"values": [],
|
||||
"defaultValue": ""
|
||||
},
|
||||
"CleanRepo": {
|
||||
"description": "Cleans the entire repo of all non-git-added artifacts",
|
||||
"valueType": "target",
|
||||
"values": [],
|
||||
"defaultValue": ""
|
||||
},
|
||||
},
|
||||
"commands": {
|
||||
"clean":{
|
||||
"alias":{
|
||||
"o":{
|
||||
"description": "Deletes the artifacts directory.",
|
||||
"settings":{
|
||||
"CleanArtifacts": "default"
|
||||
}
|
||||
},
|
||||
"p":{
|
||||
"description": "Deletes the repo-local nuget package directory.",
|
||||
"settings":{
|
||||
"CleanPackages": "default"
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"description": "Deletes the user-local nuget package directory",
|
||||
"settings": {
|
||||
"CleanPackagesCache": "default"
|
||||
}
|
||||
},
|
||||
"a": {
|
||||
"description": "Deletes all repo content that is not git-added",
|
||||
"settings": {
|
||||
"CleanRepo" : "default"
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultValues":{
|
||||
"toolName": "msbuild",
|
||||
"settings": {
|
||||
"Project": "build.proj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tools": {
|
||||
"msbuild": {
|
||||
"run": {
|
||||
"windows": "build_tools\\msbuild.cmd",
|
||||
"unix": "build_tools/msbuild.sh"
|
||||
},
|
||||
"valueTypes": {
|
||||
"property": "/p:{name}={value}",
|
||||
"target": "/t:{name}",
|
||||
"internal": "/{name}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,18 +42,7 @@ else
|
|||
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
||||
}
|
||||
|
||||
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
||||
if (!$env:DOTNET_INSTALL_DIR_PJ)
|
||||
{
|
||||
$env:DOTNET_INSTALL_DIR_PJ="$RepoRoot\.dotnet_stage0PJ\$Architecture"
|
||||
}
|
||||
|
||||
if (!(Test-Path $env:DOTNET_INSTALL_DIR_PJ))
|
||||
{
|
||||
mkdir $env:DOTNET_INSTALL_DIR_PJ | Out-Null
|
||||
}
|
||||
|
||||
# Also create an install directory for a post-PJnistic CLI
|
||||
# Use a repo-local install directory for stage0 (but not the artifacts directory because that gets cleaned a lot
|
||||
if (!$env:DOTNET_INSTALL_DIR)
|
||||
{
|
||||
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
|
||||
|
@ -64,6 +53,20 @@ if (!(Test-Path $env:DOTNET_INSTALL_DIR))
|
|||
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
|
||||
}
|
||||
|
||||
# We also need to pull down a project.json based CLI that is used by some tests
|
||||
# so create another directory for that.
|
||||
if (!$env:DOTNET_INSTALL_DIR_PJ)
|
||||
{
|
||||
$env:DOTNET_INSTALL_DIR_PJ="$RepoRoot\.dotnet_stage0PJ\$Architecture"
|
||||
}
|
||||
|
||||
if (!(Test-Path $env:DOTNET_INSTALL_DIR_PJ))
|
||||
{
|
||||
mkdir $env:DOTNET_INSTALL_DIR_PJ | Out-Null
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Disable first run since we want to control all package sources
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
|
@ -71,35 +74,8 @@ $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|||
$env:VSTEST_BUILD_TRACE=1
|
||||
$env:VSTEST_TRACE_BUILD=1
|
||||
|
||||
# set the base tools directory
|
||||
$toolsLocalPath = Join-Path $PSScriptRoot "build_tools"
|
||||
if($env:BOOTSTRAP_INSTALL_DIR)
|
||||
{
|
||||
$toolsLocalPath = $env:BOOTSTRAP_INSTALL_DIR
|
||||
}
|
||||
$bootStrapperPath = Join-Path $toolsLocalPath "bootstrap.ps1"
|
||||
# if the boot-strapper script doesn't exist then download it
|
||||
if ((Test-Path $bootStrapperPath) -eq 0)
|
||||
{
|
||||
if ((Test-Path $toolsLocalPath) -eq 0)
|
||||
{
|
||||
mkdir $toolsLocalPath | Out-Null
|
||||
}
|
||||
|
||||
# download boot-strapper script
|
||||
Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/buildtools/master/bootstrap/bootstrap.ps1" -OutFile $bootStrapperPath
|
||||
}
|
||||
|
||||
# now execute it
|
||||
& $bootStrapperPath -DotNetInstallBranch master -RepositoryRoot (Get-Location) -ToolsLocalPath $toolsLocalPath -CliLocalPath $env:DOTNET_INSTALL_DIR_PJ -Architecture $Architecture | Out-File (Join-Path (Get-Location) "bootstrap.log")
|
||||
if ($LastExitCode -ne 0)
|
||||
{
|
||||
Write-Output "Boot-strapping failed with exit code $LastExitCode, see bootstrap.log for more information."
|
||||
exit $LastExitCode
|
||||
}
|
||||
|
||||
# install the post-PJnistic stage0
|
||||
$dotnetInstallPath = Join-Path $toolsLocalPath "dotnet-install.ps1"
|
||||
# install a stage0
|
||||
$dotnetInstallPath = Join-Path $RepoRoot "scripts\obtain\dotnet-install.ps1"
|
||||
|
||||
Write-Host "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
|
||||
Invoke-Expression "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
|
||||
|
@ -110,6 +86,14 @@ if ($LastExitCode -ne 0)
|
|||
}
|
||||
|
||||
|
||||
Write-Host "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR_PJ -Architecture ""$Architecture"" -Version 1.0.0-preview2-1-003177"
|
||||
Invoke-Expression "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR_PJ -Architecture ""$Architecture"" -Version 1.0.0-preview2-1-003177"
|
||||
if ($LastExitCode -ne 0)
|
||||
{
|
||||
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"
|
||||
exit $LastExitCode
|
||||
}
|
||||
|
||||
# Put the stage0 on the path
|
||||
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
||||
|
||||
|
|
43
run-build.sh
43
run-build.sh
|
@ -130,54 +130,39 @@ done
|
|||
|
||||
# $args array may have empty elements in it.
|
||||
# The easiest way to remove them is to cast to string and back to array.
|
||||
# This will actually break quoted arguments, arguments like
|
||||
# This will actually break quoted arguments, arguments like
|
||||
# -test "hello world" will be broken into three arguments instead of two, as it should.
|
||||
temp="${args[@]}"
|
||||
args=($temp)
|
||||
|
||||
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
||||
[ -z "$DOTNET_INSTALL_DIR_PJ" ] && export DOTNET_INSTALL_DIR_PJ=$REPOROOT/.dotnet_stage0PJ/$ARCHITECTURE
|
||||
[ -d "$DOTNET_INSTALL_DIR_PJ" ] || mkdir -p $DOTNET_INSTALL_DIR_PJ
|
||||
|
||||
# Also create an install directory for a post-PJnistic CLI
|
||||
# Create an install directory for the stage 0 CLI
|
||||
[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$ARCHITECTURE
|
||||
[ -d "$DOTNET_INSTALL_DIR" ] || mkdir -p $DOTNET_INSTALL_DIR
|
||||
|
||||
# During xplat bootstrapping, disable HTTP parallelism to avoid fatal restore timeouts.
|
||||
export __INIT_TOOLS_RESTORE_ARGS="$__INIT_TOOLS_RESTORE_ARGS --disable-parallel"
|
||||
# We also need to pull down a project.json based CLI that is used by some tests
|
||||
# so create another directory for that.
|
||||
[ -z "$DOTNET_INSTALL_DIR_PJ" ] && export DOTNET_INSTALL_DIR_PJ=$REPOROOT/.dotnet_stage0PJ/$ARCHITECTURE
|
||||
[ -d "$DOTNET_INSTALL_DIR_PJ" ] || mkdir -p $DOTNET_INSTALL_DIR_PJ
|
||||
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
# Enable verbose VS Test Console logging
|
||||
export VSTEST_BUILD_TRACE=1
|
||||
export VSTEST_TRACE_BUILD=1
|
||||
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
toolsLocalPath="$REPOROOT/build_tools"
|
||||
if [ ! -z $BOOTSTRAP_INSTALL_DIR]; then
|
||||
toolsLocalPath = $BOOTSTRAP_INSTALL_DIR
|
||||
fi
|
||||
bootStrapperPath="$toolsLocalPath/bootstrap.sh"
|
||||
dotnetInstallPath="$toolsLocalPath/dotnet-install.sh"
|
||||
if [ ! -f $bootStrapperPath ]; then
|
||||
if [ ! -d $toolsLocalPath ]; then
|
||||
mkdir $toolsLocalPath
|
||||
fi
|
||||
download "https://raw.githubusercontent.com/dotnet/buildtools/master/bootstrap/bootstrap.sh" "$bootStrapperPath"
|
||||
chmod u+x $bootStrapperPath
|
||||
fi
|
||||
|
||||
$bootStrapperPath --dotNetInstallBranch master --repositoryRoot "$REPOROOT" --toolsLocalPath "$toolsLocalPath" --cliInstallPath $DOTNET_INSTALL_DIR_PJ --architecture $ARCHITECTURE > bootstrap.log
|
||||
# Install a stage 0
|
||||
(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --channel "master" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS)
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE != 0 ]; then
|
||||
echo "run-build: Error: Boot-strapping failed with exit code $EXIT_CODE, see bootstrap.log for more information." >&2
|
||||
echo "run-build: Error: installing stage0 with exit code $EXIT_CODE." >&2
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
# now execute the script
|
||||
echo "installing CLI: $dotnetInstallPath --channel \"master\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\" $LINUX_PORTABLE_INSTALL_ARGS"
|
||||
$dotnetInstallPath --channel "master" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS
|
||||
# Install a project.json based CLI for use by tests
|
||||
(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --channel "master" --install-dir "$DOTNET_INSTALL_DIR_PJ" --architecture "$ARCHITECTURE" --version "1.0.0-preview2-1-003177")
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE != 0 ]; then
|
||||
echo "run-build: Error: Boot-strapping post-PJ stage0 with exit code $EXIT_CODE." >&2
|
||||
echo "run-build: Error: installing project-json based cli failed with exit code $EXIT_CODE." >&2
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
|
|
25
run.cmd
25
run.cmd
|
@ -1,25 +0,0 @@
|
|||
@if "%_echo%" neq "on" echo off
|
||||
setlocal
|
||||
|
||||
if not defined VisualStudioVersion (
|
||||
if defined VS140COMNTOOLS (
|
||||
call "%VS140COMNTOOLS%\VsDevCmd.bat"
|
||||
goto :Run
|
||||
)
|
||||
echo Error: Visual Studio 2015 required.
|
||||
echo Please see https://github.com/dotnet/cli/blob/rel/1.0.0/Documentation/developer-guide.md for build instructions.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:Run
|
||||
powershell -NoProfile -NoLogo -Command "%~dp0build.cmd -NoBuild; exit $LastExitCode;"
|
||||
set _toolRuntime=%~dp0build_tools
|
||||
set _dotnet=%_toolRuntime%\dotnetcli\dotnet.exe
|
||||
|
||||
echo Running: %_dotnet% %_toolRuntime%\run.exe %*
|
||||
call %_dotnet% %_toolRuntime%\run.exe %~dp0config.json %*
|
||||
if NOT [%ERRORLEVEL%]==[0] (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
exit /b 0
|
24
run.sh
24
run.sh
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
REPOROOT="$DIR"
|
||||
|
||||
$DIR/build.sh "--nobuild"
|
||||
|
||||
__toolRuntime=$REPOROOT/build_tools
|
||||
__dotnet=$__toolRuntime/dotnetcli/dotnet
|
||||
|
||||
echo "Running: $__dotnet $__toolRuntime/run.exe $@"
|
||||
$__dotnet $__toolRuntime/run.exe $DIR/config.json "$@"
|
Loading…
Reference in a new issue