Skip to content

Commit

Permalink
WIP: arcade-powered-source-build
Browse files Browse the repository at this point in the history
This enables 'source-build', which makes it easier to build the entire
shipping .NET SDK from source.

This is the first and second step of arcade-powered-source-build:
https://github.com/dotnet/source-build/blob/master/Documentation/planning/arcade-powered-source-build/README.md

See dotnet/sourcelink#692 for a similar PR, that this is based on.
  • Loading branch information
omajid committed Feb 16, 2021
1 parent 465f9e5 commit 574465a
Show file tree
Hide file tree
Showing 11 changed files with 423 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -142,7 +142,6 @@ node_modules/
*.Tests/lib/
*.userprefs
*.vsp
*.xml
.idea
_NCrunch_*/
_ReSharper.*/
Expand Down
1 change: 1 addition & 0 deletions .vsts-ci.yml
Expand Up @@ -29,6 +29,7 @@ stages:
enablePublishTestResults: true
enablePublishBuildAssets: true
enableTelemetry: true
enableSourceBuild: true
helixRepo: dotnet/command-line-api
timeoutInMinutes: 180 # increase timeout since BAR publishing might wait a long time
jobs:
Expand Down
23 changes: 23 additions & 0 deletions eng/SouceBuild.props
@@ -0,0 +1,23 @@
<Project>

<PropertyGroup>
<GitHubRepositoryName>command-line-api</GitHubRepositoryName>
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
</PropertyGroup>

<Target Name="ApplySourceBuildPatchFiles"
Condition="
'$(ArcadeBuildFromSource)' == 'true' and
'$(ArcadeInnerBuildFromSource)' == 'true'"
BeforeTargets="Execute">
<ItemGroup>
<SourceBuildPatchFile Include="$(RepositoryEngineeringDir)source-build-patches\*.patch" />
</ItemGroup>

<Exec
Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>

</Project>
8 changes: 8 additions & 0 deletions eng/SourceBuild.props
@@ -0,0 +1,8 @@
<Project>

<PropertyGroup>
<GitHubRepositoryName>command-line-api</GitHubRepositoryName>
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
</PropertyGroup>

</Project>
5 changes: 5 additions & 0 deletions eng/SourceBuildPrebuiltBaseline.xml
@@ -0,0 +1,5 @@
<UsageData>
<IgnorePatterns>
<UsagePattern IdentityGlob="*/*" />
</IgnorePatterns>
</UsageData>
2 changes: 2 additions & 0 deletions eng/Version.Details.xml
Expand Up @@ -6,6 +6,8 @@
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.20573.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>35bddd4fbfab8da3518fb920250d7c9e0c3138ff</Sha>
<!--<SourceBuild RepoName="arcade" ManagedOnly="true"/> -->

</Dependency>
</ToolsetDependencies>
</Dependencies>
Empty file modified eng/common/dotnet-install.sh 100644 → 100755
Empty file.

Large diffs are not rendered by default.

@@ -0,0 +1,47 @@
From 74c9b072853ff4d68f2630462a6f1ac5d576979d Mon Sep 17 00:00:00 2001
From: Chris Rummel <crummel@microsoft.com>
Date: Mon, 21 Sep 2020 09:59:02 -0500
Subject: [PATCH 2/2] Use package version properties for reference versions.

---
eng/Versions.props | 7 +++++--
src/System.CommandLine/System.CommandLine.csproj | 4 ++--
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/eng/Versions.props b/eng/Versions.props
index 3048701..16a0eb7 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -29,9 +29,12 @@
<UsingToolSymbolUploader>true</UsingToolSymbolUploader>
<PublishWindowsPdb>true</PublishWindowsPdb>
</PropertyGroup>
- <!-- <PropertyGroup>
+ <PropertyGroup>
<FluentAssertionsVersion>4.18.0</FluentAssertionsVersion>
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
<SystemNetHttpVersion>4.3.1</SystemNetHttpVersion>
- </PropertyGroup> -->
+ <MicrosoftExtensionsHostingPackageVersion Condition="'$(MicrosoftExtensionsHostingPackageVersion)' == ''">2.2.0</MicrosoftExtensionsHostingPackageVersion>
+ <MicrosoftCSharpPackageVersion Condition="'$(MicrosoftCSharpPackageVersion)' == ''">4.4.1</MicrosoftCSharpPackageVersion>
+ <SystemMemoryPackageVersion Condition="'$(SystemMemoryPackageVersion)' == ''">4.5.3</SystemMemoryPackageVersion>
+ </PropertyGroup>
</Project>
diff --git a/src/System.CommandLine/System.CommandLine.csproj b/src/System.CommandLine/System.CommandLine.csproj
index 1ae8dd3..aaa2c4a 100644
--- a/src/System.CommandLine/System.CommandLine.csproj
+++ b/src/System.CommandLine/System.CommandLine.csproj
@@ -19,8 +19,8 @@
</PropertyGroup>

