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: b938f1393871506439c2f358388559fc7adac8fa (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
<Project>
  <PropertyGroup>
    <_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
    <_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
    <TimestampSource>$(RepositoryRoot).deps\Signed\Packages\</TimestampSource>
    <TimestampFreeSource>$(RepositoryRoot).deps\Signed\Packages-NoTimeStamp\</TimestampFreeSource>
    <TimestampOutputPackageName>nuGetPackagesArchive.timestamped</TimestampOutputPackageName>
    <TimestampFreeOutputPackageName>nuGetPackagesArchive.notimestamp</TimestampFreeOutputPackageName>
  </PropertyGroup>

  <Target Name="BuildFallbackArchive">
    <!-- Run the actual target twice, once for timestamped packages, once for non-timestamped packages -->
    <!-- Here, we're re-invoking KoreBuild, but limiting it to a specific target. -->
    <!-- This won't rerun the whole build, but it ensures that the necessary MSBuild Tasks and Properties are initialized -->
    <MSBuild
      Projects="$(MSBuildProjectFullPath)"
      Targets="_BuildFallbackArchive"
      Properties="MetapackageRestoreSource=$(TimestampSource);OutputPackageName=$(TimestampOutputPackageName);RemoveTimestamp=false;MetapackageVersion=$(PackageVersion)" />
    <MSBuild
      Projects="$(MSBuildProjectFullPath)"
      Targets="_BuildFallbackArchive"
      Properties="MetapackageRestoreSource=$(TimestampFreeSource);OutputPackageName=$(TimestampFreeOutputPackageName);RemoveTimestamp=true;MetapackageVersion=$(PackageVersionNoTimestamp)" />
  </Target>

  <Target Name="_BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo">
    <Error Text="MetapackageRestoreSource must be specified" Condition=" '$(MetapackageRestoreSource)' == '' " />
    <Error Text="OutputPackageName must be specified" Condition=" '$(OutputPackageName)' == '' " />
    <Error Text="ArchiverPath must be specified" Condition=" '$(ArchiverPath)' == '' " />
    <Error Text="Archiver not found at $(ArchiverPath)" Condition="!Exists('$(ArchiverPath)')" />

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

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

    <!-- Add .All metapacakge to PackageArtifact for LZMA generation -->
    <ItemGroup>
      <PackageArtifact Include="Microsoft.AspNetCore.All" LZMA="true" />
    </ItemGroup>

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

    <PropertyGroup>
      <FallbackStagingDir>$(_WorkRoot)obj\$(OutputPackageName)</FallbackStagingDir>
      <FallbackOutputDir>$(ArtifactsDir)lzma\</FallbackOutputDir>
      <FallbackOutputPath>$(FallbackOutputDir)$(OutputPackageName).lzma</FallbackOutputPath>
      <GeneratedFallbackRestoreSourcesPropsPath>$(_WorkRoot)restoresources.$(OutputPackageName).props</GeneratedFallbackRestoreSourcesPropsPath>
    </PropertyGroup>

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

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

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

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

    <!-- Create the archive -->
    <Exec Command="$(ArchiverPath) -a $(FallbackOutputPath) $(FallbackStagingDir)" />
  </Target>
</Project>