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

Templating.targets « build - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d7592be9166d597706c14f055a36803daa69083c (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
<Project>
  <PropertyGroup>
    <TemplatingProjectRoot>$(MSBuildThisFileDirectory)..\modules\Templating\</TemplatingProjectRoot>
  </PropertyGroup>

  <Target Name="BuildTemplates" DependsOnTargets="GeneratePropsFiles">
    <PropertyGroup>
      <GeneratedNoTimestampPackageVersionPropsPath>$(IntermediateDir)dependencies.notimestamp.props</GeneratedNoTimestampPackageVersionPropsPath>
      <TemplateProjCommmonProperties>
        RepositoryRoot=$(TemplatingProjectRoot);
        DotNetRestoreSourcesPropsPath=$(GeneratedRestoreSourcesPropsPath);
        BuildNumber=$(BuildNumber);
        Configuration=$(Configuration);
      </TemplateProjCommmonProperties>
      <TemplateProjProperties>
        $(TemplateProjCommmonProperties);
        DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
        VersionMetadata=timestamped;
      </TemplateProjProperties>
      <TemplateProjNoTimestampProperties>
        $(TemplateProjCommmonProperties);
        DotNetPackageVersionPropsPath=$(GeneratedNoTimestampPackageVersionPropsPath);
        IsFinalBuild=true;
      </TemplateProjNoTimestampProperties>
    </PropertyGroup>

    <!-- Produce regular, timestamped templates for pre-release builds -->
    <MSBuild Projects="$(MSBuildProjectFullPath)"
             Targets="Restore;Compile;Package"
             Properties="$(TemplateProjProperties)" />

    <ItemGroup>
      <TemplateArtifacts Include="$(TemplatingProjectRoot)artifacts\build\*" />
    </ItemGroup>

    <Copy SourceFiles="@(TemplateArtifacts)" DestinationFolder="$(BuildDir)" />

    <!-- Gather artifact info as if this were a final build -->
    <MSBuild Projects="$(MSBuildProjectFullPath)"
             Targets="GetArtifactInfo"
             Properties="RepositoryRoot=%(Repository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber);IsFinalBuild=true"
             ContinueOnError="WarnAndContinue">
      <Output TaskParameter="TargetOutputs" ItemName="FinalBuildArtifactInfo" />
    </MSBuild>

    <ItemGroup>
      <_NoTimestampPackages Include="@(ExternalDependency)" />
      <_NoTimestampPackages Include="%(FinalBuildArtifactInfo.PackageId)" Version="%(FinalBuildArtifactInfo.Version)" Condition=" '%(FinalBuildArtifactInfo.ArtifactType)' == 'NuGetPackage' " />
      <_NoTimestampPackages Include="Microsoft.AspNetCore.All" Version="$(PackageVersionNoTimestamp)" />
    </ItemGroup>

    <RepoTasks.GeneratePackageVersionPropsFile
      Packages="@(_NoTimestampPackages)"
      OutputPath="$(GeneratedNoTimestampPackageVersionPropsPath)" />

    <!-- Rebuild the templates without restoring. (The non-timestamped packages don't exist yet.) -->
    <MSBuild Projects="$(MSBuildProjectFullPath)"
             Targets="Prepare;Compile;Package"
             Properties="$(TemplateProjNoTimestampProperties);NoRestore=true" />

    <ItemGroup>
      <TemplateNoTimestampArtifacts Include="$(TemplatingProjectRoot)artifacts\build\*" />
    </ItemGroup>

    <Copy SourceFiles="@(TemplateNoTimestampArtifacts)" DestinationFolder="$(ArtifactsDir)notimestamp\" />
  </Target>

</Project>