<ItemGroup>
- <PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
- <PackageReference Include="system.memory" Version="4.5.3" />
+ <PackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpPackageVersion)" />
+ <PackageReference Include="system.memory" Version="$(SystemMemoryPackageVersion)" />
</ItemGroup>

</Project>
--
2.18.0

@@ -0,0 +1,95 @@
From b9a21ec1c0a77ef4e1e44840a0526545fea456de Mon Sep 17 00:00:00 2001
From: Davis Goodin <dagood@microsoft.com>
Date: Thu, 29 Oct 2020 01:48:54 -0500
Subject: [PATCH] Update to netcoreapp3.1 to avoid prebuilts

netcoreapp3.1 avoids prebuilts (Microsoft.CSharp) but works with the
rest of source-build: runtime and roslyn.

Includes a code fix for ref nullability with the new framework.
---
.../System.CommandLine.DragonFruit.csproj | 2 +-
.../System.CommandLine.Hosting.csproj | 2 +-
.../System.CommandLine.Rendering.csproj | 2 +-
src/System.CommandLine/Binding/BindingContext.cs | 2 +-
src/System.CommandLine/System.CommandLine.csproj | 7 +------
5 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj b/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
index b3a542fd..06167997 100644
--- a/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
+++ b/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>true</IsPackable>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
<Description>This package includes the experimental DragonFruit app model for System.CommandLine, which allows you to create a command line application using only a Main method while getting support for complex type binding, error reporting, help, shell completions, and more.
</Description>
</PropertyGroup>
diff --git a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
index 1d00cff2..7342c1c5 100644
--- a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
+++ b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
@@ -2,7 +2,7 @@

<PropertyGroup>
<IsPackable>true</IsPackable>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<Description>This package provides support for using System.CommandLine with Microsoft.Extensions.Hosting.</Description>
</PropertyGroup>
diff --git a/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj b/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
index d552286e..84026ebe 100644
--- a/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
+++ b/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
@@ -2,7 +2,7 @@

<PropertyGroup>
<IsPackable>true</IsPackable>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.3</LangVersion>
<Description>This package provides support for structured command line output rendering. Write code once that renders correctly in multiple output modes, including System.Console, virtual terminal (using ANSI escape sequences), and plain text.
</Description>
diff --git a/src/System.CommandLine/Binding/BindingContext.cs b/src/System.CommandLine/Binding/BindingContext.cs
index b942ba6a..bbb83891 100644
--- a/src/System.CommandLine/Binding/BindingContext.cs
+++ b/src/System.CommandLine/Binding/BindingContext.cs
@@ -55,7 +55,7 @@ namespace System.CommandLine.Binding

public ModelBinder GetModelBinder(IValueDescriptor valueDescriptor)
{
- if (_modelBindersByValueDescriptor.TryGetValue(valueDescriptor.ValueType, out ModelBinder binder))
+ if (_modelBindersByValueDescriptor.TryGetValue(valueDescriptor.ValueType, out ModelBinder? binder))
{
return binder;
}
diff --git a/src/System.CommandLine/System.CommandLine.csproj b/src/System.CommandLine/System.CommandLine.csproj
index aaa2c4a3..5e875a73 100644
--- a/src/System.CommandLine/System.CommandLine.csproj
+++ b/src/System.CommandLine/System.CommandLine.csproj
@@ -3,7 +3,7 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>System.CommandLine</PackageId>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>8</LangVersion>
<Description>This package includes a powerful command line parser and other tools for building command line applications, including:

@@ -18,9 +18,4 @@
<DebugType>portable</DebugType>
</PropertyGroup>

- <ItemGroup>
- <PackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpPackageVersion)" />
- <PackageReference Include="system.memory" Version="$(SystemMemoryPackageVersion)" />
- </ItemGroup>
-
</Project>
--
2.25.2

@@ -0,0 +1,25 @@
From f4053c72fd35e1ec0b238cb5f27f818b837a3632 Mon Sep 17 00:00:00 2001
From: Davis Goodin <dagood@microsoft.com>
Date: Thu, 5 Nov 2020 10:48:59 -0600
Subject: [PATCH] Exclude System.CommandLine.Hosting

This project is not used by downstream repos and restores prebuilts.
---
src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
index 7342c1c..e4a97a0 100644
--- a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
+++ b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
@@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<Description>This package provides support for using System.CommandLine with Microsoft.Extensions.Hosting.</Description>
+ <ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
--
2.25.2

0 comments on commit 574465a

Please sign in to comment.