Add msbuild-based stage0 where possible (#4597)

* Add msbuild-based stage0 where possible

* Fix bash initialization script

* Windows Fixes

* Fix dotnet deb tool
This commit is contained in:
Piotr Puszkiewicz 2016-11-02 23:01:57 -07:00 committed by GitHub
parent 14c285db1c
commit fd9cb55f1a
21 changed files with 218 additions and 230 deletions

View file

@ -32,7 +32,9 @@
<ExeExtension Condition=" '$(OS)' != 'Windows_NT' "></ExeExtension> <ExeExtension Condition=" '$(OS)' != 'Windows_NT' "></ExeExtension>
<Stage0Directory>$(RepoRoot)/.dotnet_stage0/$(Architecture)</Stage0Directory> <Stage0Directory>$(RepoRoot)/.dotnet_stage0/$(Architecture)</Stage0Directory>
<Stage0PjDirectory>$(RepoRoot)/.dotnet_stage0PJ/$(Architecture)</Stage0PjDirectory>
<DotnetStage0>$(Stage0Directory)/dotnet$(ExeExtension)</DotnetStage0> <DotnetStage0>$(Stage0Directory)/dotnet$(ExeExtension)</DotnetStage0>
<DotnetStage0Pj>$(Stage0PjDirectory)/dotnet$(ExeExtension)</DotnetStage0Pj>
<DotnetCliBuildDirectory>$(RepoRoot)/build_projects/dotnet-cli-build</DotnetCliBuildDirectory> <DotnetCliBuildDirectory>$(RepoRoot)/build_projects/dotnet-cli-build</DotnetCliBuildDirectory>
<PackagesDir>$(RepoRoot)/.nuget</PackagesDir> <PackagesDir>$(RepoRoot)/.nuget</PackagesDir>
</PropertyGroup> </PropertyGroup>
@ -55,7 +57,8 @@
DependsOnTargets="MSBuildWorkaroundTarget; DependsOnTargets="MSBuildWorkaroundTarget;
RestoreDotnetCliBuildFramework"> RestoreDotnetCliBuildFramework">
<Exec Command="$(DotnetStage0) publish3 -o $(DotnetCliBuildDirectory)/bin --framework netcoreapp1.0" WorkingDirectory="$(DotnetCliBuildDirectory)"/> <Exec Command="$(DotnetStage0) publish -o $(DotnetCliBuildDirectory)/bin --framework netcoreapp1.0"
WorkingDirectory="$(DotnetCliBuildDirectory)"/>
</Target> </Target>
<ItemGroup> <ItemGroup>
@ -72,7 +75,8 @@
<ExtraRestoreArgs Condition="'$(OS)' != 'Windows_NT'">$(ExtraRestoreArgs) --disable-parallel</ExtraRestoreArgs> <ExtraRestoreArgs Condition="'$(OS)' != 'Windows_NT'">$(ExtraRestoreArgs) --disable-parallel</ExtraRestoreArgs>
</PropertyGroup> </PropertyGroup>
<Exec Command="$(DotnetStage0) restore3 $(ExtraRestoreArgs)" WorkingDirectory="$(DotnetCliBuildDirectory)"/> <Exec Command="$(DotnetStage0) restore $(ExtraRestoreArgs)"
WorkingDirectory="$(DotnetCliBuildDirectory)"/>
</Target> </Target>
<Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target> <Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>

View file

@ -103,7 +103,7 @@
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" /> DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<!-- Publish DotNet --> <!-- Publish DotNet -->
<DotNetPublishMsbuildLegacy ToolPath="%(Stage.DotnetDir)" <DotNetPublish ToolPath="%(Stage.DotnetDir)"
Output="$(SdkOutputDirectory)" Output="$(SdkOutputDirectory)"
Configuration="$(Configuration)" Configuration="$(Configuration)"
VersionSuffix="$(CommitCount)" VersionSuffix="$(CommitCount)"

View file

@ -33,6 +33,7 @@
<IsDesktopAvailable>False</IsDesktopAvailable> <IsDesktopAvailable>False</IsDesktopAvailable>
<IsDesktopAvailable Condition=" '$(OSName)' == 'win' ">True</IsDesktopAvailable> <IsDesktopAvailable Condition=" '$(OSName)' == 'win' ">True</IsDesktopAvailable>
<DotNetPath>$(Stage0Directory)</DotNetPath> <DotNetPath>$(Stage0Directory)</DotNetPath>
<DotNetPjPath>$(Stage0PjDirectory)</DotNetPjPath>
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory> <BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
<ToolsOutputDirectory>$(BaseOutputDirectory)/tools</ToolsOutputDirectory> <ToolsOutputDirectory>$(BaseOutputDirectory)/tools</ToolsOutputDirectory>
@ -189,7 +190,8 @@
<CallTarget Targets="CleanSrcLockFiles" /> <CallTarget Targets="CleanSrcLockFiles" />
<DotNetRestoreMsbuildLegacy WorkingDirectory="%(RestoreSrcPackagesInput.RootDir)%(RestoreSrcPackagesInput.Directory)" ToolPath="$(DotNetPath)" Root="&quot;%(RestoreSrcPackagesInput.FullPath)&quot;" /> <DotNetRestore ToolPath="$(DotNetPath)"
Root="&quot;%(RestoreSrcPackagesInput.FullPath)&quot;" />
</Target> </Target>
@ -213,7 +215,8 @@
<CallTarget Targets="CleanToolsLockFiles" /> <CallTarget Targets="CleanToolsLockFiles" />
<DotNetRestoreMsbuildLegacy WorkingDirectory="%(RestoreToolsPackagesInput.RootDir)%(RestoreToolsPackagesInput.Directory)" ToolPath="$(DotNetPath)" Root="&quot;%(RestoreToolsPackagesInput.FullPath)&quot;" /> <DotNetRestore ToolPath="$(DotNetPath)"
Root="&quot;%(RestoreToolsPackagesInput.FullPath)&quot;" />
</Target> </Target>
@ -237,8 +240,10 @@
<CallTarget Targets="CleanSrcToolsProjectJsonLockFiles" /> <CallTarget Targets="CleanSrcToolsProjectJsonLockFiles" />
<DotNetRestore WorkingDirectory="$(RepoRoot)/src" ToolPath="$(DotNetPath)" /> <DotNetRestorePJ WorkingDirectory="$(RepoRoot)/src"
<DotNetRestore WorkingDirectory="$(RepoRoot)/tools" ToolPath="$(DotNetPath)" /> ToolPath="$(DotNetPjPath)" />
<DotNetRestorePJ WorkingDirectory="$(RepoRoot)/tools"
ToolPath="$(DotNetPjPath)" />
</Target> </Target>

View file

@ -14,6 +14,7 @@
DependsOnTargets="PrepareTests; DependsOnTargets="PrepareTests;
BuildTestAssets; BuildTestAssets;
BuildTests;"> BuildTests;">
<PropertyGroup> <PropertyGroup>
<PathListSeparator>:</PathListSeparator> <PathListSeparator>:</PathListSeparator>
<PathListSeparator Condition=" '$(OSName)' == 'win' ">%3b</PathListSeparator> <PathListSeparator Condition=" '$(OSName)' == 'win' ">%3b</PathListSeparator>
@ -39,7 +40,7 @@
EnvironmentVariables=$(RunTestEnvironmentVariables); EnvironmentVariables=$(RunTestEnvironmentVariables);
TestProjectName=%(TestProjects.OutputName); TestProjectName=%(TestProjects.OutputName);
TestResultXmlDir=$(TestResultXmlDir); TestResultXmlDir=$(TestResultXmlDir);
ToolPath=$(Stage0Directory); ToolPath=$(Stage0PjDirectory);
WorkingDirectory=%(TestProjects.ProjectDir) WorkingDirectory=%(TestProjects.ProjectDir)
</Properties> </Properties>
</ProjectsToTest> </ProjectsToTest>
@ -70,9 +71,10 @@
SetupTestProjectData;" SetupTestProjectData;"
Inputs="%(TestProjects.BuildInputs)" Inputs="%(TestProjects.BuildInputs)"
Outputs="%(TestProjects.BuildOutput)"> Outputs="%(TestProjects.BuildOutput)">
<DotNetBuild Configuration="$(Configuration)"
<DotNetBuildPj Configuration="$(Configuration)"
Framework="%(TestProjects.Framework)" Framework="%(TestProjects.Framework)"
ToolPath="$(Stage0Directory)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="%(TestProjects.RelativeDir)" /> WorkingDirectory="%(TestProjects.RelativeDir)" />
</Target> </Target>
@ -82,10 +84,11 @@
SetupRestoreTestsInputs;" SetupRestoreTestsInputs;"
Inputs="@(RestoreTestsInputs)" Inputs="@(RestoreTestsInputs)"
Outputs="@(RestoreTestsInputs->'%(RelativeDir)project.lock.json')"> Outputs="@(RestoreTestsInputs->'%(RelativeDir)project.lock.json')">
<CallTarget Targets="CleanTestProjectsLockFiles"/> <CallTarget Targets="CleanTestProjectsLockFiles"/>
<DotNetRestoreProjectJson FallbackSource="$(TestPackagesDir)" <DotNetRestorePj FallbackSource="$(TestPackagesDir)"
ToolPath="$(DotnetUnderTest)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="$(TestDirectory)" /> WorkingDirectory="$(TestDirectory)" />
</Target> </Target>
@ -124,9 +127,9 @@
Inputs="%(TestAssetProjects.BuildInputs)" Inputs="%(TestAssetProjects.BuildInputs)"
Outputs="%(TestAssetProjects.BuildOutput)"> Outputs="%(TestAssetProjects.BuildOutput)">
<DotNetBuild Framework="netcoreapp1.0" <DotNetBuildPj Framework="netcoreapp1.0"
ProjectPath="$(RepoRoot)%(TestAssetProjects.ProjectPath)" ProjectPath="$(RepoRoot)%(TestAssetProjects.ProjectPath)"
ToolPath="$(Stage0Directory)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="%(TestAssetProjects.RelativeDir)" /> WorkingDirectory="%(TestAssetProjects.RelativeDir)" />
</Target> </Target>
@ -136,8 +139,8 @@
Inputs="@(RestoreTestAssetProjectsInputs)" Inputs="@(RestoreTestAssetProjectsInputs)"
Outputs="@(RestoreTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')"> Outputs="@(RestoreTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')">
<DotNetRestoreProjectJson FallbackSource="$(TestPackagesDir)" <DotNetRestorePj FallbackSource="$(TestPackagesDir)"
ToolPath="$(DotnetUnderTest)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="$(RepoRoot)TestAssets/TestProjects/" /> WorkingDirectory="$(RepoRoot)TestAssets/TestProjects/" />
</Target> </Target>
@ -177,7 +180,7 @@
<DotNetBuild Configuration="$(Configuration)" <DotNetBuild Configuration="$(Configuration)"
Framework="net46" Framework="net46"
ProjectPath="%(BuildableDesktopTestAssetProjects.FullPath)" ProjectPath="%(BuildableDesktopTestAssetProjects.FullPath)"
ToolPath="$(Stage0Directory)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="%(BuildableDesktopTestAssetProjects.RelativeDir)" /> WorkingDirectory="%(BuildableDesktopTestAssetProjects.RelativeDir)" />
</Target> </Target>
@ -188,8 +191,8 @@
Inputs="@(RestoreDesktopTestAssetProjectsInputs)" Inputs="@(RestoreDesktopTestAssetProjectsInputs)"
Outputs="@(RestoreDesktopTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')"> Outputs="@(RestoreDesktopTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')">
<DotNetRestoreProjectJson FallbackSource="$(TestPackagesDir)" <DotNetRestorePj FallbackSource="$(TestPackagesDir)"
ToolPath="$(DotnetUnderTest)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="$(RepoRoot)TestAssets\DesktopTestProjects\" /> WorkingDirectory="$(RepoRoot)TestAssets\DesktopTestProjects\" />
</Target> </Target>
@ -205,11 +208,11 @@
Inputs="%(TestPackageProject.PackInputs)" Inputs="%(TestPackageProject.PackInputs)"
Outputs="%(TestPackageProject.PackOutputs)"> Outputs="%(TestPackageProject.PackOutputs)">
<DotNetPack BuildBasePath="$(TestPackagesBuildDir)" <DotNetPackPj BuildBasePath="$(TestPackagesBuildDir)"
NoBuild="True" NoBuild="True"
Output="$(TestPackagesDir)" Output="$(TestPackagesDir)"
ProjectPath="%(TestPackageProject.FullPath)" ProjectPath="%(TestPackageProject.FullPath)"
ToolPath="$(Stage0Directory)" ToolPath="$(Stage0PjDirectory)"
VersionSuffix="%(TestPackageProject.VersionSuffix)" /> VersionSuffix="%(TestPackageProject.VersionSuffix)" />
</Target> </Target>
@ -219,10 +222,10 @@
Inputs="%(TestPackageProject.BuildInputs)" Inputs="%(TestPackageProject.BuildInputs)"
Outputs="%(TestPackageProject.BuildOutputs)"> Outputs="%(TestPackageProject.BuildOutputs)">
<DotNetBuild BuildBasePath="$(TestPackagesBuildDir)" <DotNetBuildPj BuildBasePath="$(TestPackagesBuildDir)"
Framework="%(TestPackageProject.Framework)" Framework="%(TestPackageProject.Framework)"
ProjectPath="%(TestPackageProject.FullPath)" ProjectPath="%(TestPackageProject.FullPath)"
ToolPath="$(Stage0Directory)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="%(BuildableTestAssetProjects.RelativeDir)" /> WorkingDirectory="%(BuildableTestAssetProjects.RelativeDir)" />
</Target> </Target>
@ -232,7 +235,7 @@
Inputs="@(RestoreTestAssetPackageProjectsInputs)" Inputs="@(RestoreTestAssetPackageProjectsInputs)"
Outputs="@(RestoreTestAssetPackageProjectsInputs->'%(RelativeDir)/project.lock.json')"> Outputs="@(RestoreTestAssetPackageProjectsInputs->'%(RelativeDir)/project.lock.json')">
<DotNetRestoreProjectJson ToolPath="$(DotnetUnderTest)" <DotNetRestorePJ ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="$(RepoRoot)/TestAssets/TestPackages/" /> WorkingDirectory="$(RepoRoot)/TestAssets/TestPackages/" />
</Target> </Target>

View file

@ -8,15 +8,14 @@
<UsingTask TaskName="CreateAzureContainer" AssemblyFile="$(CLIBuildDll)"/> <UsingTask TaskName="CreateAzureContainer" AssemblyFile="$(CLIBuildDll)"/>
<UsingTask TaskName="Crossgen" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="Crossgen" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetBuild" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetBuild" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetBuildMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetBuildPJ" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetNew" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetNew" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetPack" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetPack" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetPackMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetPackPJ" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetPublish" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetPublish" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetPublishMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetPublishPJ" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetRestoreProjectJson" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetRestorePJ" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetRestoreMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DownloadFile" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DownloadFile" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="GenerateBuildVersionInfo" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="GenerateBuildVersionInfo" AssemblyFile="$(CLIBuildDll)" />

View file

@ -25,7 +25,7 @@
<Message Text="Publishing Archiver" /> <Message Text="Publishing Archiver" />
<DotNetPublishMsbuildLegacy ToolPath="$(Stage0Directory)" <DotNetPublish ToolPath="$(Stage0Directory)"
WorkingDirectory="$(RepoRoot)/tools/Archiver" WorkingDirectory="$(RepoRoot)/tools/Archiver"
Output="$(ToolsOutputDirectory)" Output="$(ToolsOutputDirectory)"
Configuration="$(Configuration)" Configuration="$(Configuration)"

View file

@ -49,7 +49,7 @@
ReplacementStrings="@(DebianConfigTokenValues -> '%(ReplacementString)')" /> ReplacementStrings="@(DebianConfigTokenValues -> '%(ReplacementString)')" />
<!-- Build SDK Deb package --> <!-- Build SDK Deb package -->
<DotNetDebTool ToolPath="$(Stage0Directory)" <DotNetDebTool ToolPath="$(Stage0PjDirectory)"
InputDirectory="$(LayoutDirectory)" InputDirectory="$(LayoutDirectory)"
OutputDirectory="$(DotNetDebToolOutputDirectory)" OutputDirectory="$(DotNetDebToolOutputDirectory)"
PackageName="$(SdkDebianPackageName)" PackageName="$(SdkDebianPackageName)"
@ -94,7 +94,7 @@
<!-- Run E2E --> <!-- Run E2E -->
<DotNetTest WorkingDirectory="$(EndToEndTestDirectory)" <DotNetTest WorkingDirectory="$(EndToEndTestDirectory)"
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)" EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
ToolPath="$(Stage0Directory)" ToolPath="$(Stage0PjDirectory)"
Xml="$(DebianTestResultsXmlFile)" /> Xml="$(DebianTestResultsXmlFile)" />
<!-- Clean up Packages --> <!-- Clean up Packages -->
@ -135,8 +135,8 @@
<Target Name="PrepareDotnetDebTool" <Target Name="PrepareDotnetDebTool"
DependsOnTargets="WriteDotnetDebToolProjectJson;"> DependsOnTargets="WriteDotnetDebToolProjectJson;">
<DotNetRestoreProjectJson FallbackSource="$(DotnetDebToolPackageSource)" <DotNetRestorePj FallbackSource="$(DotnetDebToolPackageSource)"
ToolPath="$(Stage2Directory)" ToolPath="$(Stage0PjDirectory)"
WorkingDirectory="$(DotnetDebToolDir)" /> WorkingDirectory="$(DotnetDebToolDir)" />
</Target> </Target>

