Merge pull request #3787 from livarcocc/msbuild_by_default
Msbuild by default
This commit is contained in:
commit
9610500efc
15 changed files with 152 additions and 184 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 "%~dp0build_projects\dotnet-cli-build\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%
|
||||||
|
|
16
build.proj
16
build.proj
|
@ -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>
|
||||||
|
@ -30,6 +27,11 @@
|
||||||
|
|
||||||
<CoreCLRVersion>1.0.2</CoreCLRVersion>
|
<CoreCLRVersion>1.0.2</CoreCLRVersion>
|
||||||
<JitVersion>1.0.2</JitVersion>
|
<JitVersion>1.0.2</JitVersion>
|
||||||
|
|
||||||
|
<Stage0Path>$(RepoRoot)/.dotnet_stage0/$(Architecture)</Stage0Path>
|
||||||
|
<ExeExtension>.exe</ExeExtension>
|
||||||
|
<ExeExtension Condition=" '$(OS)' != 'Windows_NT' "></ExeExtension>
|
||||||
|
<DotnetStage0>$(Stage0Path)/dotnet$(ExeExtension)</DotnetStage0>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -48,7 +50,13 @@
|
||||||
Inputs="@(DotnetCliBuildFrameworkInputs)"
|
Inputs="@(DotnetCliBuildFrameworkInputs)"
|
||||||
Outputs="$(CLIBuildDll)"
|
Outputs="$(CLIBuildDll)"
|
||||||
DependsOnTargets="MSBuildWorkaroundTarget">
|
DependsOnTargets="MSBuildWorkaroundTarget">
|
||||||
<Exec Command="$(PlatformScriptHost) $(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build/build$(PlatformScriptExtension) $(NoRunArg)" WorkingDirectory="$(MSBuildThisFileDirectory)"/>
|
<PropertyGroup>
|
||||||
|
<DotnetCliBuildDirectory>$(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build</DotnetCliBuildDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Exec Command="$(DotnetStage0) restore" WorkingDirectory="$(DotnetCliBuildDirectory)"/>
|
||||||
|
|
||||||
|
<Exec Command="$(DotnetStage0) publish -o $(DotnetCliBuildDirectory)/bin --framework netcoreapp1.0" WorkingDirectory="$(DotnetCliBuildDirectory)"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>
|
<Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>
|
||||||
|
|
4
build.sh
4
build.sh
|
@ -49,12 +49,12 @@ args=($temp)
|
||||||
|
|
||||||
dockerbuild()
|
dockerbuild()
|
||||||
{
|
{
|
||||||
BUILD_COMMAND=/opt/code/build_projects/dotnet-cli-build/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/build_projects/dotnet-cli-build/build.sh "${args[@]}"
|
$DIR/run-build.sh "${args[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<Inputs>@(CompileStageInputs)</Inputs>
|
<Inputs>@(CompileStageInputs)</Inputs>
|
||||||
<StageDirectory>$(Stage1Directory)</StageDirectory>
|
<StageDirectory>$(Stage1Directory)</StageDirectory>
|
||||||
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
|
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
|
||||||
<DotnetExe>$(Stage0Path)/dotnet$(ExeExtension)</DotnetExe>
|
<DotnetExe>$(DotnetStage0)</DotnetExe>
|
||||||
</Stage>
|
</Stage>
|
||||||
<Stage Include="Stage2">
|
<Stage Include="Stage2">
|
||||||
<Inputs>@(CompileStageInputs)</Inputs>
|
<Inputs>@(CompileStageInputs)</Inputs>
|
||||||
|
@ -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,6 +149,14 @@
|
||||||
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)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,6 @@
|
||||||
|
|
||||||
<!-- Common Properties -->
|
<!-- Common Properties -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Stage0Path Condition=" '$(OSName)' == 'win' ">$(RepoRoot)/.dotnet_stage0/Windows/$(Architecture)</Stage0Path>
|
|
||||||
<Stage0Path Condition=" '$(OSName)' == 'osx' ">$(RepoRoot)/.dotnet_stage0/Darwin</Stage0Path>
|
|
||||||
<Stage0Path Condition=" '$(Stage0Path)' == '' ">$(RepoRoot)/.dotnet_stage0/Linux</Stage0Path>
|
|
||||||
<ExeExtension>.exe</ExeExtension>
|
|
||||||
<ExeExtension Condition="'$OSName)' != 'win' "></ExeExtension>
|
|
||||||
<DotNetPath>$(Stage0Path)</DotNetPath>
|
<DotNetPath>$(Stage0Path)</DotNetPath>
|
||||||
|
|
||||||
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
|
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
|
||||||
|
@ -131,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>
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<UsingTask TaskName="DebTargets" AssemblyFile="$(CLIBuildDll)" />
|
<UsingTask TaskName="DebTargets" AssemblyFile="$(CLIBuildDll)" />
|
||||||
|
|
||||||
<Target Name="GenerateDebs" >
|
<Target Name="GenerateDebs" >
|
||||||
<DebTargets />
|
<DebTargets CLISDKRoot="$(LayoutDirectory)/$(ArtifactNameSdk)/sdk" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.Build.Framework;
|
||||||
using Microsoft.DotNet.Cli.Build.Framework;
|
using Microsoft.DotNet.Cli.Build.Framework;
|
||||||
using Microsoft.DotNet.InternalAbstractions;
|
using Microsoft.DotNet.InternalAbstractions;
|
||||||
|
|
||||||
|
@ -13,6 +14,9 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
public class DebTargets : Task
|
public class DebTargets : Task
|
||||||
{
|
{
|
||||||
|
[Required]
|
||||||
|
public string CLISDKRoot { get; set; }
|
||||||
|
|
||||||
public override bool Execute()
|
public override bool Execute()
|
||||||
{
|
{
|
||||||
BuildContext context = new BuildSetup("MSBuild").UseAllTargetsFromAssembly<DebTargets>().CreateBuildContext();
|
BuildContext context = new BuildSetup("MSBuild").UseAllTargetsFromAssembly<DebTargets>().CreateBuildContext();
|
||||||
|
@ -21,7 +25,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return GenerateDebs(c).Success;
|
return GenerateDebs(c).Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BuildTargetResult GenerateDebs(BuildTargetContext c)
|
public BuildTargetResult GenerateDebs(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
if (CurrentPlatform.IsPlatform(BuildPlatform.Ubuntu))
|
if (CurrentPlatform.IsPlatform(BuildPlatform.Ubuntu))
|
||||||
{
|
{
|
||||||
|
@ -32,7 +36,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BuildTargetResult GenerateSdkDeb(BuildTargetContext c)
|
public BuildTargetResult GenerateSdkDeb(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
if (CurrentPlatform.IsPlatform(BuildPlatform.Ubuntu))
|
if (CurrentPlatform.IsPlatform(BuildPlatform.Ubuntu))
|
||||||
{
|
{
|
||||||
|
@ -53,7 +57,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
var debFile = c.BuildContext.Get<string>("SdkInstallerFile");
|
var debFile = c.BuildContext.Get<string>("SdkInstallerFile");
|
||||||
var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");
|
var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");
|
||||||
var previousVersionURL = $"https://dotnetcli.blob.core.windows.net/dotnet/{channel}/Installers/Latest/dotnet-ubuntu-x64.latest.deb";
|
var previousVersionURL = $"https://dotnetcli.blob.core.windows.net/dotnet/{channel}/Installers/Latest/dotnet-ubuntu-x64.latest.deb";
|
||||||
var sdkPublishRoot = c.BuildContext.Get<string>("CLISDKRoot");
|
|
||||||
var sharedFxDebianPackageName = Monikers.GetDebianSharedFrameworkPackageName(CliDependencyVersions.SharedFrameworkVersion);
|
var sharedFxDebianPackageName = Monikers.GetDebianSharedFrameworkPackageName(CliDependencyVersions.SharedFrameworkVersion);
|
||||||
|
|
||||||
var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sdk");
|
var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sdk");
|
||||||
|
@ -67,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-debian.sh"),
|
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-debian.sh"),
|
||||||
"-v", version,
|
"-v", version,
|
||||||
"-i", sdkPublishRoot,
|
"-i", CLISDKRoot,
|
||||||
"-o", debFile,
|
"-o", debFile,
|
||||||
"-p", packageName,
|
"-p", packageName,
|
||||||
"-b", Monikers.CLISdkBrandName,
|
"-b", Monikers.CLISdkBrandName,
|
||||||
|
|
|
@ -6,9 +6,14 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
public static BuildTargetResult GenerateInstaller(BuildTargetContext c)
|
public static BuildTargetResult GenerateInstaller(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
|
var debTargets = new DebTargets
|
||||||
|
{
|
||||||
|
CLISDKRoot = c.BuildContext.Get<string>("CLISDKRoot")
|
||||||
|
};
|
||||||
|
|
||||||
MsiTargets.GenerateMsisAndBundles(c);
|
MsiTargets.GenerateMsisAndBundles(c);
|
||||||
PkgTargets.GeneratePkgs(c);
|
PkgTargets.GeneratePkgs(c);
|
||||||
DebTargets.GenerateDebs(c);
|
debTargets.GenerateDebs(c);
|
||||||
|
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
param(
|
|
||||||
[string]$Configuration="Debug",
|
|
||||||
[string[]]$Targets=@("Default"),
|
|
||||||
[string]$Architecture="x64",
|
|
||||||
[switch]$NoPackage,
|
|
||||||
[switch]$NoRun,
|
|
||||||
[switch]$Help)
|
|
||||||
|
|
||||||
if($Help)
|
|
||||||
{
|
|
||||||
Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-Targets <TARGETS...>] [-Architecture <ARCHITECTURE>] [-NoPackage] [-Help]"
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "Options:"
|
|
||||||
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
|
||||||
Write-Host " -Targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
|
|
||||||
Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
|
|
||||||
Write-Host " -NoPackage Skip packaging targets"
|
|
||||||
Write-Host " -NoRun Skip running the build"
|
|
||||||
Write-Host " -Help Display this help message"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
$env:CONFIGURATION = $Configuration;
|
|
||||||
$RepoRoot = "$PSScriptRoot\..\.."
|
|
||||||
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
|
|
||||||
|
|
||||||
if($NoPackage)
|
|
||||||
{
|
|
||||||
$env:DOTNET_BUILD_SKIP_PACKAGING=1
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
|
||||||
}
|
|
||||||
|
|
||||||
# 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\Windows\$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
|
|
||||||
|
|
||||||
# Restore the build scripts
|
|
||||||
Write-Host "Restoring Build Script projects..."
|
|
||||||
pushd "$PSScriptRoot"
|
|
||||||
dotnet restore
|
|
||||||
if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
|
|
||||||
popd
|
|
||||||
|
|
||||||
# Publish the builder
|
|
||||||
Write-Host "Compiling Build Scripts..."
|
|
||||||
dotnet publish "$PSScriptRoot" -o "$PSScriptRoot\bin" --framework netcoreapp1.0
|
|
||||||
if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
|
|
||||||
|
|
||||||
if(!$NoRun)
|
|
||||||
{
|
|
||||||
# Run the builder
|
|
||||||
Write-Host "Invoking Build Scripts..."
|
|
||||||
Write-Host " Configuration: $env:CONFIGURATION"
|
|
||||||
& "$PSScriptRoot\bin\dotnet-cli-build.exe" @Targets
|
|
||||||
if($LASTEXITCODE -ne 0) { throw "Build failed" }
|
|
||||||
}
|
|
|
@ -55,17 +55,9 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
private static string GetStage0Path()
|
private static string GetStage0Path()
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
return Path.Combine(Directory.GetCurrentDirectory(),
|
||||||
{
|
".dotnet_stage0",
|
||||||
return Path.Combine(Directory.GetCurrentDirectory(), ".dotnet_stage0",
|
|
||||||
RuntimeEnvironment.OperatingSystemPlatform.ToString(),
|
|
||||||
RuntimeEnvironment.RuntimeArchitecture);
|
RuntimeEnvironment.RuntimeArchitecture);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return Path.Combine(Directory.GetCurrentDirectory(), ".dotnet_stage0", RuntimeEnvironment.OperatingSystemPlatform.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
40
init-tools.ps1
Normal file
40
init-tools.ps1
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
param(
|
||||||
|
[string]$Architecture="x64")
|
||||||
|
|
||||||
|
$RepoRoot = "$PSScriptRoot"
|
||||||
|
|
||||||
|
# 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
|
17
init-tools.sh
Executable file
17
init-tools.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/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 )"
|
||||||
|
|
||||||
|
$DIR/scripts/obtain/dotnet-install.sh --channel $CHANNEL --verbose
|
41
run-build.ps1
Normal file
41
run-build.ps1
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
param(
|
||||||
|
[string]$Configuration="Debug",
|
||||||
|
[string]$Architecture="x64",
|
||||||
|
[switch]$NoPackage,
|
||||||
|
[switch]$Help)
|
||||||
|
|
||||||
|
if($Help)
|
||||||
|
{
|
||||||
|
Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-Architecture <ARCHITECTURE>] [-NoPackage] [-Help]"
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Options:"
|
||||||
|
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
||||||
|
Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
|
||||||
|
Write-Host " -NoPackage Skip packaging targets"
|
||||||
|
Write-Host " -Help Display this help message"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
$env:CONFIGURATION = $Configuration;
|
||||||
|
$RepoRoot = "$PSScriptRoot"
|
||||||
|
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
|
||||||
|
|
||||||
|
if($NoPackage)
|
||||||
|
{
|
||||||
|
$env:DOTNET_BUILD_SKIP_PACKAGING=1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
||||||
|
}
|
||||||
|
|
||||||
|
& "$RepoRoot\init-tools.ps1" -Architecture $Architecture
|
||||||
|
if($LASTEXITCODE -ne 0) { throw "Failed to install Init Tools" }
|
||||||
|
|
||||||
|
dotnet build3 build.proj /p:Architecture=$Architecture
|
||||||
|
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
|
|
@ -13,11 +13,15 @@ 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 )"
|
||||||
|
REPOROOT="$DIR"
|
||||||
OLDPATH="$PATH"
|
OLDPATH="$PATH"
|
||||||
|
|
||||||
REPOROOT="$DIR/../.."
|
ARCHITECTURE="x64"
|
||||||
source "$REPOROOT/scripts/common/_prettyprint.sh"
|
source "$REPOROOT/scripts/common/_prettyprint.sh"
|
||||||
|
|
||||||
|
# Set nuget package cache under the repo
|
||||||
|
export NUGET_PACKAGES="$REPOROOT/.nuget/packages"
|
||||||
|
|
||||||
while [[ $# > 0 ]]; do
|
while [[ $# > 0 ]]; do
|
||||||
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
||||||
case $lowerI in
|
case $lowerI in
|
||||||
|
@ -25,16 +29,9 @@ while [[ $# > 0 ]]; do
|
||||||
export CONFIGURATION=$2
|
export CONFIGURATION=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--targets)
|
|
||||||
IFS=',' read -r -a targets <<< $2
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--nopackage)
|
--nopackage)
|
||||||
export DOTNET_BUILD_SKIP_PACKAGING=1
|
export DOTNET_BUILD_SKIP_PACKAGING=1
|
||||||
;;
|
;;
|
||||||
--norun)
|
|
||||||
export DOTNET_BUILD_SKIP_RUN=1
|
|
||||||
;;
|
|
||||||
--skip-prereqs)
|
--skip-prereqs)
|
||||||
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
|
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
|
||||||
export DOTNET_INSTALL_SKIP_PREREQS=1
|
export DOTNET_INSTALL_SKIP_PREREQS=1
|
||||||
|
@ -44,10 +41,8 @@ while [[ $# > 0 ]]; do
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
||||||
echo " --targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
|
|
||||||
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
|
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
|
||||||
echo " --nopackage Skip packaging targets"
|
echo " --nopackage Skip packaging targets"
|
||||||
echo " --norun Skip running the build"
|
|
||||||
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
|
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
|
||||||
echo " --help Display this help message"
|
echo " --help Display this help message"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -60,25 +55,6 @@ while [[ $# > 0 ]]; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
# Set nuget package cache under the repo
|
|
||||||
export NUGET_PACKAGES="$REPOROOT/.nuget/packages"
|
|
||||||
|
|
||||||
# Set up the environment to be used for building with clang.
|
|
||||||
if which "clang-3.5" > /dev/null 2>&1; then
|
|
||||||
export CC="$(which clang-3.5)"
|
|
||||||
export CXX="$(which clang++-3.5)"
|
|
||||||
elif which "clang-3.6" > /dev/null 2>&1; then
|
|
||||||
export CC="$(which clang-3.6)"
|
|
||||||
export CXX="$(which clang++-3.6)"
|
|
||||||
elif which clang > /dev/null 2>&1; then
|
|
||||||
export CC="$(which clang)"
|
|
||||||
export CXX="$(which clang++)"
|
|
||||||
else
|
|
||||||
error "Unable to find Clang Compiler"
|
|
||||||
error "Install clang-3.5 or clang3.6"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load Branch Info
|
# Load Branch Info
|
||||||
while read line; do
|
while read line; do
|
||||||
if [[ $line != \#* ]]; then
|
if [[ $line != \#* ]]; then
|
||||||
|
@ -88,10 +64,10 @@ while read line; do
|
||||||
done < "$REPOROOT/branchinfo.txt"
|
done < "$REPOROOT/branchinfo.txt"
|
||||||
|
|
||||||
# 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
|
||||||
[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$(uname)
|
[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$ARCHITECTURE
|
||||||
[ -d "$DOTNET_INSTALL_DIR" ] || mkdir -p $DOTNET_INSTALL_DIR
|
[ -d "$DOTNET_INSTALL_DIR" ] || mkdir -p $DOTNET_INSTALL_DIR
|
||||||
|
|
||||||
$REPOROOT/scripts/obtain/dotnet-install.sh --channel $CHANNEL --verbose
|
$REPOROOT/init-tools.sh
|
||||||
|
|
||||||
# Put stage 0 on the PATH (for this shell only)
|
# Put stage 0 on the PATH (for this shell only)
|
||||||
PATH="$DOTNET_INSTALL_DIR:$PATH"
|
PATH="$DOTNET_INSTALL_DIR:$PATH"
|
||||||
|
@ -107,23 +83,4 @@ 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
|
||||||
|
|
||||||
# Restore the build scripts
|
dotnet build3 build.proj /p:Architecture=$ARCHITECTURE
|
||||||
echo "Restoring Build Script projects..."
|
|
||||||
(
|
|
||||||
cd "$DIR"
|
|
||||||
dotnet restore
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build the builder
|
|
||||||
echo "Compiling Build Scripts..."
|
|
||||||
dotnet publish "$DIR" -o "$DIR/bin" --framework netcoreapp1.0
|
|
||||||
|
|
||||||
if [ -z "$DOTNET_BUILD_SKIP_RUN" ]; then
|
|
||||||
export PATH="$OLDPATH"
|
|
||||||
# Run the builder
|
|
||||||
echo "Invoking Build Scripts..."
|
|
||||||
echo "Configuration: $CONFIGURATION"
|
|
||||||
|
|
||||||
$DIR/bin/dotnet-cli-build ${targets[@]}
|
|
||||||
fi
|
|
||||||
exit $?
|
|
Loading…
Reference in a new issue