Skip to content

Commit ac1499b

Browse files
omajidjonsequitur
authored andcommitted
Enable arcade-powered-sourced-build for local and CI builds
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. And try and resolve some nullability errors. For source-build, sisable warnings so we can build this without extensive customizations, since we update the TFM ourselves.
1 parent d87107b commit ac1499b

12 files changed

+537
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ node_modules/
142142
*.Tests/lib/
143143
*.userprefs
144144
*.vsp
145-
*.xml
146145
.idea
147146
_NCrunch_*/
148147
_ReSharper.*/

.vsts-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ stages:
2929
enablePublishTestResults: true
3030
enablePublishBuildAssets: true
3131
enableTelemetry: true
32+
enableSourceBuild: true
3233
helixRepo: dotnet/command-line-api
3334
timeoutInMinutes: 180 # increase timeout since BAR publishing might wait a long time
3435
jobs:

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<PropertyGroup>
88
<NoWarn>$(NoWarn);NU5125;CS0618</NoWarn>
9+
<NoWarn Condition=" '$(DotnetBuildFromSource)' == 'true' ">$(NoWarn);CS8714;CS8765;CS8600;CS8601;CS8602;CS8603;CS8604</NoWarn>
910
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1011
</PropertyGroup>
1112

eng/SourceBuild.props

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<GitHubRepositoryName>command-line-api</GitHubRepositoryName>
5+
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
6+
</PropertyGroup>
7+
8+
<Target Name="ApplySourceBuildPatchFiles"
9+
Condition="
10+
'$(ArcadeBuildFromSource)' == 'true' and
11+
'$(ArcadeInnerBuildFromSource)' == 'true'"
12+
BeforeTargets="Execute">
13+
<ItemGroup>
14+
<SourceBuildPatchFile Include="$(RepositoryEngineeringDir)source-build-patches\*.patch" />
15+
</ItemGroup>
16+
17+
<Exec
18+
Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
19+
WorkingDirectory="$(RepoRoot)"
20+
Condition="'@(SourceBuildPatchFile)' != ''" />
21+
</Target>
22+
23+
24+
</Project>

eng/SourceBuildPrebuiltBaseline.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<UsageData>
2+
<IgnorePatterns>
3+
<UsagePattern IdentityGlob="*/*" />
4+
</IgnorePatterns>
5+
</UsageData>

eng/Version.Details.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21105.12">
77
<Uri>https://github.com/dotnet/arcade</Uri>
88
<Sha>938b3e8b4edcd96ca0f0cbbae63c87b3f51f7afe</Sha>
9+
<SourceBuild RepoName="arcade" ManagedOnly="true"/>
910
</Dependency>
1011
</ToolsetDependencies>
1112
</Dependencies>

eng/common/dotnet-install.sh

100644100755
File mode changed.

eng/source-build-patches/0001-Exclude-dotnet-suggest-from-source-build.patch

