blob: 5fc3b44466628b7f6a59b14c535681ef679b9e6d (
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
<Project>
<Import Project="common.props" />
<PropertyGroup>
<_DependencyBuildDirectory>$(RepositoryRoot).deps\build\</_DependencyBuildDirectory>
<_DependencyMirrorDirectory>$(RepositoryRoot).deps\mirror\</_DependencyMirrorDirectory>
<_BuildScriptsDirectory>$(MSBuildThisFileDirectory)tools\scripts\</_BuildScriptsDirectory>
<_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
<_RuntimeStoreWorkDirectory>$(_WorkRoot).rw\</_RuntimeStoreWorkDirectory>
<_RuntimeStoreOutputDirectory>$(_WorkRoot).ro\</_RuntimeStoreOutputDirectory>
<_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
<_SrcDirectory>$(RepositoryRoot)src\</_SrcDirectory>
<_AllMetapackageDirectory>$(_SrcDirectory)Microsoft.AspNetCore.All\</_AllMetapackageDirectory>
<_ExistingManifestsDirectory>$(_AllMetapackageDirectory)build\</_ExistingManifestsDirectory>
<_ArtifactsZipDirectory>$(ArtifactsDir)zip\</_ArtifactsZipDirectory>
<_StoreZipDirectory>$(_ArtifactsZipDirectory)rs\</_StoreZipDirectory>
<_SymbolsZipDirectory>$(_ArtifactsZipDirectory)symbols\</_SymbolsZipDirectory>
<_DepsOutputDirectory>$(ArtifactsDir)deps\</_DepsOutputDirectory>
</PropertyGroup>
<Target Name="BuildAllMetapackage" DependsOnTargets="ResolveRepoInfo">
<!-- Clear working directory -->
<RemoveDir Directories="$(_WorkRoot)" />
<!-- Move to working dir -->
<PropertyGroup>
<MetapackageWorkDirectory>$(_WorkRoot)Microsoft.AspNetCore.All\</MetapackageWorkDirectory>
</PropertyGroup>
<ItemGroup>
<AllMetapackageFiles Include="$(_AllMetapackageDirectory)**\*" />
<ManifestFiles Include="$(ArtifactsDir)*.xml" />
</ItemGroup>
<Copy SourceFiles="@(AllMetapackageFiles)" DestinationFolder="$(MetapackageWorkDirectory)\%(RecursiveDir)" />
<Copy SourceFiles="$(_SrcDirectory)Directory.Build.props" DestinationFolder="$(_WorkRoot)" />
<!-- Create a consolidated manifest and place in metapackage -->
<RepoTasks.ConsolidateManifests
Manifests="@(ManifestFiles)"
ManifestDestination="$(MetapackageWorkDirectory)build\aspnetcore-store-$(PackageVersion).xml"/>
<!-- Add references to project -->
<RepoTasks.AddMetapackageReferences
ReferencePackagePath="$(MetapackageWorkDirectory)Microsoft.AspNetCore.All.csproj"
BuildArtifacts="@(ArtifactInfo)"
PackageArtifacts="@(PackageArtifact)"
ExternalDependencies="@(ExternalDependency)" />
<!-- Set _Target=Restore so the project will be re-evaluated to include Internal.AspNetCore.Sdk MSBuild properties on the next step. -->
<MSBuild Projects="$(MetapackageWorkDirectory)Microsoft.AspNetCore.All.csproj"
Targets="Restore"
Properties="Configuration=$(Configuration);BuildNumber=$(BuildNumber);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);AspNetUniverseBuildOffline=true;_Target=Restore" />
<!-- Pack -->
<MSBuild Projects="$(MetapackageWorkDirectory)Microsoft.AspNetCore.All.csproj"
Targets="Pack"
Properties="Configuration=$(Configuration);BuildNumber=$(BuildNumber);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);AspNetUniverseBuildOffline=true" />
<!-- Copy to output directory -->
<ItemGroup>
<AllMetapackageNupkgFile Include="$(MetapackageWorkDirectory)**\*.nupkg" />
</ItemGroup>
<Copy SourceFiles="@(AllMetapackageNupkgFile)" DestinationFolder="$(BuildDir)" />
</Target>
<Target Name="BuildRSReferencesPackage" DependsOnTargets="ResolveRepoInfo;_PrepareRuntimeStoreBuildAssets">
<!-- Clear working directory -->
<RemoveDir Directories="$(_WorkRoot)" />
<!-- Move to working dir -->
<PropertyGroup>
<RSReferencesWorkDirectory>$(_WorkRoot)RS.References\</RSReferencesWorkDirectory>
</PropertyGroup>
<Copy SourceFiles="$(_TemplatesDirectory)RS.References\RS.References.csproj" DestinationFolder="$(RSReferencesWorkDirectory)" />
<Copy SourceFiles="$(_SrcDirectory)Directory.Build.props" DestinationFolder="$(_WorkRoot)" />
<!-- Generate RS.Reference project -->
<RepoTasks.AddRSReferences
ReferencePackagePath="$(RSReferencesWorkDirectory)RS.References.csproj"
BuildArtifacts="@(ArtifactInfo)"
PackageArtifacts="@(PackageArtifact)"
ExternalDependencies="@(ExternalDependency)" />
<!-- Set _Target=Restore so the project will be re-evaluated to include Internal.AspNetCore.Sdk MSBuild properties on the next step. -->
<MSBuild Projects="$(RSReferencesWorkDirectory)RS.References.csproj"
Targets="Restore"
Properties="Configuration=$(Configuration);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);_Target=Restore" />
<!-- Pack -->
<MSBuild Projects="$(RSReferencesWorkDirectory)RS.References.csproj"
Targets="Pack"
Properties="Configuration=$(Configuration);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath)" />
<!-- Copy to output directory -->
<ItemGroup>
<RSReferenceNupkgFile Include="$(RSReferencesWorkDirectory)**\*.nupkg" />
</ItemGroup>
<Copy SourceFiles="@(RSReferenceNupkgFile)" DestinationFolder="$(_DependencyBuildDirectory)" />
</Target>
<Target Name="_PrepareRuntimeStoreBuildAssets">
<ItemGroup>
<_RuntimeStoreRestoreSources Include="$(_DependencyBuildDirectory)" Condition="Exists($(_DependencyBuildDirectory))" />
<_RuntimeStoreRestoreSources Include="$(_DependencyMirrorDirectory)" Condition="Exists($(_DependencyMirrorDirectory))" />
<_RuntimeStoreRestoreSources Include="$(BuildDir)" Condition="Exists($(BuildDir))" />
</ItemGroup>
<RepoTasks.GenerateRestoreSourcesPropsFile
Sources="@(_RuntimeStoreRestoreSources)"
OutputPath="$(GeneratedRestoreSourcesPropsPath)" />
<PropertyGroup>
<_RsManifestProps>MicrosoftAspNetCoreAllPackageVersion=$(PackageVersion)</_RsManifestProps>
<_RsManifestProps>$(_RsManifestProps);DotNetRestoreSourcesPropsPath=$(GeneratedRestoreSourcesPropsPath)</_RsManifestProps>
</PropertyGroup>
</Target>
<Target Name="_ResolveRuntimeStoreRID">
<Error Text="Please specify the platform for the runtime package store via RuntimeStoreArch: {x64|x86}." Condition="'$(RuntimeStoreArch)' == ''"/>
<PropertyGroup>
<RuntimeStoreRID Condition="$([MSBuild]::IsOSPlatform('Windows'))">win7-$(RuntimeStoreArch)</RuntimeStoreRID>
<RuntimeStoreRID Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux-$(RuntimeStoreArch)</RuntimeStoreRID>
<RuntimeStoreRID Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx-$(RuntimeStoreArch)</RuntimeStoreRID>
</PropertyGroup>
</Target>
<Target Name="BuildRuntimeStore" DependsOnTargets="_ResolveRuntimeStoreRID;_PrepareRuntimeStoreBuildAssets;BuildRSReferencesPackage">
<!-- Copy and update build assets -->
<Copy SourceFiles="$(_TemplatesDirectory)RS.Manifest\RS.Manifest.csproj" DestinationFiles="$(_WorkRoot)RS.Manifest\RS.Manifest.csproj" />
<Copy SourceFiles="$(_SrcDirectory)Directory.Build.props" DestinationFolder="$(_WorkRoot)" />
<PropertyGroup>
<__ComposeStoreProps />
<_ComposeStoreProps>$(_ComposeStoreProps);$(_RsManifestProps)</_ComposeStoreProps>
<_ComposeStoreProps>$(_ComposeStoreProps);ComposeDir=$(_RuntimeStoreOutputDirectory)</_ComposeStoreProps>
<_ComposeStoreProps>$(_ComposeStoreProps);ComposeWorkingDir=$(_RuntimeStoreWorkDirectory)</_ComposeStoreProps>
<_ComposeStoreProps>$(_ComposeStoreProps);RuntimeIdentifier=$(RuntimeStoreRID)</_ComposeStoreProps>
<_ComposeStoreProps>$(_ComposeStoreProps);RuntimeFrameworkVersion=$(MicrosoftNETCoreApp20PackageVersion)</_ComposeStoreProps>
</PropertyGroup>
<!-- Build runtime store -->
<MSBuild Projects="$(_WorkRoot)RS.Manifest\RS.Manifest.csproj"
Targets="ComposeStore"
Properties="$(_ComposeStoreProps)" />
</Target>
<Target Name="_BuildHostingDeps" >
<PropertyGroup>
<HostingStartupWorkDir>$(_WorkRoot)HostingStartup\</HostingStartupWorkDir>
<_HostingStartupProps>DepsOutputPath=$(_DepsOutputDirectory)</_HostingStartupProps>
<_HostingStartupProps>$(_HostingStartupProps);DotNetRestoreSourcesPropsPath=$(GeneratedRestoreSourcesPropsPath)</_HostingStartupProps>
<_HostingStartupProps>$(_HostingStartupProps);RuntimeFrameworkVersion=$(MicrosoftNETCoreApp20PackageVersion)</_HostingStartupProps>
<_HostingStartupProps>$(_HostingStartupProps);HostingStartupPackageName=$(HostingStartupPackageName)</_HostingStartupProps>
<_HostingStartupProps>$(_HostingStartupProps);HostingStartupPackageVersion=$(HostingStartupPackageVersion)</_HostingStartupProps>
</PropertyGroup>
<ItemGroup>
<HostingStartupFiles Include="$(_TemplatesDirectory)HostingStartup\**\*" />
</ItemGroup>
<!-- Clear working directory -->
<RemoveDir Directories="$(HostingStartupWorkDir)bin" />
<RemoveDir Directories="$(HostingStartupWorkDir)obj" />
<!-- Copy build assets -->
<Copy SourceFiles="@(HostingStartupFiles)" DestinationFolder="$(HostingStartupWorkDir)\%(RecursiveDir)" />
<!--- Workaround for https://github.com/dotnet/sdk/issues/1779 -->
<MSBuild Projects="$(HostingStartupWorkDir)HostingStartup.csproj"
Targets="Restore"
Properties="$(_HostingStartupProps);_SolutionTarget=Restore" />
<!--- MSBuild caches things if you run inproc so have to use Exec -->
<MSBuild Projects="$(HostingStartupWorkDir)HostingStartup.csproj"
Targets="Publish;CollectDeps"
Properties="$(_HostingStartupProps)" />
</Target>
<Target Name="BuildHostingDeps" DependsOnTargets="ResolveRepoInfo">
<!-- Generate RS.Reference project -->
<RepoTasks.ResolveHostingStartupPackages
BuildArtifacts="@(ArtifactInfo)"
PackageArtifacts="@(PackageArtifact)"
ExternalDependencies="@(ExternalDependency)">
<Output TaskParameter="HostingStartupArtifacts" ItemName="HostingStartupArtifacts" />
</RepoTasks.ResolveHostingStartupPackages>
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_BuildHostingDeps"
Properties="HostingStartupPackageName=%(HostingStartupArtifacts.PackageId);HostingStartupPackageVersion=%(HostingStartupArtifacts.Version)" />
<ItemGroup>
<DepsFiles Include="$(_DepsOutputDirectory)**\*.deps.json" />
</ItemGroup>
<RepoTasks.TrimDeps DepsFiles="@(DepsFiles)" />
</Target>
<Target Name="PackRuntimeStore" DependsOnTargets="_ResolveRuntimeStoreRID">
<PropertyGroup>
<OutputZip>$(ArtifactsDir)aspnetcore-store-$(PackageVersion)-$(RuntimeStoreRID).zip</OutputZip>
<OutputSymbolZip>$(ArtifactsDir)aspnetcore-symbols-$(PackageVersion)-$(RuntimeStoreRID).zip</OutputSymbolZip>
</PropertyGroup>
<ItemGroup>
<RuntimeStoreManifestFiles Include="$(_RuntimeStoreOutputDirectory)**\artifact.xml" />
<RuntimeStoreFiles Include="$(_RuntimeStoreOutputDirectory)**\*" Exclude="$(_RuntimeStoreOutputDirectory)**\artifact.xml;$(_RuntimeStoreOutputDirectory)symbols\**\*" />
<RuntimeStoreSymbolFiles Include="$(_RuntimeStoreOutputDirectory)symbols\**\*" />
<DepsFiles Include="$(_DepsOutputDirectory)**\*" />
<ExistingStoreManifests Include="$(_ExistingManifestsDirectory)*.xml" />
</ItemGroup>
<!-- Compose new store and symbols -->
<RepoTasks.ComposeNewStore
ExistingManifests="@(ExistingStoreManifests)"
NewManifests="@(RuntimeStoreManifestFiles)"
RuntimeStoreFiles="@(RuntimeStoreFiles)"
RuntimeStoreSymbolFiles="@(RuntimeStoreSymbolFiles)"
ManifestDestination="$(ArtifactsDir)aspnetcore-store-$(PackageVersion)-$(RuntimeStoreRID).xml"
StoreDestination="$(_StoreZipDirectory)store\"
SymbolsDestination="$(_SymbolsZipDirectory)"/>
<!-- Insert deps files -->
<Copy SourceFiles="@(DepsFiles)" DestinationFolder="$(_StoreZipDirectory)additionalDeps\%(RecursiveDir)" />
<ItemGroup>
<OutputZipFiles Include="$(_StoreZipDirectory)**\*" />
<OutputSymbolZipFiles Include="$(_SymbolsZipDirectory)**\*" />
</ItemGroup>
<!-- Create zips -->
<ZipArchive File="$(OutputZip)" SourceFiles="@(OutputZipFiles)" WorkingDirectory="$(_StoreZipDirectory)" Overwrite="true"/>
<ZipArchive File="$(OutputSymbolZip)" SourceFiles="@(OutputSymbolZipFiles)" WorkingDirectory="$(_SymbolsZipDirectory)" Overwrite="true" Condition="'@(OutputSymbolZipFiles)' != ''"/>
</Target>
<Target Name="CreateCommonManifest" DependsOnTargets="_PrepareRuntimeStoreBuildAssets">
<PropertyGroup>
<CommonManifestFileName>aspnetcore-store-$(PackageVersion)-common.xml</CommonManifestFileName>
</PropertyGroup>
<!-- Trim packages guaranteed to be in the runtime but isn't included in our runtime store -->
<ItemGroup>
<PackagesToTrim Include="runtime.win-arm64.runtime.native.system.data.sqlclient.sni" />
<ExistingStoreManifests Include="$(_ExistingManifestsDirectory)*.xml" />
</ItemGroup>
<MSBuild Projects="$(_WorkRoot)RS.Manifest\RS.Manifest.csproj"
Targets="Restore;GetPackageDefinitions"
Properties="$(_RsManifestProps)" >
<Output TaskParameter="TargetOutputs" ItemName="_PackageDefinitions" />
</MSBuild>
<RepoTasks.CreateCommonManifest DestinationFilePath="$(ArtifactsDir)$(CommonManifestFileName)" PackageDefinitions="@(_PackageDefinitions)" Packages="@(PackagesToTrim)"/>
<!-- Trim built manifest with existing manifests -->
<RepoTasks.ComposeNewStore
ExistingManifests="@(ExistingStoreManifests)"
NewManifests="$(ArtifactsDir)$(CommonManifestFileName)"
ManifestDestination="$(ArtifactsDir)$(CommonManifestFileName)"/>
</Target>
</Project>
|