Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PackageArchive.targets « build - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ecf9c09784069a3f837b1b60b098129cfc6910bf (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
<Project>
  <PropertyGroup>
    <_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
    <_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
    <PreviousArchivePropsFile>$(MSBuildThisFileDirectory)PreviousArchiveManifest.props</PreviousArchivePropsFile>
    <MetapackageRestoreSource>$(RepositoryRoot).deps\Signed\Packages\</MetapackageRestoreSource>
    <LzmaOutputPackageName>nuGetPackagesArchive-$(PackageVersion)</LzmaOutputPackageName>
    <FallbackStagingDir>$(_WorkRoot)obj\$(LzmaOutputPackageName)\</FallbackStagingDir>
    <FallbackOutputDir>$(ArtifactsDir)lzma\</FallbackOutputDir>
    <FallbackOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName).lzma</FallbackOutputPath>
    <FallbackAntaresZipOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName)-antares.zip</FallbackAntaresZipOutputPath>
    <GeneratedFallbackRestoreSourcesPropsPath>$(_WorkRoot)restoresources.$(LzmaOutputPackageName).props</GeneratedFallbackRestoreSourcesPropsPath>
  </PropertyGroup>

  <Import Project="$(PreviousArchivePropsFile)" Condition="Exists($(PreviousArchivePropsFile))" />

  <Target Name="BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo">
    <!-- Clear the directories -->
    <RemoveDir Directories="$(_WorkRoot)" />

    <!-- Copy the archive template -->
    <Copy SourceFiles="$(_TemplatesDirectory)Archive\Archive.csproj" DestinationFiles="$(_WorkRoot)Archive.csproj" />

    <!-- Copy the archive template -->
    <RepoTasks.AddArchiveReferences
      ReferencePackagePath="$(_WorkRoot)Archive.csproj"
      BuildArtifacts="@(ArtifactInfo)"
      PackageArtifacts="@(PackageArtifact)"
      ExternalDependencies="@(ExternalDependency)"
      MetapackageVersion="$(LZMAMicrosoftAspNetCoreAppAll21PackageVersion)" />

    <ItemGroup>
      <_FallbackArchiveRestoreSources Include="$(RestoreSources)" />
      <_FallbackArchiveRestoreSources Include="$(BuildDir)" Condition="Exists($(BuildDir))" />
      <_FallbackArchiveRestoreSources Include="$(MetapackageRestoreSource)" Condition="Exists($(MetapackageRestoreSource))" />
    </ItemGroup>

    <RepoTasks.GenerateRestoreSourcesPropsFile
      Sources="@(_FallbackArchiveRestoreSources)"
      OutputPath="$(GeneratedFallbackRestoreSourcesPropsPath)" />

    <!-- Create the Staging Dir -->
    <MakeDir Directories="$(FallbackStagingDir);$(FallbackOutputDir)" />

    <!-- Restore the target project -->
    <MSBuild
      ContinueOnError="true"
      Projects="$(_WorkRoot)Archive.csproj"
      Targets="Restore"
      Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />

    <!-- Retry if restore failed -->
    <PropertyGroup>
      <RestorePassed>$(MSBuildLastTaskResult)</RestorePassed>
    </PropertyGroup>
    <Warning Text="Restore failed, retry #1." Condition="'$(RestorePassed)' == 'false'"/>
    <MSBuild
      ContinueOnError="true"
      Condition="'$(RestorePassed)' == 'false'"
      Projects="$(_WorkRoot)Archive.csproj"
      Targets="Restore"
      Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />

    <!-- Retry if restore failed -->
    <PropertyGroup>
      <RestorePassed>$(MSBuildLastTaskResult)</RestorePassed>
    </PropertyGroup>
    <Warning Text="Restore failed, retry #2." Condition="'$(RestorePassed)' == 'false'"/>
    <MSBuild
      ContinueOnError="true"
      Condition="'$(RestorePassed)' == 'false'"
      Projects="$(_WorkRoot)Archive.csproj"
      Targets="Restore"
      Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />

    <!-- Retry if restore failed -->
    <PropertyGroup>
      <RestorePassed>$(MSBuildLastTaskResult)</RestorePassed>
    </PropertyGroup>
    <Warning Text="Restore failed, retry #3." Condition="'$(RestorePassed)' == 'false'"/>
    <MSBuild
      ContinueOnError="true"
      Condition="'$(RestorePassed)' == 'false'"
      Projects="$(_WorkRoot)Archive.csproj"
      Targets="Restore"
      Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />

    <!-- Retry if restore failed -->
    <PropertyGroup>
      <RestorePassed>$(MSBuildLastTaskResult)</RestorePassed>
    </PropertyGroup>
    <Warning Text="Restore failed, retry #4." Condition="'$(RestorePassed)' == 'false'"/>
    <MSBuild
      Condition="'$(RestorePassed)' == 'false'"
      Projects="$(_WorkRoot)Archive.csproj"
      Targets="Restore"
      Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />

    <!-- Create the archive -->
    <RepoTasks.CreateLzma OutputPath="$(FallbackOutputPath)" Sources="$(FallbackStagingDir)" />
  </Target>

  <Target Name="UpdatePreviousArchiveManifest">
    <Error Text="Please only specify one of PreviousLzmaUrl or PreviousLzmaFile but not both" Condition="'$(PreviousLzmaUrl)' != '' AND '$(PreviousLzmaFile)' != ''" />

    <PropertyGroup>
      <PreviousLzmaLayout>$(_WorkRoot)previous\</PreviousLzmaLayout>
      <PreviousLzmaFile Condition="'$(PreviousLzmaFile)' == ''">$(RepositoryRoot).deps\nuGetPackagesArchive.previous.lzma</PreviousLzmaFile>
    </PropertyGroup>

    <!-- Clear the directories -->
    <RemoveDir Directories="$(PreviousLzmaLayout)" />

    <!-- Download and extract the previous LZMA if specified -->
    <KoreBuild.Tasks.DownloadFile
      Uri="$(PreviousLzmaUrl)"
      DestinationPath="$(PreviousLzmaFile)"
      Condition="'$(PreviousLzmaUrl)' != ''" />
    <RepoTasks.ExtractLzma
      InputArchive="$(PreviousLzmaFile)"
      OutputPath="$(PreviousLzmaLayout)"
      Condition="Exists($(PreviousLzmaFile))" />

    <ItemGroup>
      <PreviousLzmaContents Remove="@(PreviousLzmaContents)" />
      <PreviousLzmaContents Include="$(PreviousLzmaLayout)**\*.*" />
    </ItemGroup>

    <!-- Create the archive -->
    <RepoTasks.UpdatePreviousArchiveManifest OutputPath="$(PreviousArchivePropsFile)" Contents="@(PreviousLzmaContents)" />
  </Target>

  <Target Name="BuildAntaresFallbackZip">
    <Error Text="Please only specify one of InputLzmaUrl or InputLzmaFile but not both" Condition="'$(InputLzmaUrl)' != '' AND '$(InputLzmaFile)' != ''" />

    <PropertyGroup>
      <InputLzmaLayout>$(_WorkRoot)input\</InputLzmaLayout>
      <InputLzmaFile Condition="'$(InputLzmaFile)' == ''">$(RepositoryRoot).deps\nuGetPackagesArchive.input.lzma</InputLzmaFile>
    </PropertyGroup>

    <!-- Clear the directories -->
    <RemoveDir Directories="$(InputLzmaLayout)" />

    <!-- Download and extract the input LZMA if specified -->
    <KoreBuild.Tasks.DownloadFile
      Uri="$(InputLzmaUrl)"
      DestinationPath="$(InputLzmaFile)"
      Condition="'$(InputLzmaUrl)' != ''" />
    <RepoTasks.ExtractLzma
      InputArchive="$(InputLzmaFile)"
      OutputPath="$(InputLzmaLayout)"
      Condition="Exists($(InputLzmaFile))" />

    <ItemGroup>
      <InputLzmaContents Include="$(InputLzmaLayout)**\*.*"  Exclude="$(InputLzmaLayout)**\*.nupkg" />
    </ItemGroup>

    <Error Text="No lzma content found. Please specify a lzma via InputLzmaUrl or InputLzmaFile or run the BuildFallbackArchive target." Condition="'@(InputLzmaContents)' == ''" />

    <!-- Filter lzma content to remove existing content and .xml files -->
    <RepoTasks.FilterLzmaContent PreviousLzmaContent="@(PreviousLzmaContents)" InputLzmaContent="@(InputLzmaContents)">
      <Output TaskParameter="FilteredLzmaContent" ItemName="AntaresLzmaContents" />
    </RepoTasks.FilterLzmaContent>

    <!-- Create antares zip -->
    <ZipArchive
      File="$(FallbackAntaresZipOutputPath)"
      SourceFiles="@(AntaresLzmaContents)"
      WorkingDirectory="$(InputLzmaLayout)"
      Overwrite="true"
      Condition="'@(AntaresLzmaContents)' != ''"/>
  </Target>
</Project>