Lines changed: 229 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 74c9b072853ff4d68f2630462a6f1ac5d576979d Mon Sep 17 00:00:00 2001
2+
From: Chris Rummel <[email protected]>
3+
Date: Mon, 21 Sep 2020 09:59:02 -0500
4+
Subject: [PATCH 2/2] Use package version properties for reference versions.
5+
6+
---
7+
eng/Versions.props | 7 +++++--
8+
src/System.CommandLine/System.CommandLine.csproj | 4 ++--
9+
2 files changed, 7 insertions(+), 4 deletions(-)
10+
11+
diff --git a/eng/Versions.props b/eng/Versions.props
12+
index 3048701..16a0eb7 100644
13+
--- a/eng/Versions.props
14+
+++ b/eng/Versions.props
15+
@@ -29,9 +29,12 @@
16+
<UsingToolSymbolUploader>true</UsingToolSymbolUploader>
17+
<PublishWindowsPdb>true</PublishWindowsPdb>
18+
</PropertyGroup>
19+
- <!-- <PropertyGroup>
20+
+ <PropertyGroup>
21+
<FluentAssertionsVersion>4.18.0</FluentAssertionsVersion>
22+
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
23+
<SystemNetHttpVersion>4.3.1</SystemNetHttpVersion>
24+
- </PropertyGroup> -->
25+
+ <MicrosoftExtensionsHostingPackageVersion Condition="'$(MicrosoftExtensionsHostingPackageVersion)' == ''">2.2.0</MicrosoftExtensionsHostingPackageVersion>
26+
+ <MicrosoftCSharpPackageVersion Condition="'$(MicrosoftCSharpPackageVersion)' == ''">4.4.1</MicrosoftCSharpPackageVersion>
27+
+ <SystemMemoryPackageVersion Condition="'$(SystemMemoryPackageVersion)' == ''">4.5.3</SystemMemoryPackageVersion>
28+
+ </PropertyGroup>
29+
</Project>
30+
diff --git a/src/System.CommandLine/System.CommandLine.csproj b/src/System.CommandLine/System.CommandLine.csproj
31+
index 1ae8dd3..aaa2c4a 100644
32+
--- a/src/System.CommandLine/System.CommandLine.csproj
33+
+++ b/src/System.CommandLine/System.CommandLine.csproj
34+
@@ -19,8 +19,8 @@
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
- <PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
39+
- <PackageReference Include="system.memory" Version="4.5.4" />
40+
+ <PackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpPackageVersion)" />
41+
+ <PackageReference Include="system.memory" Version="$(SystemMemoryPackageVersion)" />
42+
</ItemGroup>
43+
44+
<ItemGroup>
45+
--
46+
2.18.0
47+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
From b9a21ec1c0a77ef4e1e44840a0526545fea456de Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <[email protected]>
3+
Date: Thu, 29 Oct 2020 01:48:54 -0500
4+
Subject: [PATCH] Update to netcoreapp3.1 to avoid prebuilts
5+
6+
netcoreapp3.1 avoids prebuilts (Microsoft.CSharp) but works with the
7+
rest of source-build: runtime and roslyn.
8+
9+
Includes a code fix for ref nullability with the new framework.
10+
---
11+
.../System.CommandLine.DragonFruit.csproj | 2 +-
12+
.../System.CommandLine.Hosting.csproj | 2 +-
13+
.../System.CommandLine.Rendering.csproj | 2 +-
14+
src/System.CommandLine/Binding/BindingContext.cs | 2 +-
15+
src/System.CommandLine/System.CommandLine.csproj | 7 +------
16+
5 files changed, 5 insertions(+), 10 deletions(-)
17+
18+
diff --git a/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj b/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
19+
index b3a542fd..06167997 100644
20+
--- a/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
21+
+++ b/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
22+
@@ -1,7 +1,7 @@
23+
<Project Sdk="Microsoft.NET.Sdk">
24+
<PropertyGroup>
25+
<IsPackable>true</IsPackable>
26+
- <TargetFramework>netstandard2.0</TargetFramework>
27+
+ <TargetFramework>netcoreapp3.1</TargetFramework>
28+
<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.
29+
</Description>
30+
</PropertyGroup>
31+
diff --git a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
32+
index 1d00cff2..7342c1c5 100644
33+
--- a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
34+
+++ b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
35+
@@ -2,7 +2,7 @@
36+
37+
<PropertyGroup>
38+
<IsPackable>true</IsPackable>
39+
- <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
40+
+ <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
41+
<LangVersion>latest</LangVersion>
42+
<Description>This package provides support for using System.CommandLine with Microsoft.Extensions.Hosting.</Description>
43+
</PropertyGroup>
44+
diff --git a/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj b/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
45+
index d552286e..84026ebe 100644
46+
--- a/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
47+
+++ b/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
48+
@@ -2,7 +2,7 @@
49+
50+
<PropertyGroup>
51+
<IsPackable>true</IsPackable>
52+
- <TargetFramework>netstandard2.0</TargetFramework>
53+
+ <TargetFramework>netcoreapp3.1</TargetFramework>
54+
<LangVersion>8</LangVersion>
55+
<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.
56+
</Description>
57+
diff --git a/src/System.CommandLine/Binding/BindingContext.cs b/src/System.CommandLine/Binding/BindingContext.cs
58+
index b942ba6a..bbb83891 100644
59+
--- a/src/System.CommandLine/Binding/BindingContext.cs
60+
+++ b/src/System.CommandLine/Binding/BindingContext.cs
61+
@@ -55,7 +55,7 @@ namespace System.CommandLine.Binding
62+
63+
public ModelBinder GetModelBinder(IValueDescriptor valueDescriptor)
64+
{
65+
- if (_modelBindersByValueDescriptor.TryGetValue(valueDescriptor.ValueType, out ModelBinder binder))
66+
+ if (_modelBindersByValueDescriptor.TryGetValue(valueDescriptor.ValueType, out ModelBinder? binder))
67+
{
68+
return binder;
69+
}
70+
diff --git a/src/System.CommandLine/System.CommandLine.csproj b/src/System.CommandLine/System.CommandLine.csproj
71+
index aaa2c4a3..5e875a73 100644
72+
--- a/src/System.CommandLine/System.CommandLine.csproj
73+
+++ b/src/System.CommandLine/System.CommandLine.csproj
74+
@@ -3,7 +3,7 @@
75+
<PropertyGroup>
76+
<IsPackable>true</IsPackable>
77+
<PackageId>System.CommandLine</PackageId>
78+
- <TargetFramework>netstandard2.0</TargetFramework>
79+
+ <TargetFramework>netcoreapp3.1</TargetFramework>
80+
<LangVersion>8</LangVersion>
81+
<Nullable>enable</Nullable>
82+
<Description>This package includes a powerful command line parser and other tools for building command line applications, including:
83+
@@ -18,9 +18,4 @@
84+
<Compile Include="..\System.Diagnostics.CodeAnalysis.cs" Link="System.Diagnostics.CodeAnalysis.cs" />
85+
</ItemGroup>
86+
87+
- <ItemGroup>
88+
- <PackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpPackageVersion)" />
89+
- <PackageReference Include="system.memory" Version="$(SystemMemoryPackageVersion)" />
90+
- </ItemGroup>
91+
-
92+
<ItemGroup>
93+
--
94+
2.25.2
95+

0 commit comments

Comments
 (0)