Skip to content
This repository was archived by the owner on Oct 18, 2018. It is now read-only.

Commit bf03fee

Browse files
author
Nate McMaster
committed
Refactor LZMA generation to support Docker and Antares usage
List explicitly as .csproj files the scenarios for which the offline package cache is important Produces new artifacts designed for various scenarios, such as: * Docker (where xml doc files are not needed) * Azure web apps (where 1.x SDKs must still be supported, but xml docs are not needed)
1 parent b68b185 commit bf03fee

35 files changed

+13232
-10576
lines changed

Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
<Import Project="build\common.props" />
44
<Import Project="build\external-dependencies.props" />
55
<Import Project="build\sources.props" />
6+
7+
<PropertyGroup>
8+
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
9+
</PropertyGroup>
610
</Project>

build/PackageArchive.targets

Lines changed: 20 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,31 @@
11
<Project>
2-
<PropertyGroup>
3-
<_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
4-
<_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
5-
<PreviousArchivePropsFile>$(MSBuildThisFileDirectory)PreviousArchiveManifest.props</PreviousArchivePropsFile>
6-
<MetapackageRestoreSource>$(RepositoryRoot).deps\Signed\Packages\</MetapackageRestoreSource>
7-
<LzmaOutputPackageName>nuGetPackagesArchive-$(PackageVersion)</LzmaOutputPackageName>
8-
<FallbackStagingDir>$(_WorkRoot)obj\$(LzmaOutputPackageName)\</FallbackStagingDir>
9-
<FallbackOutputDir>$(ArtifactsDir)lzma\</FallbackOutputDir>
10-
<FallbackOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName).lzma</FallbackOutputPath>
11-
<FallbackAntaresZipOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName)-antares.zip</FallbackAntaresZipOutputPath>
12-
<GeneratedFallbackRestoreSourcesPropsPath>$(_WorkRoot)restoresources.$(LzmaOutputPackageName).props</GeneratedFallbackRestoreSourcesPropsPath>
13-
</PropertyGroup>
14-
15-
<Import Project="$(PreviousArchivePropsFile)" Condition="Exists($(PreviousArchivePropsFile))" />
16-
17-
<Target Name="BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo">
18-
<!-- Clear the directories -->
19-
<RemoveDir Directories="$(_WorkRoot)" />
20-
21-
<!-- Copy the archive template -->
22-
<Copy SourceFiles="$(_TemplatesDirectory)Archive\Archive.csproj" DestinationFiles="$(_WorkRoot)Archive.csproj" />
23-
24-
<!-- Copy the archive template -->
25-
<RepoTasks.AddArchiveReferences
26-
ReferencePackagePath="$(_WorkRoot)Archive.csproj"
27-
BuildArtifacts="@(ArtifactInfo)"
28-
PackageArtifacts="@(PackageArtifact)"
29-
ExternalDependencies="@(ExternalDependency)"
30-
MetapackageVersion="$(LZMAMicrosoftAspNetCoreAppAll21PackageVersion)" />
2+
<Target Name="BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo;GeneratePropsFiles">
313

324
<ItemGroup>
33-
<_FallbackArchiveRestoreSources Include="$(RestoreSources)" />
34-
<_FallbackArchiveRestoreSources Include="$(BuildDir)" Condition="Exists($(BuildDir))" />
35-
<_FallbackArchiveRestoreSources Include="$(MetapackageRestoreSource)" Condition="Exists($(MetapackageRestoreSource))" />
5+
<ArchiveProjects Include="$(RepositoryRoot)src\PackageArchive\Archive.*\*.*proj" />
366
</ItemGroup>
377

38-
<RepoTasks.GenerateRestoreSourcesPropsFile
39-
Sources="@(_FallbackArchiveRestoreSources)"
40-
OutputPath="$(GeneratedFallbackRestoreSourcesPropsPath)" />
41-
42-
<!-- Create the Staging Dir -->
43-
<MakeDir Directories="$(FallbackStagingDir);$(FallbackOutputDir)" />
44-
45-
<!-- Restore the target project -->
46-
<MSBuild
47-
Projects="$(_WorkRoot)Archive.csproj"
48-
Targets="Restore"
49-
Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />
50-
51-
<!-- Restore the netstandard2.0 project -->
52-
<MSBuild
53-
Projects="$(MSBuildThisFileDirectory)tools\templates\Archive\Archive.Library.csproj"
54-
Targets="Restore"
55-
Properties="RestorePackagesPath=$(FallbackStagingDir);NETStandardLibraryPackageVersion=$(NETStandardLibrary20PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />
56-
57-
<!-- Create the archive -->
58-
<RepoTasks.CreateLzma OutputPath="$(FallbackOutputPath)" Sources="$(FallbackStagingDir)" />
59-
</Target>
60-
61-
<Target Name="UpdatePreviousArchiveManifest">
62-
<Error Text="Please only specify one of PreviousLzmaUrl or PreviousLzmaFile but not both" Condition="'$(PreviousLzmaUrl)' != '' AND '$(PreviousLzmaFile)' != ''" />
63-
648
<PropertyGroup>
65-
<PreviousLzmaLayout>$(_WorkRoot)previous\</PreviousLzmaLayout>
66-
<PreviousLzmaFile Condition="'$(PreviousLzmaFile)' == ''">$(RepositoryRoot).deps\nuGetPackagesArchive.previous.lzma</PreviousLzmaFile>
9+
<ArchiveBuildProps>
10+
DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);
11+
DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
12+
OutputPath=$(ArtifactsDir)lzma\;
13+
_BuildToolsAssembly=$(_BuildToolsAssembly)
14+
</ArchiveBuildProps>
6715
</PropertyGroup>
6816

