From 8459d3aa25a8d1d8921ce03fec9701916980ca0c Mon Sep 17 00:00:00 2001 From: Davis Goodin 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. --- 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 22c929f286..903ee00d3f 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -41,7 +41,7 @@ + EnvironmentVariables="@(InnerBuildEnv);DotNetBuildFromSource=true" /> diff --git a/eng/build.sh b/eng/build.sh index 9a2aa0083f..6af4222371 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 464b6ef78c..5c78bbe6db 100644 --- a/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj +++ b/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj @@ -4,6 +4,7 @@ Exe net5.0 true + false diff --git a/src/buildtools/fslex/fslex.fsproj b/src/buildtools/fslex/fslex.fsproj index 1959ce59c0..3d63bf6bf2 100644 --- a/src/buildtools/fslex/fslex.fsproj +++ b/src/buildtools/fslex/fslex.fsproj @@ -5,6 +5,7 @@ net5.0 INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants) true + false diff --git a/src/buildtools/fsyacc/fsyacc.fsproj b/src/buildtools/fsyacc/fsyacc.fsproj index 5d1b7141f4..63b63c5dee 100644 --- a/src/buildtools/fsyacc/fsyacc.fsproj +++ b/src/buildtools/fsyacc/fsyacc.fsproj @@ -5,6 +5,7 @@ net5.0 INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants) true + false diff --git a/src/fsharp/fsc/fsc.fsproj b/src/fsharp/fsc/fsc.fsproj index 1bf8a94662..9c6a120bd8 100644 --- a/src/fsharp/fsc/fsc.fsproj +++ b/src/fsharp/fsc/fsc.fsproj @@ -12,6 +12,7 @@ true true true + false diff --git a/src/fsharp/fsi/fsi.fsproj b/src/fsharp/fsi/fsi.fsproj index 92a4976297..f8928b40b5 100644 --- a/src/fsharp/fsi/fsi.fsproj +++ b/src/fsharp/fsi/fsi.fsproj @@ -13,6 +13,7 @@ fsi.res true true + false