Merge pull request #12456 from dagood/rm-compilers-apphost-prebuilt

[release/6.0.1xx] Remove compiler project apphosts in source-build to remove apphost pack prebuilt
This commit is contained in:
Michael Simons 2021-10-21 15:39:27 -05:00 committed by GitHub
commit dd90b93727
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 214 additions and 0 deletions

View file

@ -4,6 +4,12 @@
<PropertyGroup>
<BuildCommandArgs>$(StandardSourceBuildArgs)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TreatWarningsAsErrors=false</BuildCommandArgs>
<!--
dotnet/fsharp has a custom eng/build.sh script that handles its own sourcebuild arg
differently from the ArcadeBuildFromSource MSBuild arg. Including both args is fine, but the
custom sourcebuild arg is the one that's required. This avoids running bootstrapping twice.
-->
<BuildCommandArgs>$(BuildCommandArgs) --sourcebuild</BuildCommandArgs>
<BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>

View file

@ -0,0 +1,167 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Davis Goodin <dagood@microsoft.com>
Date: Tue, 19 Oct 2021 16:11:51 -0500
Subject: [PATCH] Disable apphost on downlevel frameworks during source-build
During source-build, disable apphost build for 'fsi' and 'fsc', and
'fsyacc', 'fslex', and 'AssemblyCheck' during the bootstrap build.
Creating an apphost for a net5.0 project while building with a net6.0
SDK downloads the apphost pack as a prebuilt. Stopping the projects from
creating the apphost removes the prebuilt for source-build.
To make disabling the apphost work in the bootstrapping build, add a
check to eng/build.sh to skip the bootstrap build if we're currently
running the "outer" source-build. That gives source-build the ability to
run bootstrapping on its own terms. Now, when eng/SourceBuild.props runs
bootstrapping, it can pass the DotNetBuildFromSource property through
the environment so it takes effect.
See: https://github.com/dotnet/fsharp/issues/12282
PR: https://github.com/dotnet/fsharp/pull/12286
---
eng/SourceBuild.props | 2 +-
eng/build.sh | 51 ++++++++++---------
.../AssemblyCheck/AssemblyCheck.fsproj | 1 +
src/buildtools/fslex/fslex.fsproj | 1 +
src/buildtools/fsyacc/fsyacc.fsproj | 1 +
src/fsharp/fsc/fsc.fsproj | 1 +
src/fsharp/fsi/fsi.fsproj | 1 +
7 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index 22c929f28..903ee00d3 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -41,7 +41,7 @@
<Exec
Command="./build.sh --bootstrap --skipBuild"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
- EnvironmentVariables="@(InnerBuildEnv)" />
+ EnvironmentVariables="@(InnerBuildEnv);DotNetBuildFromSource=true" />
</Target>
</Project>
diff --git a/eng/build.sh b/eng/build.sh
index 9a2aa0083..6af422237 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -240,29 +240,34 @@ function BuildSolution {
node_reuse=false
# build bootstrap tools
- bootstrap_config=Proto
- bootstrap_dir=$artifacts_dir/Bootstrap
- if [[ "$force_bootstrap" == true ]]; then
- rm -fr $bootstrap_dir
- fi
- if [ ! -f "$bootstrap_dir/fslex.dll" ]; then
- BuildMessage="Error building tools"
- MSBuild "$repo_root/src/buildtools/buildtools.proj" \
- /restore \
- /p:Configuration=$bootstrap_config
-
- mkdir -p "$bootstrap_dir"
- cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/net5.0 $bootstrap_dir/fslex
- cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/net5.0 $bootstrap_dir/fsyacc
- fi
- if [ ! -f "$bootstrap_dir/fsc.exe" ]; then
- BuildMessage="Error building bootstrap"
- MSBuild "$repo_root/proto.proj" \
- /restore \
- /p:Configuration=$bootstrap_config \
-
-
- cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/net5.0 $bootstrap_dir/fsc
+ # source_build=true means we are currently in the outer/wrapper source-build,
+ # and building bootstrap needs to wait. The source-build targets will run this
+ # script again without setting source_build=true when it is done setting up
+ # the build environment. See 'eng/SourceBuild.props'.
+ if [[ "$source_build" != true ]]; then
+ bootstrap_config=Proto
+ bootstrap_dir=$artifacts_dir/Bootstrap
+ if [[ "$force_bootstrap" == true ]]; then
+ rm -fr $bootstrap_dir
+ fi
+ if [ ! -f "$bootstrap_dir/fslex.dll" ]; then
+ BuildMessage="Error building tools"
+ MSBuild "$repo_root/src/buildtools/buildtools.proj" \
+ /restore \
+ /p:Configuration=$bootstrap_config
+
+ mkdir -p "$bootstrap_dir"
+ cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/net5.0 $bootstrap_dir/fslex
+ cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/net5.0 $bootstrap_dir/fsyacc
+ fi
+ if [ ! -f "$bootstrap_dir/fsc.exe" ]; then
+ BuildMessage="Error building bootstrap"
+ MSBuild "$repo_root/proto.proj" \
+ /restore \
+ /p:Configuration=$bootstrap_config
+
+ cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/net5.0 $bootstrap_dir/fsc
+ fi
fi
if [[ "$skip_build" != true ]]; then
diff --git a/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj b/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj
index 464b6ef78..5c78bbe6d 100644
--- a/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj
+++ b/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj
@@ -4,6 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>
<ItemGroup>
diff --git a/src/buildtools/fslex/fslex.fsproj b/src/buildtools/fslex/fslex.fsproj
index 1959ce59c..3d63bf6bf 100644
--- a/src/buildtools/fslex/fslex.fsproj
+++ b/src/buildtools/fslex/fslex.fsproj
@@ -5,6 +5,7 @@
<TargetFramework>net5.0</TargetFramework>
<DefineConstants>INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants)</DefineConstants>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>
<ItemGroup>
diff --git a/src/buildtools/fsyacc/fsyacc.fsproj b/src/buildtools/fsyacc/fsyacc.fsproj
index 5d1b7141f..63b63c5de 100644
--- a/src/buildtools/fsyacc/fsyacc.fsproj
+++ b/src/buildtools/fsyacc/fsyacc.fsproj
@@ -5,6 +5,7 @@
<TargetFramework>net5.0</TargetFramework>
<DefineConstants>INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants)</DefineConstants>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>
<ItemGroup>
diff --git a/src/fsharp/fsc/fsc.fsproj b/src/fsharp/fsc/fsc.fsproj
index 7fa31fc21..04025c297 100644
--- a/src/fsharp/fsc/fsc.fsproj
+++ b/src/fsharp/fsc/fsc.fsproj
@@ -12,6 +12,7 @@
<OtherFlags>$(OtherFlags) --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<NGenBinary>true</NGenBinary>
<UseAppHost>true</UseAppHost>
+ <UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
diff --git a/src/fsharp/fsi/fsi.fsproj b/src/fsharp/fsi/fsi.fsproj
index 9fd9b1333..eace6c166 100644
--- a/src/fsharp/fsi/fsi.fsproj
+++ b/src/fsharp/fsi/fsi.fsproj
@@ -13,6 +13,7 @@
<Win32Resource>fsi.res</Win32Resource>
<NGenBinary>true</NGenBinary>
<UseAppHost>true</UseAppHost>
+ <UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">