69-
<!-- Clear the directories -->
70-
<RemoveDir Directories="$(PreviousLzmaLayout)" />
71-
72-
<!-- Download and extract the previous LZMA if specified -->
73-
<KoreBuild.Tasks.DownloadFile
74-
Uri="$(PreviousLzmaUrl)"
75-
DestinationPath="$(PreviousLzmaFile)"
76-
Condition="'$(PreviousLzmaUrl)' != ''" />
77-
<RepoTasks.ExtractLzma
78-
InputArchive="$(PreviousLzmaFile)"
79-
OutputPath="$(PreviousLzmaLayout)"
80-
Condition="Exists($(PreviousLzmaFile))" />
17+
<Error Text="Could not find any package archive projects to build"
18+
Condition=" @(ArchiveProjects->Count()) == 0 " />
8119

82-
<ItemGroup>
83-
<PreviousLzmaContents Remove="@(PreviousLzmaContents)" />
84-
<PreviousLzmaContents Include="$(PreviousLzmaLayout)**\*.*" />
85-
</ItemGroup>
86-
87-
<!-- Create the archive -->
88-
<RepoTasks.UpdatePreviousArchiveManifest OutputPath="$(PreviousArchivePropsFile)" Contents="@(PreviousLzmaContents)" />
89-
</Target>
90-
91-
<Target Name="BuildAntaresFallbackZip">
92-
<Error Text="Please only specify one of InputLzmaUrl or InputLzmaFile but not both" Condition="'$(InputLzmaUrl)' != '' AND '$(InputLzmaFile)' != ''" />
93-
94-
<PropertyGroup>
95-
<InputLzmaLayout>$(_WorkRoot)input\</InputLzmaLayout>
96-
<InputLzmaFile Condition="'$(InputLzmaFile)' == ''">$(RepositoryRoot).deps\nuGetPackagesArchive.input.lzma</InputLzmaFile>
97-
</PropertyGroup>
98-
99-
<!-- Clear the directories -->
100-
<RemoveDir Directories="$(InputLzmaLayout)" />
101-
102-
<!-- Download and extract the input LZMA if specified -->
103-
<KoreBuild.Tasks.DownloadFile
104-
Uri="$(InputLzmaUrl)"
105-
DestinationPath="$(InputLzmaFile)"
106-
Condition="'$(InputLzmaUrl)' != ''" />
107-
<RepoTasks.ExtractLzma
108-
InputArchive="$(InputLzmaFile)"
109-
OutputPath="$(InputLzmaLayout)"
110-
Condition="Exists($(InputLzmaFile))" />
111-
112-
<ItemGroup>
113-
<InputLzmaContents Include="$(InputLzmaLayout)**\*.*" Exclude="$(InputLzmaLayout)**\*.nupkg" />
114-
</ItemGroup>
115-
116-
<Error Text="No lzma content found. Please specify a lzma via InputLzmaUrl or InputLzmaFile or run the BuildFallbackArchive target." Condition="'@(InputLzmaContents)' == ''" />
117-
118-
<!-- Filter lzma content to remove existing content and .xml files -->
119-
<RepoTasks.FilterLzmaContent PreviousLzmaContent="@(PreviousLzmaContents)" InputLzmaContent="@(InputLzmaContents)">
120-
<Output TaskParameter="FilteredLzmaContent" ItemName="AntaresLzmaContents" />
121-
</RepoTasks.FilterLzmaContent>
122-
123-
<!-- Create antares zip -->
124-
<ZipArchive
125-
File="$(FallbackAntaresZipOutputPath)"
126-
SourceFiles="@(AntaresLzmaContents)"
127-
WorkingDirectory="$(InputLzmaLayout)"
128-
Overwrite="true"
129-
Condition="'@(AntaresLzmaContents)' != ''"/>
20+
<MSBuild Projects="@(ArchiveProjects)"
21+
Targets="Restore"
22+
BuildInParallel="true"
23+
Properties="$(ArchiveBuildProps);_Dummy=restore" />
24+
25+
<MSBuild Projects="@(ArchiveProjects)"
26+
Targets="Build"
27+
BuildInParallel="false"
28+
StopOnFirstFailure="true"
29+
Properties="$(ArchiveBuildProps)" />
13030
</Target>
13131
</Project>

0 commit comments

Comments
 (0)