Addressing code review comments. Fixing issue with compile where we were not copying the msbuild files to the right place. Fixed an issue where we were trying to download installers for OSes that don't have installers. Added init-tools scripts.
This commit is contained in:
parent
c87652f8a0
commit
cdddc2e432
10 changed files with 113 additions and 90 deletions
|
@ -3,5 +3,5 @@
|
||||||
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
|
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.
|
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
powershell -NoProfile -NoLogo -Command "%~dp0run_build.ps1 %*; exit $LastExitCode;"
|
powershell -NoProfile -NoLogo -Command "%~dp0run-build.ps1 %*; exit $LastExitCode;"
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
<PlatformScriptExtension Condition=" '$(OS)' == 'Windows_NT' ">.ps1</PlatformScriptExtension>
|
<PlatformScriptExtension Condition=" '$(OS)' == 'Windows_NT' ">.ps1</PlatformScriptExtension>
|
||||||
<PlatformScriptExtension Condition=" '$(OS)' != 'Windows_NT' ">.sh</PlatformScriptExtension>
|
<PlatformScriptExtension Condition=" '$(OS)' != 'Windows_NT' ">.sh</PlatformScriptExtension>
|
||||||
|
|
||||||
<NoRunArg Condition=" '$(OS)' == 'Windows_NT' ">-NoRun</NoRunArg>
|
|
||||||
<NoRunArg Condition=" '$(OS)' != 'Windows_NT' ">--norun</NoRunArg>
|
|
||||||
|
|
||||||
<CLITargets Condition=" '$(CLITargets)' == '' ">Prepare;Compile;Test;Package;Publish</CLITargets>
|
<CLITargets Condition=" '$(CLITargets)' == '' ">Prepare;Compile;Test;Package;Publish</CLITargets>
|
||||||
<CLIBuildFileName>$(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build/bin/dotnet-cli-build</CLIBuildFileName>
|
<CLIBuildFileName>$(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build/bin/dotnet-cli-build</CLIBuildFileName>
|
||||||
<CLIBuildDll>$(CLIBuildFileName).dll</CLIBuildDll>
|
<CLIBuildDll>$(CLIBuildFileName).dll</CLIBuildDll>
|
||||||
|
|
4
build.sh
4
build.sh
|
@ -49,12 +49,12 @@ args=($temp)
|
||||||
|
|
||||||
dockerbuild()
|
dockerbuild()
|
||||||
{
|
{
|
||||||
BUILD_COMMAND=/opt/code/run_build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@"
|
BUILD_COMMAND=/opt/code/run-build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if we need to build in docker
|
# Check if we need to build in docker
|
||||||
if [ ! -z "$BUILD_IN_DOCKER" ]; then
|
if [ ! -z "$BUILD_IN_DOCKER" ]; then
|
||||||
dockerbuild "${args[@]}"
|
dockerbuild "${args[@]}"
|
||||||
else
|
else
|
||||||
$DIR/run_build.sh "${args[@]}"
|
$DIR/run-build.sh "${args[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -72,12 +72,6 @@
|
||||||
|
|
||||||
<BinariesToRemove Include="csc" />
|
<BinariesToRemove Include="csc" />
|
||||||
<BinariesToRemove Include="vbc" />
|
<BinariesToRemove Include="vbc" />
|
||||||
|
|
||||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.targets" />
|
|
||||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.Targets" />
|
|
||||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.props" />
|
|
||||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.overridetasks" />
|
|
||||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.tasks" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Delete Files="@(BinObj)" />
|
<Delete Files="@(BinObj)" />
|
||||||
|
@ -155,8 +149,16 @@
|
||||||
Lines="$(CommitHash);$(SdkVersion)"
|
Lines="$(CommitHash);$(SdkVersion)"
|
||||||
Overwrite="true" />
|
Overwrite="true" />
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.targets" />
|
||||||
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.Targets" />
|
||||||
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.props" />
|
||||||
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.overridetasks" />
|
||||||
|
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.tasks" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Copy SourceFiles="@(MSBuildTargetsToCopy)"
|
<Copy SourceFiles="@(MSBuildTargetsToCopy)"
|
||||||
DestinationFiles="@(MSBuildTargetsToCopy->'$(SdkOutputDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
DestinationFiles="@(MSBuildTargetsToCopy->'$(SdkOutputDirectory)\%(Filename)%(Extension)')" />
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
|
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
|
||||||
|
|
|
@ -126,21 +126,21 @@
|
||||||
</_DownloadAndExtractItem>
|
</_DownloadAndExtractItem>
|
||||||
|
|
||||||
<_DownloadAndExtractItem Include="DownloadedSharedFrameworkInstallerFile"
|
<_DownloadAndExtractItem Include="DownloadedSharedFrameworkInstallerFile"
|
||||||
Condition="!Exists('$(DownloadedSharedFrameworkInstallerFile)')">
|
Condition="!Exists('$(DownloadedSharedFrameworkInstallerFile)') And '$(InstallerExtension)' != ''">
|
||||||
<Url>$(CoreSetupInstallerBlobRootUrl)/$(SharedFrameworkVersion)/$(DownloadedSharedFrameworkInstallerFileName)</Url>
|
<Url>$(CoreSetupInstallerBlobRootUrl)/$(SharedFrameworkVersion)/$(DownloadedSharedFrameworkInstallerFileName)</Url>
|
||||||
<DownloadFileName>$(DownloadedSharedFrameworkInstallerFile)</DownloadFileName>
|
<DownloadFileName>$(DownloadedSharedFrameworkInstallerFile)</DownloadFileName>
|
||||||
<ExtractDestintation></ExtractDestintation>
|
<ExtractDestintation></ExtractDestintation>
|
||||||
</_DownloadAndExtractItem>
|
</_DownloadAndExtractItem>
|
||||||
|
|
||||||
<_DownloadAndExtractItem Include="DownloadedSharedHostInstallerFile"
|
<_DownloadAndExtractItem Include="DownloadedSharedHostInstallerFile"
|
||||||
Condition="!Exists('$(DownloadedSharedHostInstallerFile)')">
|
Condition="!Exists('$(DownloadedSharedHostInstallerFile)') And '$(InstallerExtension)' != ''">
|
||||||
<Url>$(CoreSetupInstallerBlobRootUrl)/$(SharedHostVersion)/$(DownloadedSharedHostInstallerFileName)</Url>
|
<Url>$(CoreSetupInstallerBlobRootUrl)/$(SharedHostVersion)/$(DownloadedSharedHostInstallerFileName)</Url>
|
||||||
<DownloadFileName>$(DownloadedSharedHostInstallerFile)</DownloadFileName>
|
<DownloadFileName>$(DownloadedSharedHostInstallerFile)</DownloadFileName>
|
||||||
<ExtractDestintation></ExtractDestintation>
|
<ExtractDestintation></ExtractDestintation>
|
||||||
</_DownloadAndExtractItem>
|
</_DownloadAndExtractItem>
|
||||||
|
|
||||||
<_DownloadAndExtractItem Include="DownloadedHostFxrInstallerFile"
|
<_DownloadAndExtractItem Include="DownloadedHostFxrInstallerFile"
|
||||||
Condition="!Exists('$(DownloadedHostFxrInstallerFile)')">
|
Condition="!Exists('$(DownloadedHostFxrInstallerFile)') And '$(InstallerExtension)' != ''">
|
||||||
<Url>$(CoreSetupInstallerBlobRootUrl)/$(HostFxrVersion)/$(DownloadedHostFxrInstallerFileName)</Url>
|
<Url>$(CoreSetupInstallerBlobRootUrl)/$(HostFxrVersion)/$(DownloadedHostFxrInstallerFileName)</Url>
|
||||||
<DownloadFileName>$(DownloadedHostFxrInstallerFile)</DownloadFileName>
|
<DownloadFileName>$(DownloadedHostFxrInstallerFile)</DownloadFileName>
|
||||||
<ExtractDestintation></ExtractDestintation>
|
<ExtractDestintation></ExtractDestintation>
|
||||||
|
|
|
@ -25,7 +25,7 @@ $AppPath = "$PSScriptRoot"
|
||||||
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
||||||
if (!$env:DOTNET_INSTALL_DIR)
|
if (!$env:DOTNET_INSTALL_DIR)
|
||||||
{
|
{
|
||||||
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\Windows\$Architecture"
|
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install a stage 0
|
# Install a stage 0
|
||||||
|
|
35
init-tools.ps1
Normal file
35
init-tools.ps1
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Load Branch Info
|
||||||
|
cat "$RepoRoot\branchinfo.txt" | ForEach-Object {
|
||||||
|
if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) {
|
||||||
|
$splat = $_.Split([char[]]@("="), 2)
|
||||||
|
Set-Content "env:\$($splat[0])" -Value $splat[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
||||||
|
if (!$env:DOTNET_INSTALL_DIR)
|
||||||
|
{
|
||||||
|
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
|
||||||
|
{
|
||||||
|
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install a stage 0
|
||||||
|
Write-Host "Installing .NET Core CLI Stage 0 from branchinfo channel"
|
||||||
|
|
||||||
|
& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Channel $env:CHANNEL -Architecture $Architecture -Verbose
|
||||||
|
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
||||||
|
|
||||||
|
# Put the stage0 on the path
|
||||||
|
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
||||||
|
|
||||||
|
# Disable first run since we want to control all package sources
|
||||||
|
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
42
run_build.sh → init-tools.sh
Executable file → Normal file
42
run_build.sh → init-tools.sh
Executable file → Normal file
|
@ -13,44 +13,6 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
|
||||||
[[ "$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
|
[[ "$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
|
done
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
OLDPATH="$PATH"
|
|
||||||
|
|
||||||
ARCHITECTURE="x64"
|
|
||||||
REPOROOT="$DIR"
|
|
||||||
source "$REPOROOT/scripts/common/_prettyprint.sh"
|
|
||||||
|
|
||||||
while [[ $# > 0 ]]; do
|
|
||||||
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
|
||||||
case $lowerI in
|
|
||||||
-c|--configuration)
|
|
||||||
export CONFIGURATION=$2
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--nopackage)
|
|
||||||
export DOTNET_BUILD_SKIP_PACKAGING=1
|
|
||||||
;;
|
|
||||||
--skip-prereqs)
|
|
||||||
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
|
|
||||||
export DOTNET_INSTALL_SKIP_PREREQS=1
|
|
||||||
;;
|
|
||||||
--help)
|
|
||||||
echo "Usage: $0 [--configuration <CONFIGURATION>] [--targets <TARGETS...>] [--skip-prereqs] [--nopackage] [--docker <IMAGENAME>] [--help]"
|
|
||||||
echo ""
|
|
||||||
echo "Options:"
|
|
||||||
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
|
||||||
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
|
|
||||||
echo " --nopackage Skip packaging targets"
|
|
||||||
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
|
|
||||||
echo " --help Display this help message"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
# Set nuget package cache under the repo
|
# Set nuget package cache under the repo
|
||||||
export NUGET_PACKAGES="$REPOROOT/.nuget/packages"
|
export NUGET_PACKAGES="$REPOROOT/.nuget/packages"
|
||||||
|
@ -97,6 +59,4 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable first run since we want to control all package sources
|
# Disable first run since we want to control all package sources
|
||||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
|
||||||
dotnet build3 build.proj /p:Architecture=$ARCHITECTURE
|
|
|
@ -34,36 +34,8 @@ else
|
||||||
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load Branch Info
|
& "$RepoRoot\init-tools.ps1"
|
||||||
cat "$RepoRoot\branchinfo.txt" | ForEach-Object {
|
if($LASTEXITCODE -ne 0) { throw "Failed to install Init Tools" }
|
||||||
if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) {
|
|
||||||
$splat = $_.Split([char[]]@("="), 2)
|
|
||||||
Set-Content "env:\$($splat[0])" -Value $splat[1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
dotnet build3 build.proj /p:Architecture=$Architecture
|
||||||
if (!$env:DOTNET_INSTALL_DIR)
|
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
|
||||||
{
|
|
||||||
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
|
|
||||||
{
|
|
||||||
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install a stage 0
|
|
||||||
Write-Host "Installing .NET Core CLI Stage 0 from branchinfo channel"
|
|
||||||
|
|
||||||
& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Channel $env:CHANNEL -Architecture $Architecture -Verbose
|
|
||||||
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
|
||||||
|
|
||||||
# Put the stage0 on the path
|
|
||||||
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
|
||||||
|
|
||||||
# Disable first run since we want to control all package sources
|
|
||||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|
||||||
|
|
||||||
dotnet build3 build.proj /p:Architecture=x64
|
|
||||||
if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
|
|
57
run-build.sh
Normal file
57
run-build.sh
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/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 )"
|
||||||
|
OLDPATH="$PATH"
|
||||||
|
|
||||||
|
ARCHITECTURE="x64"
|
||||||
|
REPOROOT="$DIR"
|
||||||
|
source "$REPOROOT/scripts/common/_prettyprint.sh"
|
||||||
|
|
||||||
|
while [[ $# > 0 ]]; do
|
||||||
|
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
||||||
|
case $lowerI in
|
||||||
|
-c|--configuration)
|
||||||
|
export CONFIGURATION=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--nopackage)
|
||||||
|
export DOTNET_BUILD_SKIP_PACKAGING=1
|
||||||
|
;;
|
||||||
|
--skip-prereqs)
|
||||||
|
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
|
||||||
|
export DOTNET_INSTALL_SKIP_PREREQS=1
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
echo "Usage: $0 [--configuration <CONFIGURATION>] [--targets <TARGETS...>] [--skip-prereqs] [--nopackage] [--docker <IMAGENAME>] [--help]"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
||||||
|
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
|
||||||
|
echo " --nopackage Skip packaging targets"
|
||||||
|
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
|
||||||
|
echo " --help Display this help message"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
$REPOROOT/init-tools.sh
|
||||||
|
|
||||||
|
dotnet build3 build.proj /p:Architecture=$ARCHITECTURE
|
Loading…
Reference in a new issue