View file

@ -144,7 +144,7 @@
<Exec Command ="powershell -NoProfile -NoLogo $(SdkTestMsiPowershellScript) <Exec Command ="powershell -NoProfile -NoLogo $(SdkTestMsiPowershellScript)
-InputMsi '$(SdkInstallerFile)' -InputMsi '$(SdkInstallerFile)'
-DotnetDir '$(Stage0Directory)'" /> -DotnetDir '$(Stage0PjDirectory)'" />
<WriteLinesToFile <WriteLinesToFile
File="$(SdkMsiTestedSentinel)" File="$(SdkMsiTestedSentinel)"

View file

@ -39,7 +39,7 @@
Inputs="@(ProjectPackTargetInputs -> '%(Identity)')" Inputs="@(ProjectPackTargetInputs -> '%(Identity)')"
Outputs="@(ProjectPackTargetOutputs -> '%(Identity)')"> Outputs="@(ProjectPackTargetOutputs -> '%(Identity)')">
<DotNetPackMsbuildLegacy NoBuild="True" <DotNetPack NoBuild="True"
Output="$(NupkgOutputDirectory)" Output="$(NupkgOutputDirectory)"
ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj" ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj"
ToolPath="$(Stage0Directory)" ToolPath="$(Stage0Directory)"
@ -48,12 +48,12 @@
</Target> </Target>
<Target Name="BuildProjectsForNuGetPackages" <Target Name="BuildProjectsForNuGetPackages"
DependsOnTargets="Init; DependsOnTargets="Init; SetupProjectsToPack"
SetupProjectsToPack"
Condition=" '$(OS)' == 'Windows_NT' "> Condition=" '$(OS)' == 'Windows_NT' ">
<MakeDir Directories="$(PackagingBuildBasePath)" /> <MakeDir Directories="$(PackagingBuildBasePath)" />
<DotNetBuildMsbuildLegacy ToolPath="$(Stage0Directory)" <DotNetBuild ToolPath="$(Stage0Directory)"
Configuration="$(Configuration)" Configuration="$(Configuration)"
ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj" /> ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj" />
</Target> </Target>

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build
protected override string Args protected override string Args
{ {
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetBuildBasePath()}"; } get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()}"; }
} }
public string BuildBasePath { get; set; } public string BuildBasePath { get; set; }
@ -23,16 +23,6 @@ namespace Microsoft.DotNet.Cli.Build
public string ProjectPath { get; set; } public string ProjectPath { get; set; }
private string GetBuildBasePath()
{
if (!string.IsNullOrEmpty(BuildBasePath))
{
return $"--build-base-path {BuildBasePath}";
}
return null;
}
private string GetConfiguration() private string GetConfiguration()
{ {
if (!string.IsNullOrEmpty(Configuration)) if (!string.IsNullOrEmpty(Configuration))

View file

@ -3,16 +3,16 @@
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
{ {
public class DotNetBuildMsbuildLegacy : DotNetTool public class DotNetBuildPJ : DotNetTool
{ {
protected override string Command protected override string Command
{ {
get { return "build3"; } get { return "build"; }
} }
protected override string Args protected override string Args
{ {
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()}"; } get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetBuildBasePath()}"; }
} }
public string BuildBasePath { get; set; } public string BuildBasePath { get; set; }
@ -23,6 +23,16 @@ namespace Microsoft.DotNet.Cli.Build
public string ProjectPath { get; set; } public string ProjectPath { get; set; }
private string GetBuildBasePath()
{
if (!string.IsNullOrEmpty(BuildBasePath))
{
return $"--build-base-path {BuildBasePath}";
}
return null;
}
private string GetConfiguration() private string GetConfiguration()
{ {
if (!string.IsNullOrEmpty(Configuration)) if (!string.IsNullOrEmpty(Configuration))

View file

@ -12,15 +12,13 @@ namespace Microsoft.DotNet.Cli.Build
protected override string Args protected override string Args
{ {
get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()}"; } get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetOutput()} {GetVersionSuffix()}"; }
} }
public string Configuration { get; set; } public string Configuration { get; set; }
public bool NoBuild { get; set; } public bool NoBuild { get; set; }
public string BuildBasePath { get; set; }
public string Output { get; set; } public string Output { get; set; }
public string ProjectPath { get; set; } public string ProjectPath { get; set; }
@ -47,16 +45,6 @@ namespace Microsoft.DotNet.Cli.Build
return null; return null;
} }
private string GetBuildBasePath()
{
if (!string.IsNullOrEmpty(BuildBasePath))
{
return $"--build-base-path {BuildBasePath}";
}
return null;
}
private string GetOutput() private string GetOutput()
{ {
if (!string.IsNullOrEmpty(Output)) if (!string.IsNullOrEmpty(Output))

View file

@ -3,22 +3,24 @@
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
{ {
public class DotNetPackMsbuildLegacy : DotNetTool public class DotNetPackPJ : DotNetTool
{ {
protected override string Command protected override string Command
{ {
get { return "pack3"; } get { return "pack"; }
} }
protected override string Args protected override string Args
{ {
get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetOutput()} {GetVersionSuffix()}"; } get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()}"; }
} }
public string Configuration { get; set; } public string Configuration { get; set; }
public bool NoBuild { get; set; } public bool NoBuild { get; set; }
public string BuildBasePath { get; set; }
public string Output { get; set; } public string Output { get; set; }
public string ProjectPath { get; set; } public string ProjectPath { get; set; }
@ -45,6 +47,16 @@ namespace Microsoft.DotNet.Cli.Build
return null; return null;
} }
private string GetBuildBasePath()
{
if (!string.IsNullOrEmpty(BuildBasePath))
{
return $"--build-base-path {BuildBasePath}";
}
return null;
}
private string GetOutput() private string GetOutput()
{ {
if (!string.IsNullOrEmpty(Output)) if (!string.IsNullOrEmpty(Output))

View file

@ -3,11 +3,11 @@
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
{ {
public class DotNetPublishMsbuildLegacy : DotNetTool public class DotNetPublishPJ : DotNetTool
{ {
protected override string Command protected override string Command
{ {
get { return "publish3"; } get { return "publish"; }
} }
protected override string Args protected override string Args

View file

@ -12,9 +12,11 @@ namespace Microsoft.DotNet.Cli.Build
protected override string Args protected override string Args
{ {
get { return $"{GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetDisableParallel()}"; } get { return $"{Root} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()}"; }
} }
public string Root { get; set; }
public string Source { get; set; } public string Source { get; set; }
public string Packages { get; set; } public string Packages { get; set; }
@ -50,10 +52,5 @@ namespace Microsoft.DotNet.Cli.Build
return null; return null;
} }
private string GetDisableParallel()
{
return "--disable-parallel";
}
} }
} }

View file

@ -1,56 +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.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetRestoreMsbuildLegacy : DotNetTool
{
protected override string Command
{
get { return "restore3"; }
}
protected override string Args
{
get { return $"{Root} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()}"; }
}
public string Root { get; set; }
public string Source { get; set; }
public string Packages { get; set; }
public bool SkipInvalidConfigurations { get; set; }
private string GetSource()
{
if (!string.IsNullOrEmpty(Source))
{
return $"--source {Source}";
}
return null;
}
private string GetPackages()
{
if (!string.IsNullOrEmpty(Packages))
{
return $"--packages {Packages}";
}
return null;
}
private string GetSkipInvalidConfigurations()
{
if (SkipInvalidConfigurations)
{
return "/p:SkipInvalidConfigurations=true";
}
return null;
}
}
}

View file

@ -0,0 +1,59 @@
// 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.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetRestorePJ : DotNetTool
{
protected override string Command
{
get { return "restore"; }
}
protected override string Args
{
get { return $"{GetVerbosity()} {GetFallbackSource()} {GetPackages()} {GetDisableParallel()}"; }
}
public string FallbackSource { get; set; }
public string Packages { get; set; }
public string Verbosity { get; set; }
private string GetFallbackSource()
{
if (!string.IsNullOrEmpty(FallbackSource))
{
return $"--fallbacksource {FallbackSource}";
}
return null;
}
private string GetPackages()
{
if (!string.IsNullOrEmpty(Packages))
{
return $"--packages {Packages}";
}
return null;
}
private string GetVerbosity()
{
if (!string.IsNullOrEmpty(Verbosity))
{
return $"--verbosity {Verbosity}";
}
return null;
}
private string GetDisableParallel()
{
return "--disable-parallel";
}
}
}

View file

@ -1,59 +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.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetRestoreProjectJson : DotNetTool
{
protected override string Command
{
get { return "restore-projectjson"; }
}
protected override string Args
{
get { return $"{GetVerbosity()} {GetFallbackSource()} {GetPackages()} {GetDisableParallel()}"; }
}
public string FallbackSource { get; set; }
public string Packages { get; set; }
public string Verbosity { get; set; }
private string GetFallbackSource()
{
if (!string.IsNullOrEmpty(FallbackSource))
{
return $"--fallbacksource {FallbackSource}";
}
return null;
}
private string GetPackages()
{
if (!string.IsNullOrEmpty(Packages))
{
return $"--packages {Packages}";
}
return null;
}
private string GetVerbosity()
{
if (!string.IsNullOrEmpty(Verbosity))
{
return $"--verbosity {Verbosity}";
}
return null;
}
private string GetDisableParallel()
{
return "--disable-parallel";
}
}
}

View file

@ -49,6 +49,17 @@ cat "$RepoRoot\branchinfo.txt" | ForEach-Object {
} }
# 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_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
if (!$env:DOTNET_INSTALL_DIR) if (!$env:DOTNET_INSTALL_DIR)
{ {
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture" $env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
@ -78,13 +89,25 @@ if ((Test-Path $bootStrapperPath) -eq 0)
} }
# now execute it # now execute it
& $bootStrapperPath -RepositoryRoot (Get-Location) -ToolsLocalPath $toolsLocalPath -CliLocalPath $env:DOTNET_INSTALL_DIR -Architecture $Architecture | Out-File (Join-Path (Get-Location) "bootstrap.log") & $bootStrapperPath -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) if ($LastExitCode -ne 0)
{ {
Write-Output "Boot-strapping failed with exit code $LastExitCode, see bootstrap.log for more information." Write-Output "Boot-strapping failed with exit code $LastExitCode, see bootstrap.log for more information."
exit $LastExitCode exit $LastExitCode
} }
# install the post-PJnistic stage0
$dotnetInstallPath = Join-Path $toolsLocalPath "dotnet-install.ps1"
Write-Host "$dotnetInstallPath -Version ""latest"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
Invoke-Expression "$dotnetInstallPath -Version ""latest"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
if ($LastExitCode -ne 0)
{
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"
exit $LastExitCode
}
# Put the stage0 on the path # Put the stage0 on the path
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"

