Skip to content

Commit

Permalink
Switch to new VMR control set (#17703) (port from main) (#17788)
Browse files Browse the repository at this point in the history
* Now that fsharp is on 9.0, we can switch to the new control set. Generally:
- DotNetBuildFromSource -> DotNetBuildSourceOnly - Building a source-only build.
- DotnetBuildFromSourceFlavor == Product -> DotNetBuildOrchestrator == true - Building in the VMR, could be source-only or MS's build.
- ArcadeBuildFromSource -> DotNetBuildRepo == true -> Indicates an outer repo build.
- ExcludeFromSourceBuild -> ExcludeFromSourceOnlyBuild

* Split out source build args

* Split out source build args

* Remove unnecessary source build env var set

* Add properties to the bootstrap compiler build

* BuildRepo -> BuildInnerRepo

* Only build proto repo in inner build

* Additional VMR properties for completeness

* Rename sourcebuild.props -> dotnetbuild.props

---------

Co-authored-by: Petr <psfinaki@users.noreply.github.com>
  • Loading branch information
mmitche and psfinaki authored Sep 26, 2024
1 parent 3044166 commit 44f5feb
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<RepoRoot Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory)</RepoRoot>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<FSharpNetCoreProductDefaultTargetFramework>net9.0</FSharpNetCoreProductDefaultTargetFramework>
<IgnoreMibc Condition="'$(IgnoreMibc)' == ''">$(DotNetBuildFromSource)</IgnoreMibc>
<IgnoreMibc Condition="'$(IgnoreMibc)' == ''">$(DotNetBuildSourceOnly)</IgnoreMibc>
</PropertyGroup>

<!--
Expand Down Expand Up @@ -73,7 +73,7 @@
we should also support $(NetPrevious) for all releases.
This will likely include FCS and FSharp.Core as well as shipped products.
Right now, it only covers products we ship (FSC and FSI), not NuGet packages. -->
<When Condition="'$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' == 'Product'">
<When Condition="'$(DotNetBuildSourceOnly)' == 'true' AND '$(DotNetBuildOrchestrator)' == 'true'">
<PropertyGroup>
<FSharpNetCoreProductTargetFramework>$(NetCurrent)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
When .NET gets built from source, make the SDK aware there are bootstrap packages
for Microsoft.NETCore.App.Runtime.<rid> and Microsoft.NETCore.App.Crossgen2.<rid>.
-->
<ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true'">
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<KnownRuntimePack Update="Microsoft.NETCore.App">
<RuntimePackRuntimeIdentifiers
Condition="'%(TargetFramework)' == '$(NetCurrent)'">%(RuntimePackRuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier)</RuntimePackRuntimeIdentifiers>
Expand Down
4 changes: 2 additions & 2 deletions FSharpBuild.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
<EnableXlfLocalization Condition="'$(EnableXlfLocalization)' == '' AND ('$(Configuration)' == 'Proto' OR '$(MonoPackaging)' == 'true')">false</EnableXlfLocalization>
</PropertyGroup>

<!-- source build -->
<PropertyGroup Condition="'$(DotNetBuildFromSource)' == 'true' OR '$(ArcadeBuildFromSource)' == 'true'">
<!-- Do not publish in source-only modes. This switch is present in both inner and outer builds. -->
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<PublishWindowsPdb>false</PublishWindowsPdb>
</PropertyGroup>

