blob: c4042084bc458ec77e2c0d446fe0a095bebc8c33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
<Project>
<Import Project="RepositoryBuild.targets" />
<Import Project="RuntimeStore.targets" />
<Import Project="RuntimeStoreInstaller.targets" />
<Import Project="PackageArchive.targets" />
<Import Project="Templating.targets" />
<Import Project="push.targets" />
<PropertyGroup>
<SubmoduleRoot>$(RepositoryRoot)modules\</SubmoduleRoot>
<_DependencyBuildDirectory>$(RepositoryRoot).deps\build\</_DependencyBuildDirectory>
<_DependencyPackagesDirectory>$(_DependencyBuildDirectory)</_DependencyPackagesDirectory>
<_RepositoryBuildTargets Condition="'$(_RepositoryBuildTargets)'=='' AND '$(CompileOnly)'=='true'">/t:Package /t:VerifyPackages</_RepositoryBuildTargets>
<_RepositoryBuildTargets Condition="'$(_RepositoryBuildTargets)'==''">/t:Verify</_RepositoryBuildTargets>
<!-- For external packages that come from feeds will mirrored to aspnetcore feeds. -->
<IntermediateMirrorPackageDir>$(IntermediateDir)mirror\</IntermediateMirrorPackageDir>
<!-- For external packages that come from feeds we don't mirror. -->
<IntermediateExternalPackageDir>$(IntermediateDir)ext\</IntermediateExternalPackageDir>
<GeneratedPackageVersionPropsPath>$(IntermediateDir)dependencies.props</GeneratedPackageVersionPropsPath>
<GeneratedRestoreSourcesPropsPath>$(IntermediateDir)sources.props</GeneratedRestoreSourcesPropsPath>
<PrepareDependsOn>$(PrepareDependsOn);PrepareOutputPath</PrepareDependsOn>
<CleanDependsOn>$(CleanDependsOn);CleanArtifacts;CleanUniverseArtifacts</CleanDependsOn>
<RestoreDependsOn>$(RestoreDependsOn);RestoreExternalDependencies</RestoreDependsOn>
<CompileDependsOn>$(CompileDependsOn);BuildRepositories</CompileDependsOn>
<PackageDependsOn>$(PackageDependsOn);BuildAllMetapackage;BuildTemplates;SplitPackages</PackageDependsOn>
<VerifyDependsOn>$(VerifyDependsOn);VerifyCoherentVersions</VerifyDependsOn>
</PropertyGroup>
<Target Name="PrepareOutputPath">
<MakeDir Directories="$(ArtifactsDir);$(BuildDir)" />
</Target>
<Target Name="RestoreExternalDependencies">
<RepoTasks.DownloadNuGetPackages
Packages="@(ExternalDependency->WithMetadataValue('Mirror', 'false'))"
DestinationFolder="$(IntermediateExternalPackageDir)" />
<RepoTasks.DownloadNuGetPackages
Packages="@(ExternalDependency->WithMetadataValue('Mirror', 'true'))"
DestinationFolder="$(IntermediateMirrorPackageDir)" />
</Target>
<Target Name="GeneratePropsFiles" DependsOnTargets="ResolveRepoInfo">
<ItemGroup>
<_LineupPackages Include="@(ExternalDependency)" />
<_LineupPackages Include="%(ArtifactInfo.PackageId)" Version="%(ArtifactInfo.Version)" Condition=" '%(ArtifactInfo.ArtifactType)' == 'NuGetPackage' " />
<_LineupPackages Include="Microsoft.AspNetCore.All" Version="$(PackageVersion)" />
<_LineupSources Include="$(_DependencyPackagesDirectory)" Condition="'$(_DependencyPackagesDirectory)' != '' AND Exists('$(_DependencyPackagesDirectory)')" />
<_LineupSources Include="$(BuildDir)" />
<_LineupSources Include="$(IntermediateExternalPackageDir)" />
<_LineupSources Include="$(IntermediateMirrorPackageDir)" />
</ItemGroup>
<RepoTasks.GeneratePackageVersionPropsFile
Packages="@(_LineupPackages)"
OutputPath="$(GeneratedPackageVersionPropsPath)" />
<Copy SourceFiles="$(GeneratedPackageVersionPropsPath)" DestinationFolder="$(ArtifactsDir)" />
<RepoTasks.GenerateRestoreSourcesPropsFile
Sources="@(_LineupSources)"
OutputPath="$(GeneratedRestoreSourcesPropsPath)" />
</Target>
<Target Name="CleanUniverseArtifacts">
<RemoveDir Directories="$(RepositoryRoot)obj" Condition="Exists('$(RepositoryRoot)obj')" />
</Target>
<Target Name="_PrepareRepositories">
<ItemGroup Condition="'$(KOREBUILD_REPOSITORY_INCLUDE)'!=''">
<_RepositoriesToInclude Include="$(KOREBUILD_REPOSITORY_INCLUDE)" />
<Repository
Remove="@(Repository)"
Condition="'@(Repository)'!='@(_RepositoriesToInclude)' AND '%(Identity)'!=''" />
</ItemGroup>
<ItemGroup Condition="'$(KOREBUILD_REPOSITORY_EXCLUDE)'!=''">
<RepositoriesToExclude Include="$(KOREBUILD_REPOSITORY_EXCLUDE)" />
<Repository Remove="@(RepositoriesToExclude)" />
</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)\" />
<ShippedRepository Update="%(Identity)" RootPath="$(SubmoduleRoot)%(Identity)\" />
</ItemGroup>
</Target>
<Target Name="BuildRepositories"
DependsOnTargets="_PrepareRepositories;GeneratePropsFiles;ComputeGraph;_BuildRepositories" />
<Target Name="ResolveRepoInfo" DependsOnTargets="_PrepareRepositories">
<Error Text="%(Repository.RootPath) does not exist. Did you forget to clone the submodules? Run `git submodules update`." Condition="!Exists(%(Repository.RootPath))" />
<Error Text="%(ShippedRepository.RootPath) does not exist. Did you forget to clone the submodules? Run `git submodules update`." Condition="!Exists(%(ShippedRepository.RootPath))" />
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetArtifactInfo"
Properties="RepositoryRoot=%(Repository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="TargetOutputs" ItemName="ArtifactInfo" />
</MSBuild>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="ResolveSolutions"
Properties="RepositoryRoot=%(Repository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="TargetOutputs" ItemName="Solution" />
</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="RepositoryRoot=%(ShippedRepository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber);IsFinalBuild=true"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="TargetOutputs" ItemName="ShippedArtifactInfo" />
</MSBuild>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="ResolveSolutions"
Properties="RepositoryRoot=%(ShippedRepository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber)"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="TargetOutputs" ItemName="_NoBuildSolution" />
</MSBuild>
<ItemGroup>
<Solution Update="@(Solution)" Build="true" />
<_NoBuildSolution Update="@(_NoBuildSolution)" Build="false" />
<Solution Include="@(_NoBuildSolution)" />
</ItemGroup>
<Error Text="No solutions were found in '$(SubmoduleRoot)'" Condition="@(Solution->Count()) == 0" />
</Target>
<Target Name="ComputeGraph" DependsOnTargets="ResolveRepoInfo;GeneratePropsFiles">
<RepoTasks.AnalyzeBuildGraph
Solutions="@(Solution)"
Artifacts="@(ArtifactInfo)"
Dependencies="@(ExternalDependency)"
StartGraphAt="$(BuildGraphOf)"
Properties="Configuration=$(Configuration);BuildNumber=$(BuildNumber);DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath)">
<Output TaskParameter="RepositoryBuildOrder" ItemName="RepositoryBuildOrder" />
</RepoTasks.AnalyzeBuildGraph>
</Target>
<Target Name="SplitPackages">
<ItemGroup>
<PackageArtifactFile Include="$(BuildDir)*.nupkg" />
<ExternalDependencyPackage Include="@(ExternalDependency->WithMetadataValue('Mirror', 'true'))" Category="mirror" />
<_MirroredPackageFiles Include="$(IntermediateMirrorPackageDir)*.nupkg" />
</ItemGroup>
<RepoTasks.CopyPackagesToSplitFolders
Packages="@(PackageArtifact);@(ExternalDependencyPackage)"
Files="@(PackageArtifactFile);@(_MirroredPackageFiles)"
DestinationFolder="$(ArtifactsDir)"
Overwrite="true" />
</Target>
<Target Name="VerifyCoherentVersions" DependsOnTargets="ResolveRepoInfo">
<ItemGroup>
<ShippingPackageFiles Include="$(ArtifactsDir)ship\*.nupkg" />
<ShippedExternalDependency Include="%(ShippedArtifactInfo.PackageId)" Version="%(Version)" />
</ItemGroup>
<RepoTasks.VerifyCoherentVersions
PackageFiles="@(ShippingPackageFiles)"
ExternalDependencies="@(ExternalDependency);@(ShippedExternalDependency)" />
</Target>
</Project>
|