View file

@ -129,6 +129,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_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
[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$ARCHITECTURE [ -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
@ -138,6 +142,7 @@ export __INIT_TOOLS_RESTORE_ARGS="$__INIT_TOOLS_RESTORE_ARGS --disable-parallel"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
toolsLocalPath="$REPOROOT/build_tools" toolsLocalPath="$REPOROOT/build_tools"
bootStrapperPath="$toolsLocalPath/bootstrap.sh" bootStrapperPath="$toolsLocalPath/bootstrap.sh"
dotnetInstallPath="$toolsLocalPath/dotnet-install.sh"
if [ ! -f $bootStrapperPath ]; then if [ ! -f $bootStrapperPath ]; then
if [ ! -d $toolsLocalPath ]; then if [ ! -d $toolsLocalPath ]; then
mkdir $toolsLocalPath mkdir $toolsLocalPath
@ -146,13 +151,21 @@ if [ ! -f $bootStrapperPath ]; then
chmod u+x $bootStrapperPath chmod u+x $bootStrapperPath
fi fi
$bootStrapperPath --repositoryRoot "$REPOROOT" --toolsLocalPath "$toolsLocalPath" --cliInstallPath $DOTNET_INSTALL_DIR --architecture $ARCHITECTURE > bootstrap.log $bootStrapperPath --repositoryRoot "$REPOROOT" --toolsLocalPath "$toolsLocalPath" --cliInstallPath $DOTNET_INSTALL_DIR_PJ --architecture $ARCHITECTURE > bootstrap.log
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "run-build: Error: Boot-strapping failed with exit code $?, see bootstrap.log for more information." >&2 echo "run-build: Error: Boot-strapping failed with exit code $?, see bootstrap.log for more information." >&2
exit $? exit $?
fi fi
# now execute the script
echo "installing CLI: $dotnetInstallPath --version \"latest\" --install-dir $DOTNET_INSTALL_DIR --architecture \"$ARCHITECTURE\""
$dotnetInstallPath --version "latest" --install-dir $DOTNET_INSTALL_DIR --architecture "$ARCHITECTURE"
if [ $? != 0 ]; then
echo "run-build: Error: Boot-strapping post-PJ stage0 with exit code $?." >&2
exit $?
fi
# 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"

View file

@ -73,7 +73,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
private string GetPjDotnetPath() private string GetPjDotnetPath()
{ {
return new DirectoryInfo(Path.Combine(RepoRoot, ".dotnet_stage0")) return new DirectoryInfo(Path.Combine(RepoRoot, ".dotnet_stage0PJ"))
.GetDirectories().First() .GetDirectories().First()
.GetFiles("dotnet*").First() .GetFiles("dotnet*").First()
.FullName; .FullName;