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:
parent
14c285db1c
commit
fd9cb55f1a
21 changed files with 218 additions and 230 deletions
|
@ -32,7 +32,9 @@
|
|||
<ExeExtension Condition=" '$(OS)' != 'Windows_NT' "></ExeExtension>
|
||||
|
||||
<Stage0Directory>$(RepoRoot)/.dotnet_stage0/$(Architecture)</Stage0Directory>
|
||||
<Stage0PjDirectory>$(RepoRoot)/.dotnet_stage0PJ/$(Architecture)</Stage0PjDirectory>
|
||||
<DotnetStage0>$(Stage0Directory)/dotnet$(ExeExtension)</DotnetStage0>
|
||||
<DotnetStage0Pj>$(Stage0PjDirectory)/dotnet$(ExeExtension)</DotnetStage0Pj>
|
||||
<DotnetCliBuildDirectory>$(RepoRoot)/build_projects/dotnet-cli-build</DotnetCliBuildDirectory>
|
||||
<PackagesDir>$(RepoRoot)/.nuget</PackagesDir>
|
||||
</PropertyGroup>
|
||||
|
@ -55,7 +57,8 @@
|
|||
DependsOnTargets="MSBuildWorkaroundTarget;
|
||||
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>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -72,7 +75,8 @@
|
|||
<ExtraRestoreArgs Condition="'$(OS)' != 'Windows_NT'">$(ExtraRestoreArgs) --disable-parallel</ExtraRestoreArgs>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec Command="$(DotnetStage0) restore3 $(ExtraRestoreArgs)" WorkingDirectory="$(DotnetCliBuildDirectory)"/>
|
||||
<Exec Command="$(DotnetStage0) restore $(ExtraRestoreArgs)"
|
||||
WorkingDirectory="$(DotnetCliBuildDirectory)"/>
|
||||
</Target>
|
||||
|
||||
<Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
|
||||
<!-- Publish DotNet -->
|
||||
<DotNetPublishMsbuildLegacy ToolPath="%(Stage.DotnetDir)"
|
||||
<DotNetPublish ToolPath="%(Stage.DotnetDir)"
|
||||
Output="$(SdkOutputDirectory)"
|
||||
Configuration="$(Configuration)"
|
||||
VersionSuffix="$(CommitCount)"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<IsDesktopAvailable>False</IsDesktopAvailable>
|
||||
<IsDesktopAvailable Condition=" '$(OSName)' == 'win' ">True</IsDesktopAvailable>
|
||||
<DotNetPath>$(Stage0Directory)</DotNetPath>
|
||||
<DotNetPjPath>$(Stage0PjDirectory)</DotNetPjPath>
|
||||
|
||||
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
|
||||
<ToolsOutputDirectory>$(BaseOutputDirectory)/tools</ToolsOutputDirectory>
|
||||
|
@ -189,7 +190,8 @@
|
|||
|
||||
<CallTarget Targets="CleanSrcLockFiles" />
|
||||
|
||||
<DotNetRestoreMsbuildLegacy WorkingDirectory="%(RestoreSrcPackagesInput.RootDir)%(RestoreSrcPackagesInput.Directory)" ToolPath="$(DotNetPath)" Root=""%(RestoreSrcPackagesInput.FullPath)"" />
|
||||
<DotNetRestore ToolPath="$(DotNetPath)"
|
||||
Root=""%(RestoreSrcPackagesInput.FullPath)"" />
|
||||
|
||||
</Target>
|
||||
|
||||
|
@ -213,7 +215,8 @@
|
|||
|
||||
<CallTarget Targets="CleanToolsLockFiles" />
|
||||
|
||||
<DotNetRestoreMsbuildLegacy WorkingDirectory="%(RestoreToolsPackagesInput.RootDir)%(RestoreToolsPackagesInput.Directory)" ToolPath="$(DotNetPath)" Root=""%(RestoreToolsPackagesInput.FullPath)"" />
|
||||
<DotNetRestore ToolPath="$(DotNetPath)"
|
||||
Root=""%(RestoreToolsPackagesInput.FullPath)"" />
|
||||
|
||||
</Target>
|
||||
|
||||
|
@ -237,8 +240,10 @@
|
|||
|
||||
<CallTarget Targets="CleanSrcToolsProjectJsonLockFiles" />
|
||||
|
||||
<DotNetRestore WorkingDirectory="$(RepoRoot)/src" ToolPath="$(DotNetPath)" />
|
||||
<DotNetRestore WorkingDirectory="$(RepoRoot)/tools" ToolPath="$(DotNetPath)" />
|
||||
<DotNetRestorePJ WorkingDirectory="$(RepoRoot)/src"
|
||||
ToolPath="$(DotNetPjPath)" />
|
||||
<DotNetRestorePJ WorkingDirectory="$(RepoRoot)/tools"
|
||||
ToolPath="$(DotNetPjPath)" />
|
||||
|
||||
</Target>
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
DependsOnTargets="PrepareTests;
|
||||
BuildTestAssets;
|
||||
BuildTests;">
|
||||
|
||||
<PropertyGroup>
|
||||
<PathListSeparator>:</PathListSeparator>
|
||||
<PathListSeparator Condition=" '$(OSName)' == 'win' ">%3b</PathListSeparator>
|
||||
|
@ -39,7 +40,7 @@
|
|||
EnvironmentVariables=$(RunTestEnvironmentVariables);
|
||||
TestProjectName=%(TestProjects.OutputName);
|
||||
TestResultXmlDir=$(TestResultXmlDir);
|
||||
ToolPath=$(Stage0Directory);
|
||||
ToolPath=$(Stage0PjDirectory);
|
||||
WorkingDirectory=%(TestProjects.ProjectDir)
|
||||
</Properties>
|
||||
</ProjectsToTest>
|
||||
|
@ -70,10 +71,11 @@
|
|||
SetupTestProjectData;"
|
||||
Inputs="%(TestProjects.BuildInputs)"
|
||||
Outputs="%(TestProjects.BuildOutput)">
|
||||
<DotNetBuild Configuration="$(Configuration)"
|
||||
Framework="%(TestProjects.Framework)"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
WorkingDirectory="%(TestProjects.RelativeDir)" />
|
||||
|
||||
<DotNetBuildPj Configuration="$(Configuration)"
|
||||
Framework="%(TestProjects.Framework)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="%(TestProjects.RelativeDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RestoreTests"
|
||||
|
@ -82,11 +84,12 @@
|
|||
SetupRestoreTestsInputs;"
|
||||
Inputs="@(RestoreTestsInputs)"
|
||||
Outputs="@(RestoreTestsInputs->'%(RelativeDir)project.lock.json')">
|
||||
|
||||
<CallTarget Targets="CleanTestProjectsLockFiles"/>
|
||||
|
||||
<DotNetRestoreProjectJson FallbackSource="$(TestPackagesDir)"
|
||||
ToolPath="$(DotnetUnderTest)"
|
||||
WorkingDirectory="$(TestDirectory)" />
|
||||
<DotNetRestorePj FallbackSource="$(TestPackagesDir)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="$(TestDirectory)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CleanTestProjectsBinObjProjectJson"
|
||||
|
@ -124,10 +127,10 @@
|
|||
Inputs="%(TestAssetProjects.BuildInputs)"
|
||||
Outputs="%(TestAssetProjects.BuildOutput)">
|
||||
|
||||
<DotNetBuild Framework="netcoreapp1.0"
|
||||
ProjectPath="$(RepoRoot)%(TestAssetProjects.ProjectPath)"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
WorkingDirectory="%(TestAssetProjects.RelativeDir)" />
|
||||
<DotNetBuildPj Framework="netcoreapp1.0"
|
||||
ProjectPath="$(RepoRoot)%(TestAssetProjects.ProjectPath)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="%(TestAssetProjects.RelativeDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RestoreTestAssetProjects"
|
||||
|
@ -136,9 +139,9 @@
|
|||
Inputs="@(RestoreTestAssetProjectsInputs)"
|
||||
Outputs="@(RestoreTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')">
|
||||
|
||||
<DotNetRestoreProjectJson FallbackSource="$(TestPackagesDir)"
|
||||
ToolPath="$(DotnetUnderTest)"
|
||||
WorkingDirectory="$(RepoRoot)TestAssets/TestProjects/" />
|
||||
<DotNetRestorePj FallbackSource="$(TestPackagesDir)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="$(RepoRoot)TestAssets/TestProjects/" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SetupRestoreTestAssetProjectsInputs" >
|
||||
|
@ -177,7 +180,7 @@
|
|||
<DotNetBuild Configuration="$(Configuration)"
|
||||
Framework="net46"
|
||||
ProjectPath="%(BuildableDesktopTestAssetProjects.FullPath)"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="%(BuildableDesktopTestAssetProjects.RelativeDir)" />
|
||||
</Target>
|
||||
|
||||
|
@ -188,9 +191,9 @@
|
|||
Inputs="@(RestoreDesktopTestAssetProjectsInputs)"
|
||||
Outputs="@(RestoreDesktopTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')">
|
||||
|
||||
<DotNetRestoreProjectJson FallbackSource="$(TestPackagesDir)"
|
||||
ToolPath="$(DotnetUnderTest)"
|
||||
WorkingDirectory="$(RepoRoot)TestAssets\DesktopTestProjects\" />
|
||||
<DotNetRestorePj FallbackSource="$(TestPackagesDir)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="$(RepoRoot)TestAssets\DesktopTestProjects\" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SetupRestoreDesktopTestAssetProjectsInputs">
|
||||
|
@ -205,12 +208,12 @@
|
|||
Inputs="%(TestPackageProject.PackInputs)"
|
||||
Outputs="%(TestPackageProject.PackOutputs)">
|
||||
|
||||
<DotNetPack BuildBasePath="$(TestPackagesBuildDir)"
|
||||
NoBuild="True"
|
||||
Output="$(TestPackagesDir)"
|
||||
ProjectPath="%(TestPackageProject.FullPath)"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
VersionSuffix="%(TestPackageProject.VersionSuffix)" />
|
||||
<DotNetPackPj BuildBasePath="$(TestPackagesBuildDir)"
|
||||
NoBuild="True"
|
||||
Output="$(TestPackagesDir)"
|
||||
ProjectPath="%(TestPackageProject.FullPath)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
VersionSuffix="%(TestPackageProject.VersionSuffix)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildTestAssetPackageProjects"
|
||||
|
@ -219,11 +222,11 @@
|
|||
Inputs="%(TestPackageProject.BuildInputs)"
|
||||
Outputs="%(TestPackageProject.BuildOutputs)">
|
||||
|
||||
<DotNetBuild BuildBasePath="$(TestPackagesBuildDir)"
|
||||
Framework="%(TestPackageProject.Framework)"
|
||||
ProjectPath="%(TestPackageProject.FullPath)"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
WorkingDirectory="%(BuildableTestAssetProjects.RelativeDir)" />
|
||||
<DotNetBuildPj BuildBasePath="$(TestPackagesBuildDir)"
|
||||
Framework="%(TestPackageProject.Framework)"
|
||||
ProjectPath="%(TestPackageProject.FullPath)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="%(BuildableTestAssetProjects.RelativeDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RestoreTestAssetPackageProjects"
|
||||
|
@ -232,8 +235,8 @@
|
|||
Inputs="@(RestoreTestAssetPackageProjectsInputs)"
|
||||
Outputs="@(RestoreTestAssetPackageProjectsInputs->'%(RelativeDir)/project.lock.json')">
|
||||
|
||||
<DotNetRestoreProjectJson ToolPath="$(DotnetUnderTest)"
|
||||
WorkingDirectory="$(RepoRoot)/TestAssets/TestPackages/" />
|
||||
<DotNetRestorePJ ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="$(RepoRoot)/TestAssets/TestPackages/" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SetupRestoreTestAssetPackageProjectsInputs"
|
||||
|
|
|
@ -8,15 +8,14 @@
|
|||
<UsingTask TaskName="CreateAzureContainer" AssemblyFile="$(CLIBuildDll)"/>
|
||||
<UsingTask TaskName="Crossgen" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetBuild" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetBuildMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetBuildPJ" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetNew" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetPack" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetPackMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetPackPJ" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetPublish" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetPublishMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetPublishPJ" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetRestoreProjectJson" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetRestoreMsbuildLegacy" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetRestorePJ" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="DownloadFile" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="GenerateBuildVersionInfo" AssemblyFile="$(CLIBuildDll)" />
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
<Message Text="Publishing Archiver" />
|
||||
|
||||
<DotNetPublishMsbuildLegacy ToolPath="$(Stage0Directory)"
|
||||
WorkingDirectory="$(RepoRoot)/tools/Archiver"
|
||||
Output="$(ToolsOutputDirectory)"
|
||||
Configuration="$(Configuration)"
|
||||
Runtime="$(CoreCLRRid)" />
|
||||
<DotNetPublish ToolPath="$(Stage0Directory)"
|
||||
WorkingDirectory="$(RepoRoot)/tools/Archiver"
|
||||
Output="$(ToolsOutputDirectory)"
|
||||
Configuration="$(Configuration)"
|
||||
Runtime="$(CoreCLRRid)" />
|
||||
|
||||
<Exec Command="$(ArchiverExe) -a $(IntermediateArchive) $(NuGetPackagesArchiveFolder)" />
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
ReplacementStrings="@(DebianConfigTokenValues -> '%(ReplacementString)')" />
|
||||
|
||||
<!-- Build SDK Deb package -->
|
||||
<DotNetDebTool ToolPath="$(Stage0Directory)"
|
||||
<DotNetDebTool ToolPath="$(Stage0PjDirectory)"
|
||||
InputDirectory="$(LayoutDirectory)"
|
||||
OutputDirectory="$(DotNetDebToolOutputDirectory)"
|
||||
PackageName="$(SdkDebianPackageName)"
|
||||
|
@ -94,7 +94,7 @@
|
|||
<!-- Run E2E -->
|
||||
<DotNetTest WorkingDirectory="$(EndToEndTestDirectory)"
|
||||
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
Xml="$(DebianTestResultsXmlFile)" />
|
||||
|
||||
<!-- Clean up Packages -->
|
||||
|
@ -135,9 +135,9 @@
|
|||
<Target Name="PrepareDotnetDebTool"
|
||||
DependsOnTargets="WriteDotnetDebToolProjectJson;">
|
||||
|
||||
<DotNetRestoreProjectJson FallbackSource="$(DotnetDebToolPackageSource)"
|
||||
ToolPath="$(Stage2Directory)"
|
||||
WorkingDirectory="$(DotnetDebToolDir)" />
|
||||
<DotNetRestorePj FallbackSource="$(DotnetDebToolPackageSource)"
|
||||
ToolPath="$(Stage0PjDirectory)"
|
||||
WorkingDirectory="$(DotnetDebToolDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteDotnetDebToolProjectJson"
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
|
||||
<Exec Command ="powershell -NoProfile -NoLogo $(SdkTestMsiPowershellScript)
|
||||
-InputMsi '$(SdkInstallerFile)'
|
||||
-DotnetDir '$(Stage0Directory)'" />
|
||||
-DotnetDir '$(Stage0PjDirectory)'" />
|
||||
|
||||
<WriteLinesToFile
|
||||
File="$(SdkMsiTestedSentinel)"
|
||||
|
|
|
@ -39,22 +39,22 @@
|
|||
Inputs="@(ProjectPackTargetInputs -> '%(Identity)')"
|
||||
Outputs="@(ProjectPackTargetOutputs -> '%(Identity)')">
|
||||
|
||||
<DotNetPackMsbuildLegacy NoBuild="True"
|
||||
Output="$(NupkgOutputDirectory)"
|
||||
ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
VersionSuffix="$(NupkgVersionSuffix)"
|
||||
Configuration="$(Configuration)" />
|
||||
<DotNetPack NoBuild="True"
|
||||
Output="$(NupkgOutputDirectory)"
|
||||
ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj"
|
||||
ToolPath="$(Stage0Directory)"
|
||||
VersionSuffix="$(NupkgVersionSuffix)"
|
||||
Configuration="$(Configuration)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildProjectsForNuGetPackages"
|
||||
DependsOnTargets="Init;
|
||||
SetupProjectsToPack"
|
||||
Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
<MakeDir Directories="$(PackagingBuildBasePath)" />
|
||||
DependsOnTargets="Init; SetupProjectsToPack"
|
||||
Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
<DotNetBuildMsbuildLegacy ToolPath="$(Stage0Directory)"
|
||||
Configuration="$(Configuration)"
|
||||
ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj" />
|
||||
<MakeDir Directories="$(PackagingBuildBasePath)" />
|
||||
|
||||
<DotNetBuild ToolPath="$(Stage0Directory)"
|
||||
Configuration="$(Configuration)"
|
||||
ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetBuildBasePath()}"; }
|
||||
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()}"; }
|
||||
}
|
||||
|
||||
public string BuildBasePath { get; set; }
|
||||
|
@ -22,17 +22,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
public string Framework { get; set; }
|
||||
|
||||
public string ProjectPath { get; set; }
|
||||
|
||||
private string GetBuildBasePath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(BuildBasePath))
|
||||
{
|
||||
return $"--build-base-path {BuildBasePath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private string GetConfiguration()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetBuildMsbuildLegacy : DotNetTool
|
||||
public class DotNetBuildPJ : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "build3"; }
|
||||
get { return "build"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()}"; }
|
||||
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetBuildBasePath()}"; }
|
||||
}
|
||||
|
||||
public string BuildBasePath { get; set; }
|
||||
|
@ -22,7 +22,17 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
public string Framework { get; set; }
|
||||
|
||||
public string ProjectPath { get; set; }
|
||||
|
||||
|
||||
private string GetBuildBasePath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(BuildBasePath))
|
||||
{
|
||||
return $"--build-base-path {BuildBasePath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetConfiguration()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
|
@ -12,15 +12,13 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
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 bool NoBuild { get; set; }
|
||||
|
||||
public string BuildBasePath { get; set; }
|
||||
|
||||
|
||||
public string Output { get; set; }
|
||||
|
||||
public string ProjectPath { get; set; }
|
||||
|
@ -46,17 +44,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetBuildBasePath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(BuildBasePath))
|
||||
{
|
||||
return $"--build-base-path {BuildBasePath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private string GetOutput()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Output))
|
||||
|
|
|
@ -3,22 +3,24 @@
|
|||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetPackMsbuildLegacy : DotNetTool
|
||||
public class DotNetPackPJ : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "pack3"; }
|
||||
get { return "pack"; }
|
||||
}
|
||||
|
||||
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 bool NoBuild { get; set; }
|
||||
|
||||
|
||||
public string BuildBasePath { get; set; }
|
||||
|
||||
public string Output { get; set; }
|
||||
|
||||
public string ProjectPath { get; set; }
|
||||
|
@ -44,7 +46,17 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private string GetBuildBasePath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(BuildBasePath))
|
||||
{
|
||||
return $"--build-base-path {BuildBasePath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetOutput()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Output))
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetPublishMsbuildLegacy : DotNetTool
|
||||
public class DotNetPublishPJ : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "publish3"; }
|
||||
get { return "publish"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
|
@ -12,9 +12,11 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
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 Packages { get; set; }
|
||||
|
@ -50,10 +52,5 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetDisableParallel()
|
||||
{
|
||||
return "--disable-parallel";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
59
build_projects/dotnet-cli-build/DotNetRestorePJ.cs
Normal file
59
build_projects/dotnet-cli-build/DotNetRestorePJ.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
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)
|
||||
{
|
||||
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
|
||||
|
@ -78,13 +89,25 @@ if ((Test-Path $bootStrapperPath) -eq 0)
|
|||
}
|
||||
|
||||
# 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)
|
||||
{
|
||||
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"
|
||||
|
||||
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
|
||||
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
||||
|
||||
|
|
15
run-build.sh
15
run-build.sh
|
@ -129,6 +129,10 @@ while read line; do
|
|||
done < "$REPOROOT/branchinfo.txt"
|
||||
|
||||
# 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
|
||||
[ -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
|
||||
toolsLocalPath="$REPOROOT/build_tools"
|
||||
bootStrapperPath="$toolsLocalPath/bootstrap.sh"
|
||||
dotnetInstallPath="$toolsLocalPath/dotnet-install.sh"
|
||||
if [ ! -f $bootStrapperPath ]; then
|
||||
if [ ! -d $toolsLocalPath ]; then
|
||||
mkdir $toolsLocalPath
|
||||
|
@ -146,13 +151,21 @@ if [ ! -f $bootStrapperPath ]; then
|
|||
chmod u+x $bootStrapperPath
|
||||
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
|
||||
echo "run-build: Error: Boot-strapping failed with exit code $?, see bootstrap.log for more information." >&2
|
||||
exit $?
|
||||
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)
|
||||
PATH="$DOTNET_INSTALL_DIR:$PATH"
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
private string GetPjDotnetPath()
|
||||
{
|
||||
return new DirectoryInfo(Path.Combine(RepoRoot, ".dotnet_stage0"))
|
||||
return new DirectoryInfo(Path.Combine(RepoRoot, ".dotnet_stage0PJ"))
|
||||
.GetDirectories().First()
|
||||
.GetFiles("dotnet*").First()
|
||||
.FullName;
|
||||
|
|
Loading…
Add table
Reference in a new issue