dotnet-installer/src/SourceBuild/content/repo-projects/installer.proj
Matt Mitchell d070660282
Enable installer and SDK repos in VMR build (#18632)
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2024-02-26 10:51:44 +00:00

140 lines
7.7 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Need to set to false to calculate RepositoryCommit. -->
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
<!-- Use the repo root build script -->
<BuildScript>$(ProjectDirectory)build$(ShellExtension)</BuildScript>
<!-- Restore and Build actions are already passed in by the root script. -->
<BuildActions>$(FlagParameterPrefix)pack $(FlagParameterPrefix)publish</BuildActions>
<!--
Setting NETCoreAppMaximumVersion to a high version so that the sdk doesn't complain if we're restoring/publishing for a higher version than the sdk.
See https://github.com/dotnet/sdk/issues/1512#issuecomment-377082883
-->
<BuildArgs>$(BuildArgs) /p:NETCoreAppMaximumVersion=99.9</BuildArgs>
<!-- We need to extract the non-portable OS name from the non-portable RID and pass that to installer build script.
This should not happen except when building non-portable. installer generally extracts the OSName from the host OS,
or from the Rid if supplied. -->
<BuildArgs Condition="$(PortableBuild) != 'true'">$(BuildArgs) /p:OSName=$(TargetRid.Substring(0, $(TargetRid.IndexOf("-"))))</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PortableOSName=$(__PortableTargetOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:Rid=$(TargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:Architecture=$(TargetArchitecture)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:DOTNET_INSTALL_DIR=$(DotNetRoot)</BuildArgs>
<BuildArgs Condition="'$(TargetOS)' != 'windows'">$(BuildArgs) /p:AspNetCoreInstallerRid=$(TargetRid)</BuildArgs>
<!-- installer always wants to build portable on FreeBSD -->
<BuildArgs Condition="'$(TargetOS)' == 'freebsd' and '$(DotNetBuildSourceOnly)' == 'true'">$(BuildArgs) /p:PortableBuild=true</BuildArgs>
<BuildArgs Condition="'$(TargetOS)' != 'windows'">$(BuildArgs) /p:NetRuntimeRid=$(TargetRid)</BuildArgs>
<!-- https://github.com/dotnet/source-build/issues/4138 -->
<BuildArgs Condition="'$(TargetOS)' != 'windows' and '$(TargetOS)' != 'osx'">$(BuildArgs) /p:SkipBuildingInstallers=true</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PublicBaseURL=file:%2F%2F$(ArtifactsAssetsDir)</BuildArgs>
<!-- In non-source-only scenarios, currently consume aspnetcore from the normal public base url -->
<BuildArgs>$(BuildArgs) /p:FallbackPublicBaseURL=https://dotnetbuilds.blob.core.windows.net/public/</BuildArgs>
<BuildArgs>$(BuildArgs) /p:UsePortableLinuxSharedFramework=false</BuildArgs>
<BuildArgs Condition="'$(PgoInstrument)' == 'true'">$(BuildArgs) /p:PgoInstrument=true</BuildArgs>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="aspire" />
<RepositoryReference Include="aspnetcore" />
<RepositoryReference Include="command-line-api" />
<RepositoryReference Include="deployment-tools" />
<RepositoryReference Include="emsdk" />
<RepositoryReference Include="fsharp" />
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="nuget-client" />
<RepositoryReference Include="roslyn" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="sdk" />
<RepositoryReference Include="symreader" />
<RepositoryReference Include="test-templates" />
<RepositoryReference Include="vstest" />
<RepositoryReference Include="windowsdesktop" Condition="'$(TargetOS)' == 'windows'" />
</ItemGroup>
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<RepositoryReference Include="source-build-externals" />
<RepositoryReference Include="source-build-reference-packages" />
</ItemGroup>
<!--
If we have authentication, keep the templating internal feed (if one exists) to acquire the
text-only prebuilt. The source-build repo as a whole should depend on the same internal feed as
this repo does, so authentication should already be set up in the global endpoints json.
-->
<ItemGroup Condition="'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != ''">
<KeepFeedPrefixes Include="darc-int-dotnet-aspnetcore-" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="CLIBUILD_SKIP_TESTS=true" />
<!-- https://github.com/dotnet/source-build/issues/4115. -->
<EnvironmentVariables Include="PublishWindowsPdb=false" />
</ItemGroup>
<Target Name="GetInputsOutputForCreatePrivateSourceBuiltArtifactsArchive"
DependsOnTargets="DetermineSourceBuiltSdkVersion">
<!-- Inputs: Packages to include in the tarball -->
<ItemGroup>
<ArtifactsPackageToBundle Include="$(ArtifactsShippingPackagesDir)**;
$(ArtifactsNonShippingPackagesDir)**"
Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" />
<ReferencePackageToBundle Include="$(ReferencePackagesDir)**"
Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" />
</ItemGroup>
<PropertyGroup>
<!-- Create a layout directory for the files that are to be included in the artifacts tarball. -->
<SourceBuiltLayoutDir>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', 'artifacts-layout'))</SourceBuiltLayoutDir>
<!-- Outputs -->
<SourceBuiltTarballName>$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</SourceBuiltTarballName>
<SourceBuiltVersionName>$(SourceBuiltLayoutDir).version</SourceBuiltVersionName>
<AllPackageVersionsPropsName>$(SourceBuiltLayoutDir)PackageVersions.props</AllPackageVersionsPropsName>
</PropertyGroup>
</Target>
<!-- Create the SourceBuilt.Private.Artifacts archive when building source-only. -->
<Target Name="CreatePrivateSourceBuiltArtifactsArchive"
AfterTargets="Build"
DependsOnTargets="GetInputsOutputForCreatePrivateSourceBuiltArtifactsArchive"
Inputs="@(ArtifactsPackageToBundle);@(ReferencePackageToBundle)"
Outputs="$(SourceBuiltTarballName);$(SourceBuiltVersionName);$(AllPackageVersionsPropsName)"
Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<!-- Copy packages to layout directory. Since there are a large number of files,
this will use symlinks instead of copying files to make this execute quickly. -->
<Copy SourceFiles="@(ArtifactsPackageToBundle)"
DestinationFolder="$(SourceBuiltLayoutDir)"
UseSymbolicLinksIfPossible="true" />
<Copy SourceFiles="@(ReferencePackageToBundle)"
DestinationFolder="$(SourceBuiltLayoutDir)SourceBuildReferencePackages"
UseSymbolicLinksIfPossible="true" />
<!-- Content of the .version file to include in the tarball -->
<ItemGroup>
<VersionFileContent Include="$(RepositoryCommit);$(SourceBuiltSdkVersion)" />
</ItemGroup>
<WriteLinesToFile File="$(SourceBuiltVersionName)"
Lines="@(VersionFileContent)"
Overwrite="true" />
<!-- Create a PackageVersions.props file that includes entries for all packages. -->
<WritePackageVersionsProps NuGetPackages="@(ArtifactsPackageToBundle)"
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
VersionPropsFlowType="AllPackages"
OutputPath="$(AllPackageVersionsPropsName)" />
<Exec Command="tar --numeric-owner -czhf $(SourceBuiltTarballName) $([System.IO.Path]::GetFileName('$(SourceBuiltVersionName)')) *"
WorkingDirectory="$(SourceBuiltLayoutDir)" />
<Message Importance="High" Text="Packaged source-built artifacts to $(SourceBuiltTarballName)" />
</Target>
</Project>