View file

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Davis Goodin <dagood@microsoft.com>
Date: Tue, 19 Oct 2021 19:38:52 -0500
Subject: [PATCH] Disable apphost build of 'csi', 'vbi' for source-build
Creating an apphost for a netcoreapp3.1 project uses the apphost pack as a
prebuilt. Stopping these projects from creating the apphost removes the prebuilt
for source-build.
See: https://github.com/dotnet/roslyn/issues/57233
PR: https://github.com/dotnet/roslyn/pull/57306
---
src/Interactive/csi/csi.csproj | 1 +
src/Interactive/vbi/vbi.vbproj | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/Interactive/csi/csi.csproj b/src/Interactive/csi/csi.csproj
index 3970bb4e9ea..e96beb550d2 100644
--- a/src/Interactive/csi/csi.csproj
+++ b/src/Interactive/csi/csi.csproj
@@ -6,6 +6,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>CSharpInteractive</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
+ <UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
diff --git a/src/Interactive/vbi/vbi.vbproj b/src/Interactive/vbi/vbi.vbproj
index 5bbdf7f03a7..5f732d71534 100644
--- a/src/Interactive/vbi/vbi.vbproj
+++ b/src/Interactive/vbi/vbi.vbproj
@@ -6,6 +6,7 @@
<OutputType>Exe</OutputType>
<StartupObject>Sub Main</StartupObject>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
+ <UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
<RootNamespace></RootNamespace>
</PropertyGroup>
<ItemGroup Label="Project References">