Expand Down
4 changes: 3 additions & 1 deletion eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ function BuildSolution([string] $solutionName, $nopack) {
# Do not set the property to true explicitly, since that would override value projects might set.
$suppressExtensionDeployment = if (!$deployExtensions) { "/p:DeployExtension=false" } else { "" }

$sourceBuildArgs = if ($sourceBuild) { "/p:DotNetBuildSourceOnly=true /p:DotNetBuildRepo=true" } else { "" }

$BUILDING_USING_DOTNET_ORIG = $env:BUILDING_USING_DOTNET

$env:BUILDING_USING_DOTNET="false"
Expand All @@ -314,10 +316,10 @@ function BuildSolution([string] $solutionName, $nopack) {
/p:QuietRestore=$quietRestore `
/p:QuietRestoreBinaryLog=$binaryLog `
/p:TestTargetFrameworks=$testTargetFrameworks `
/p:DotNetBuildFromSource=$sourceBuild `
/p:CompressAllMetadata=$CompressAllMetadata `
/p:BuildNoRealsig=$buildnorealsig `
/v:$verbosity `
$sourceBuildArgs `
$suppressExtensionDeployment `
@properties

Expand Down
8 changes: 4 additions & 4 deletions eng/SourceBuild.props → eng/DotNetBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
-->
<Target Name="ConfigureInnerBuildArg"
BeforeTargets="GetSourceBuildCommandConfiguration"
Condition="'$(ArcadeBuildFromSource)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'">
Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<PropertyGroup>
<InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Microsoft.FSharp.Compiler.sln"</InnerBuildArgs>
</PropertyGroup>
Expand All @@ -26,7 +26,7 @@
<Target Name="BuildBootstrap"
DependsOnTargets="PrepareInnerSourceBuildRepoRoot"
BeforeTargets="RunInnerSourceBuildCommand"
Condition="'$(ArcadeBuildFromSource)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'">
Condition="'$(DotNetBuildSourceOnly)' == 'true'">

<PropertyGroup>
<SourceBuildBootstrapTfmArg Condition="$(SourceBuildBootstrapTfm) != ''">--tfm $(SourceBuildBootstrapTfm)</SourceBuildBootstrapTfmArg>
Expand All @@ -41,9 +41,9 @@
-bl enables the binlogs for the tools and Proto builds, which make debugging failures here easier
-->
<Exec
Command="./build.sh --bootstrap --skipBuild -bl $(SourceBuildBootstrapTfmArg) /p:SourceBuildUseMonoRuntime=$(SourceBuildUseMonoRuntime)"
Command="./build.sh --bootstrap --skipBuild -bl $(SourceBuildBootstrapTfmArg) /p:SourceBuildUseMonoRuntime=$(SourceBuildUseMonoRuntime) /p:DotNetBuildSourceOnly=true /p:DotNetBuildInnerRepo=true /p:DotNetBuildRepo=true /p:DotNetBuildOrchestrator=$(DotNetBuildOrchestrator)"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
EnvironmentVariables="@(InnerBuildEnv);DotNetBuildFromSource=true" />
EnvironmentVariables="@(InnerBuildEnv)" />
</Target>

</Project>
9 changes: 7 additions & 2 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ function BuildSolution {
if [[ "$UNAME" == "Darwin" ]]; then
enable_analyzers=false
fi

local source_build_args=""
if [[ "$source_build" == true ]]; then
source_build_args="/p:DotNetBuildRepo=true /p:DotNetBuildSourceOnly=true"
fi

# NuGet often exceeds the limit of open files on Mac and Linux
# https://github.com/NuGet/Home/issues/2163
Expand Down Expand Up @@ -274,7 +279,7 @@ function BuildSolution {
fi

BuildMessage="Error building tools"
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto /p:ArcadeBuildFromSource=$source_build $properties"
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto $source_build_args $properties"
echo $args
"$DOTNET_INSTALL_DIR/dotnet" $args #$args || exit $?
fi
Expand All @@ -296,8 +301,8 @@ function BuildSolution {
/p:ContinuousIntegrationBuild=$ci \
/p:QuietRestore=$quiet_restore \
/p:QuietRestoreBinaryLog="$binary_log" \
/p:ArcadeBuildFromSource=$source_build \
/p:BuildNoRealsig=$buildnorealsig \
$source_build_args \
$properties
fi
}
Expand Down
2 changes: 1 addition & 1 deletion eng/test-determinism.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function Run-Build([string]$rootDir, [string]$increment) {
/p:ContinuousIntegrationBuild=false `
/p:OfficialBuildId="" `
/p:QuietRestore=false `
/p:DotNetBuildFromSource=false `
/p:DotNetBuildSourceOnly=false `
/p:Deterministic=true `
/p:DebugDeterminism=true `
/p:Features="debug-determinism" `
Expand Down
6 changes: 4 additions & 2 deletions proto.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<RootDir Condition="'$(RootDir)'==''">Bootstrap</RootDir>
</PropertyGroup>

<!-- Skip on sourcebuild -->
<ItemGroup Condition="'$(ArcadeBuildFromSource)'!='true'">
<!-- This needs to be built only in the inner VMR build proto invocation, but not the outer VMR build invocation.
The project does not import Arcade targets so we only have the properties that were passed in, rather than
calculated properties like DotNetBuildPhase. -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)'!='true' or '$(DotNetBuildInnerRepo)' == 'true'">
<Projects Include="buildtools\fslex\fslex.fsproj" />
<Projects Include="buildtools\fsyacc\fsyacc.fsproj" />
<Projects Include="buildtools\AssemblyCheck\AssemblyCheck.fsproj" />
Expand Down
2 changes: 1 addition & 1 deletion setup/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<IntermediateOutputPath>$(ArtifactsDir)\VSSetup.obj\$(Configuration)\$(MSBuildProjectName)</IntermediateOutputPath>
<VsixBuildLocation>$(SetupRootFolder)..\artifacts\VSSetup\$(Configuration)</VsixBuildLocation>
<InsertionDir>$(SetupRootFolder)..\artifacts\VSSetup\$(Configuration)\Insertion</InsertionDir>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<SetupProductArch>Neutral</SetupProductArch>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion setup/Swix/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<Target Name="Build"
DependsOnTargets="ResolveProjectReferences"
Condition="'$(DotNetBuildFromSource)' != 'true' AND '$(ArcadeBuildFromSource)' != 'true'">
Condition="'$(DotNetBuildSourceOnly)' != 'true'">
<MakeDir Directories="$(IntermediateOutputPath)" ContinueOnError="True"/>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion src/fsc/fscAnyCpuProject/fscAnyCpu.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<TargetFrameworks>net472</TargetFrameworks>
<PlatformTarget>anycpu</PlatformTarget>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
</PropertyGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove('fsc.targets', '$(MSBuildThisFileDirectory)../'))" />
Expand Down
2 changes: 1 addition & 1 deletion src/fsc/fscArm64Project/fscArm64.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<TargetFrameworks>net472</TargetFrameworks>
<PlatformTarget>arm64</PlatformTarget>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
</PropertyGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove('fsc.targets', '$(MSBuildThisFileDirectory)../'))" />
Expand Down
2 changes: 1 addition & 1 deletion src/fsi/fsiAnyCpuProject/fsiAnyCpu.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<TargetFrameworks>net472</TargetFrameworks>
<PlatformTarget>anycpu</PlatformTarget>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<DefineConstants>$(DefineConstants);FSI_SHADOW_COPY_REFERENCES;FSI_SERVER</DefineConstants>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/fsi/fsiArm64Project/fsiArm64.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<TargetFrameworks>net472</TargetFrameworks>
<PlatformTarget>arm64</PlatformTarget>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<DefineConstants>$(DefineConstants);FSI_SHADOW_COPY_REFERENCES;FSI_SERVER</DefineConstants>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<DebugType>portable</DebugType>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UnitTestType>xunit</UnitTestType>
<IsTestProject>true</IsTestProject>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UnitTestType>xunit</UnitTestType>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<NoWarn>$(NoWarn);44</NoWarn> <!-- Obsolete -->
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion vsintegration/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net472</TargetFramework>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<UseVsMicroBuildAssemblyVersion>true</UseVsMicroBuildAssemblyVersion>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<SetupProductArch>Neutral</SetupProductArch>
<BypassVsixValidation>true</BypassVsixValidation>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<PropertyGroup>
<EnableXlfLocalization>false</EnableXlfLocalization>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
Expand Down

0 comments on commit 44f5feb

Please sign in to comment.