329 lines
18 KiB
XML
329 lines
18 KiB
XML
<Project>
|
|
<Import Project="RepositoryBuild.targets" />
|
|
<Import Project="PackageArchive.targets" />
|
|
<Import Project="AzureIntegration.targets" />
|
|
<Import Project="SharedFx.targets" />
|
|
<Import Project="CodeSign.targets" />
|
|
<Import Project="Publish.targets" />
|
|
<Import Project="buildorder.props" />
|
|
|
|
<PropertyGroup>
|
|
<!-- Some projects need access to tasks bundled in KoreBuild. -->
|
|
<BuildProperties>$(BuildProperties);BuildToolsTaskAssembly=$(_BuildToolsAssembly)</BuildProperties>
|
|
|
|
<GeneratedPackageVersionPropsPath>$(IntermediateDir)dependencies.g.props</GeneratedPackageVersionPropsPath>
|
|
<GeneratedRestoreSourcesPropsPath>$(IntermediateDir)sources.g.props</GeneratedRestoreSourcesPropsPath>
|
|
<GeneratedBrandingPropsPath>$(IntermediateDir)branding.g.props</GeneratedBrandingPropsPath>
|
|
|
|
<PrepareDependsOn>SetTeamCityBuildNumberToVersion;$(PrepareDependsOn)</PrepareDependsOn>
|
|
<PrepareDependsOn Condition="'$(_ProjectsOnly)' != 'true'">$(PrepareDependsOn);VerifyPackageArtifactConfig;VerifyExternalDependencyConfig;PrepareOutputPaths</PrepareDependsOn>
|
|
<CleanDependsOn>$(CleanDependsOn);CleanArtifacts;CleanRepoArtifacts</CleanDependsOn>
|
|
<RestoreDependsOn>$(RestoreDependsOn);InstallDotNet;RestoreProjects</RestoreDependsOn>
|
|
<CompileDependsOn>$(CompileDependsOn);BuildProjects</CompileDependsOn>
|
|
<CompileDependsOn Condition="'$(_ProjectsOnly)' != 'true'">$(CompileDependsOn);PackProjects;BuildRepositories;BuildSharedFx</CompileDependsOn>
|
|
<PackageDependsOn Condition=" '$(_ProjectsOnly)' == 'true'">$(PackageDependsOn);PackProjects</PackageDependsOn>
|
|
<PackageDependsOn Condition="'$(TestOnly)' != 'true' AND '$(_ProjectsOnly)' != 'true'">$(PackageDependsOn);CheckExpectedPackagesExist</PackageDependsOn>
|
|
<PackageDependsOn Condition="'$(TestOnly)' != 'true'">$(PackageDependsOn);CodeSign</PackageDependsOn>
|
|
<TestDependsOn>$(TestDependsOn);TestProjects</TestDependsOn>
|
|
<TestDependsOn Condition="'$(_ProjectsOnly)' != 'true'">$(TestDependsOn);_TestRepositories</TestDependsOn>
|
|
<GetArtifactInfoDependsOn>$(GetArtifactInfoDependsOn);GetProjectArtifactInfo</GetArtifactInfoDependsOn>
|
|
<GetArtifactInfoDependsOn Condition="'$(_ProjectsOnly)' != 'true'">$(GetArtifactInfoDependsOn);ResolveRepoInfo</GetArtifactInfoDependsOn>
|
|
</PropertyGroup>
|
|
|
|
<Target Name="PrepareOutputPaths">
|
|
<MakeDir Directories="$(ArtifactsDir);$(BuildDir)" />
|
|
</Target>
|
|
|
|
<Target Name="GenerateProjectList" DependsOnTargets="ResolveProjects">
|
|
<MSBuild Projects="@(ProjectToBuild)"
|
|
Targets="GetReferencesProvided"
|
|
BuildInParallel="true"
|
|
SkipNonexistentTargets="true"
|
|
SkipNonexistentProjects="true" >
|
|
|
|
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider"/>
|
|
</MSBuild>
|
|
|
|
<PropertyGroup>
|
|
<ProjectListFile>$(MSBuildThisFileDirectory)..\eng\ProjectReferences.props</ProjectListFile>
|
|
<ProjectListContent>
|
|
<![CDATA[
|
|
<!-- This file is automatically generated. Run `build.cmd /t:GenerateProjectList` to update. -->
|
|
<Project>
|
|
<ItemGroup>
|
|
@(_ProjectReferenceProvider->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepositoryRoot)%(ProjectFileRelativePath)" />', '%0A ')
|
|
</ItemGroup>
|
|
</Project>
|
|
]]>
|
|
</ProjectListContent>
|
|
</PropertyGroup>
|
|
|
|
<WriteLinesToFile File="$(ProjectListFile)" Lines="$(ProjectListContent)" Overwrite="true" />
|
|
</Target>
|
|
|
|
<Target Name="_ResolveProjectArtifactsInfoShipped" AfterTargets="GetProjectArtifactInfo">
|
|
<ItemGroup>
|
|
<ShippedArtifactInfo Include="@(ArtifactInfo)" Condition="'%(ArtifactInfo.IsShipped)' == 'true'" />
|
|
<ArtifactInfo Remove="@(ShippedArtifactInfo)" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target Name="ResolveRepoInfo" DependsOnTargets="_ResolveProjectArtifactsInfoShipped;_PrepareRepositories;GetLineupPackageInfo">
|
|
<!-- We need to pass the NETCoreApp package versions to msbuild so that it doesn't complain about us using a different one than it was restored against. -->
|
|
<PropertyGroup>
|
|
<DesignTimeBuildProps>$(BuildProperties);MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion);</DesignTimeBuildProps>
|
|
<DesignTimeBuildProps>$(DesignTimeBuildProps);MicrosoftNETCoreApp22PackageVersion=$(MicrosoftNETCoreApp22PackageVersion);</DesignTimeBuildProps>
|
|
<DesignTimeBuildProps>$(DesignTimeBuildProps);MicrosoftNETCoreApp21PackageVersion=$(MicrosoftNETCoreApp21PackageVersion);</DesignTimeBuildProps>
|
|
<DesignTimeBuildProps>$(DesignTimeBuildProps);MicrosoftNETCoreApp20PackageVersion=$(MicrosoftNETCoreApp20PackageVersion);</DesignTimeBuildProps>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<_RepositoryProject Include="$(MSBuildProjectFullPath)" Condition="'%(Repository.Identity)' != ''">
|
|
<AdditionalProperties>RepositoryRoot=%(Repository.RootPath)</AdditionalProperties>
|
|
<Build>%(Repository.Build)</Build>
|
|
</_RepositoryProject>
|
|
</ItemGroup>
|
|
|
|
<MSBuild Projects="@(_RepositoryProject)"
|
|
Targets="GetArtifactInfo"
|
|
Properties="$(DesignTimeBuildProps);Configuration=$(Configuration);BuildNumber=$(BuildNumber);DesignTimeBuild=true;"
|
|
BuildInParallel="true">
|
|
<Output TaskParameter="TargetOutputs" ItemName="ArtifactInfo" />
|
|
</MSBuild>
|
|
|
|
<MSBuild Projects="@(ProjectToBuild)"
|
|
Targets="GetArtifactInfo"
|
|
Properties="$(DesignTimeBuildProps);Configuration=$(Configuration);BuildNumber=$(BuildNumber);DesignTimeBuild=true"
|
|
SkipNonexistentTargets="true"
|
|
BuildInParallel="true">
|
|
<Output TaskParameter="TargetOutputs" ItemName="ArtifactInfo" />
|
|
</MSBuild>
|
|
|
|
<MSBuild Projects="@(_RepositoryProject)"
|
|
Targets="ResolveSolutions"
|
|
Properties="$(DesignTimeBuildProps);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
|
|
ContinueOnError="WarnAndContinue"
|
|
BuildInParallel="true"
|
|
Condition="@(_RepositoryProject->Count()) != 0">
|
|
<Output TaskParameter="TargetOutputs" ItemName="Solution" Condition="'%(_RepositoryProject.Build)' == 'true'" />
|
|
<Output TaskParameter="TargetOutputs" ItemName="_NoBuildSolution" Condition="'%(_RepositoryProject.Build)' != 'true'" />
|
|
</MSBuild>
|
|
|
|
<!--
|
|
Analyze what was shipped in these repos.
|
|
This is required so we can verify that cascading versions are consistent.
|
|
-->
|
|
<MSBuild Projects="$(MSBuildProjectFullPath)"
|
|
Targets="GetArtifactInfo"
|
|
Properties="$(DesignTimeBuildProps);RepositoryRoot=%(ShippedRepository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber);IsFinalBuild=true;DesignTimeBuild=true"
|
|
ContinueOnError="WarnAndContinue"
|
|
Condition="'%(ShippedRepository.Identity)' != ''">
|
|
<Output TaskParameter="TargetOutputs" ItemName="ShippedArtifactInfo" />
|
|
</MSBuild>
|
|
<MSBuild Projects="$(MSBuildProjectFullPath)"
|
|
Targets="ResolveSolutions"
|
|
Properties="RepositoryRoot=%(ShippedRepository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
|
|
ContinueOnError="WarnAndContinue"
|
|
Condition="'%(ShippedRepository.Identity)' != ''">
|
|
<Output TaskParameter="TargetOutputs" ItemName="_ShippedSolution" />
|
|
</MSBuild>
|
|
|
|
<ItemGroup>
|
|
<_Temp Remove="@(_Temp)" />
|
|
<_Temp Include="@(PackageArtifact)" />
|
|
<PackageArtifact Remove="@(PackageArtifact)" />
|
|
</ItemGroup>
|
|
|
|
<Move SourceFiles="%(SubmoduleGlobalJsonFiles.BackupPath)" DestinationFiles="%(SubmoduleGlobalJsonFiles.Identity)" Condition="Exists(%(SubmoduleGlobalJsonFiles.BackupPath))" />
|
|
|
|
<!-- Join required because shipping category is stored in artifact.props (PackageArtifact), but information about package ID and version comes from repos (ArtifactInfo). -->
|
|
<RepoTasks.JoinItems
|
|
Left="@(_Temp)"
|
|
LeftMetadata="*"
|
|
Right="@(ArtifactInfo->WithMetadataValue('ArtifactType','NuGetPackage'));@(ShippedArtifactInfo->WithMetadataValue('ArtifactType','NuGetPackage'))"
|
|
RightKey="PackageId"
|
|
RightMetadata="Version">
|
|
<Output TaskParameter="JoinResult" ItemName="PackageArtifact" />
|
|
</RepoTasks.JoinItems>
|
|
|
|
<ItemGroup>
|
|
<_PackageArtifactWithoutMatchingInfo Include="@(_Temp)" Exclude="@(PackageArtifact)" />
|
|
</ItemGroup>
|
|
|
|
<Error Text="Could not detect version information for package id:%0A * @(_PackageArtifactWithoutMatchingInfo, '%0A * ')"
|
|
Condition="@(_PackageArtifactWithoutMatchingInfo->Count()) != 0" />
|
|
|
|
<ItemGroup>
|
|
<!-- Adjust the list of what is considered external vs locally built. -->
|
|
<ExternalDependency Include="%(ShippedArtifactInfo.PackageId)" Condition="'%(ShippedArtifactInfo.ArtifactType)' == 'NuGetPackage'">
|
|
<Version>%(ShippedArtifactInfo.Version)</Version>
|
|
</ExternalDependency>
|
|
|
|
<!-- capture the original list of PackageArtifacts -->
|
|
<_PackageArtifactSpec Include="@(PackageArtifact)" />
|
|
|
|
<PackageArtifact Remove="%(ShippedArtifactInfo.PackageId)" Condition="'%(ShippedArtifactInfo.ArtifactType)' == 'NuGetPackage'" />
|
|
|
|
<Solution Update="@(Solution)" Build="true" IsPatching="true" />
|
|
<_ShippedSolution Update="@(_ShippedSolution)" Build="false" IsPatching="false" />
|
|
<_NoBuildSolution Update="@(_NoBuildSolution)" Build="false" />
|
|
<Solution Include="@(_NoBuildSolution);@(_ShippedSolution)" />
|
|
</ItemGroup>
|
|
|
|
<Error Text="No solutions were found in '$(SubmoduleRoot)'. Did you forget to clone the submodules? Run `git submodule update --init`." Condition="@(Solution->Count()) == 0" />
|
|
</Target>
|
|
|
|
<Target Name="GetLineupPackageInfo">
|
|
<ItemGroup>
|
|
<ArtifactInfo Include="$(BuildDir)Internal.AspNetCore.Universe.Lineup.$(PackageVersion).nupkg">
|
|
<ArtifactType>NuGetPackage</ArtifactType>
|
|
<PackageId>Internal.AspNetCore.Universe.Lineup</PackageId>
|
|
<Version>$(PackageVersion)</Version>
|
|
<Category>noship</Category>
|
|
<IsLineup>true</IsLineup>
|
|
</ArtifactInfo>
|
|
<FilesToSign Include="$(BuildDir)Internal.AspNetCore.Universe.Lineup.$(PackageVersion).nupkg" Certificate="$(PackageSigningCertName)" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target Name="GeneratePropsFiles" DependsOnTargets="PrepareOutputPaths;GetArtifactInfo">
|
|
<ItemGroup>
|
|
<_LineupPackages Include="@(ExternalDependency)" />
|
|
<_LineupPackages Include="%(ArtifactInfo.PackageId)" Version="%(ArtifactInfo.Version)" Condition=" '%(ArtifactInfo.ArtifactType)' == 'NuGetPackage' " />
|
|
|
|
<_RestoreSources Include="$(DependencyPackageDir)" Condition="'$(DependencyPackageDir)' != '' AND Exists('$(DependencyPackageDir)')" />
|
|
<_RestoreSources Include="$(SignedDependencyPackageDir)" Condition="'$(SignedDependencyPackageDir)' != '' AND Exists('$(SignedDependencyPackageDir)')" />
|
|
<_RestoreSources Include="$(BuildDir)" />
|
|
<_RestoreSources Include="$(RestoreSources)" />
|
|
</ItemGroup>
|
|
|
|
<GeneratePackageVersionPropsFile
|
|
Packages="@(_LineupPackages)"
|
|
OutputPath="$(GeneratedPackageVersionPropsPath)" />
|
|
|
|
<Copy SourceFiles="$(GeneratedPackageVersionPropsPath)" DestinationFolder="$(ArtifactsDir)" />
|
|
|
|
<RepoTasks.GenerateRestoreSourcesPropsFile
|
|
Sources="@(_RestoreSources)"
|
|
OutputPath="$(GeneratedRestoreSourcesPropsPath)" />
|
|
|
|
<PropertyGroup>
|
|
<!-- Generate an MSBuild file that can be imported and used by Windows Installer builds to keep our versions consistent. -->
|
|
<BrandingPropsContent>
|
|
<![CDATA[
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<PropertyGroup>
|
|
<AspNetCoreMajorVersion>$(AspNetCoreMajorVersion)</AspNetCoreMajorVersion>
|
|
<AspNetCoreMinorVersion>$(AspNetCoreMinorVersion)</AspNetCoreMinorVersion>
|
|
<AspNetCorePatchVersion>$(AspNetCorePatchVersion)</AspNetCorePatchVersion>
|
|
<AspNetCorePreReleaseVersionLabel>$(PreReleaseLabel)</AspNetCorePreReleaseVersionLabel>
|
|
<AspNetCoreBuildNumber>$(BuildNumber)</AspNetCoreBuildNumber>
|
|
<AspNetCoreBrandingVersion>$(PackageBrandingVersion)</AspNetCoreBrandingVersion>
|
|
</PropertyGroup>
|
|
</Project>
|
|
]]>
|
|
</BrandingPropsContent>
|
|
</PropertyGroup>
|
|
|
|
<WriteLinesToFile File="$(GeneratedBrandingPropsPath)" Overwrite="true" Lines="$(BrandingPropsContent)"/>
|
|
|
|
<Copy SourceFiles="$(GeneratedPackageVersionPropsPath);$(GeneratedBrandingPropsPath)" DestinationFolder="$(ArtifactsDir)" />
|
|
|
|
<PackNuSpec NuSpecPath="$(MSBuildThisFileDirectory)lineups\Internal.AspNetCore.Universe.Lineup.nuspec"
|
|
DestinationFolder="$(BuildDir)"
|
|
Overwrite="true"
|
|
Properties="version=$(PackageVersion);dependenciesPropsFile=$(GeneratedPackageVersionPropsPath);brandingPropsFile=$(GeneratedBrandingPropsPath)">
|
|
<Output TaskParameter="Packages" ItemName="LineupPackage" />
|
|
</PackNuSpec>
|
|
</Target>
|
|
|
|
<Target Name="CleanRepoArtifacts">
|
|
<RemoveDir Directories="$(RepositoryRoot)obj" Condition="Exists('$(RepositoryRoot)obj')" />
|
|
</Target>
|
|
|
|
<Target Name="_PrepareRepositories">
|
|
<ItemGroup Condition="'$(KOREBUILD_REPOSITORY_INCLUDE)'!=''">
|
|
<_RepositoriesToInclude Include="$(KOREBUILD_REPOSITORY_INCLUDE)" />
|
|
<Repository Update="@(Repository)" Build="false" />
|
|
<Repository
|
|
Update="@(Repository)"
|
|
Condition="'@(Repository)'=='@(_RepositoriesToInclude)' AND '%(Identity)'!=''"
|
|
Build="true" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup Condition="'$(KOREBUILD_REPOSITORY_EXCLUDE)'!=''">
|
|
<_RepositoriesToExclude Include="$(KOREBUILD_REPOSITORY_EXCLUDE)" />
|
|
<Repository
|
|
Update="@(Repository)"
|
|
Condition="'@(Repository)'=='@(_RepositoriesToExclude)' AND '%(Identity)'!=''"
|
|
Build="false" />
|
|
</ItemGroup>
|
|
|
|
<Error Text="KOREBUILD_REPOSITORY_EXCLUDE AND KOREBUILD_REPOSITORY_INCLUDE are specified."
|
|
Condition="'$(KOREBUILD_REPOSITORY_INCLUDE)' != '' AND '$(KOREBUILD_REPOSITORY_EXCLUDE)' != ''" />
|
|
|
|
<ItemGroup>
|
|
<Repository Update="%(Identity)" RootPath="$(SubmoduleRoot)%(Identity)\" Condition="'%(Identity)' != '' AND '%(RootPath)' == ''" />
|
|
<ShippedRepository Update="%(Identity)" RootPath="$(SubmoduleRoot)%(Identity)\" Condition="'%(Identity)' != '' AND '%(RootPath)' == ''" />
|
|
|
|
<SubmoduleGlobalJsonFiles Include="%(Repository.RootPath)global.json" BackupPath="$(IntermediateDir)%(Repository.Identity)-global.json" Condition="'%(Repository.Identity)' != ''"/>
|
|
<SubmoduleGlobalJsonFiles Include="%(ShippedRepository.RootPath)global.json" BackupPath="$(IntermediateDir)%(ShippedRepository.Identity)-global.json" Condition="'%(ShippedRepository.Identity)' != ''"/>
|
|
</ItemGroup>
|
|
|
|
<Move SourceFiles="%(SubmoduleGlobalJsonFiles.Identity)" DestinationFiles="%(SubmoduleGlobalJsonFiles.BackupPath)" Condition="Exists(%(SubmoduleGlobalJsonFiles.Identity))" />
|
|
</Target>
|
|
|
|
<Target Name="BuildRepositories"
|
|
DependsOnTargets="_PrepareRepositories;GeneratePropsFiles;ComputeGraph;_BuildRepositories" />
|
|
|
|
<Target Name="ListExpectedPackages" DependsOnTargets="GetProjectArtifactInfo;GetFxProjectArtifactInfo;ResolveRepoInfo">
|
|
<WriteLinesToFile File="$(RepositoryRoot)artifacts\packages.csv" Lines="PackageId,Version;@(ArtifactInfo->WithMetadataValue('ArtifactType', 'NuGetPackage')->'%(PackageId),%(Version)')" Overwrite="true" />
|
|
</Target>
|
|
|
|
<Target Name="ComputeGraph" DependsOnTargets="GetProjectArtifactInfo;GetFxProjectArtifactInfo;ResolveRepoInfo;GeneratePropsFiles">
|
|
<ItemGroup>
|
|
<_UndeclaredPackageArtifact Include="%(ArtifactInfo.PackageId)" Condition="'%(ArtifactInfo.ArtifactType)' == 'NuGetPackage'" />
|
|
<_UndeclaredPackageArtifact Remove="@(PackageArtifact)" />
|
|
<RepositoryBuildOrder Remove="@(ShippedRepository)" />
|
|
</ItemGroup>
|
|
|
|
<Error Text="Undeclared package artifacts. Add these to artifacts.props:%0A - @(_UndeclaredPackageArtifact, '%0A - ')"
|
|
Condition=" @(_UndeclaredPackageArtifact->Count()) != 0 " />
|
|
|
|
<Message Text="Repository build order:" Importance="high" />
|
|
<Message Text="%(RepositoryBuildOrder.Order). @(RepositoryBuildOrder, ', ')" Importance="high" />
|
|
</Target>
|
|
|
|
<Target Name="VerifyPackageArtifactConfig">
|
|
<Error Text="Invalid configuration of %(PackageArtifact.Identity). PackageArtifact must have the 'Category' metadata."
|
|
Condition="'%(PackageArtifact.Category)' == '' " />
|
|
</Target>
|
|
|
|
<Target Name="VerifyExternalDependencyConfig">
|
|
<RepoTasks.CheckVersionOverrides DotNetPackageVersionPropsPath="$(DotNetPackageVersionPropsPath)"
|
|
DependenciesFile="$(MSBuildThisFileDirectory)dependencies.props"
|
|
Condition="'$(DotNetPackageVersionPropsPath)' != ''" />
|
|
|
|
<Error Text="Missing Version metadata for the following external dependencies: %0A - @(ExternalDependency->WithMetadataValue('Version', ''), '%0A - '). "
|
|
Condition=" @(ExternalDependency->WithMetadataValue('Version', '')->Count()) != 0 " />
|
|
</Target>
|
|
|
|
<Target Name="FastCheck"
|
|
DependsOnTargets="ComputeGraph;VerifyPackageArtifactConfig;VerifyAllReposHaveNuGetPackageVerifier" />
|
|
|
|
<Target Name="CheckExpectedPackagesExist">
|
|
<ItemGroup>
|
|
<PackageArtifactFile Include="$(BuildDir)*.nupkg" Exclude="$(BuildDir)*.symbols.nupkg" />
|
|
</ItemGroup>
|
|
|
|
<RepoTasks.CheckExpectedPackagesExist Packages="@(PackageArtifact)" Files="@(PackageArtifactFile)" />
|
|
</Target>
|
|
|
|
<Target Name="VerifyAllReposHaveNuGetPackageVerifier" DependsOnTargets="_PrepareRepositories">
|
|
<Error Condition="'%(Repository.Identity)' != '' AND !Exists('%(Repository.RootPath)NuGetPackageVerifier.json')"
|
|
Text="Repository %(Repository.Identity) is missing NuGetPackageVerifier.json. Expected file to exist in %(Repository.RootPath)NuGetPackageVerifier.json" />
|
|
</Target>
|
|
|
|
</Project>
|