forked from aspnet/Templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Templates.msbuild
67 lines (58 loc) · 4.02 KB
/
Templates.msbuild
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
<Project DefaultTargets="Verify" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)\Templates.Settings.targets" />
<Import Project="$(MSBuildThisFileDirectory)\tools\Build.tasks" />
<Import Project="$(MSBuildThisFileDirectory)\tools\Verify.tasks" />
<Target Name="Verify" DependsOnTargets="VerifyTemplates;UnitTest;GenerateDependencyList;PublishReferencePackages"/>
<Target Name="VerifyTemplates" DependsOnTargets="Build">
<ItemGroup>
<ProjectsToTest Include="test\VerifyTemplates.csproj"/>
</ItemGroup>
<MSBuild Projects="@(ProjectsToTest)" Targets="Verify" BuildInParallel="true" Properties="Configuration=$(Configuration);PackageSource=$(PackageSource)"/>
</Target>
<Target Name="RestoreTemplate">
<GetDotNetFolder Condition="'$(DotNetFolder)' == ''">
<Output PropertyName="DotNetFolder" TaskParameter="DotNetPath"/>
</GetDotNetFolder>
<Exec Command="$(DotNetFolder)dnu restore -f $(PackageSourceForRestore) --packages $(DNX_PACKAGES)" WorkingDirectory="$(TemplateFolder)"/>
</Target>
<Target Name="UnitTest">
<Exec Command="SET PackageSource=$(PackageSource)&test\runTests.cmd"/>
</Target>
<Target Name="GenerateSingleDependecyList" Inputs="@(TestTemplates)" Outputs="%(TestTemplates.Identity)\$(DependencyListFileName)" Condition="'$(IsOfficialBuild)' == 'true'">
<GetDotNetFolder Condition="'$(DotNetFolder)' == ''">
<Output PropertyName="DotNetFolder" TaskParameter="DotNetPath"/>
</GetDotNetFolder>
<Exec Command="$(DotNetFolder)dnu list --details %(TestTemplates.Identity) > %(TestTemplates.Identity)\$(DependencyListFileName)"/>
</Target>
<Target Name="GenerateDependencyList" DependsOnTargets="SetupPackageSource;GenerateSingleDependecyList" Condition="'$(IsOfficialBuild)' == 'true'">
<ItemGroup>
<DependencyLists Include="%(TestTemplates.Identity)\$(DependencyListFileName)" />
</ItemGroup>
<GetDependencyListForTemplates DependencyList="@(DependencyLists)" MergedDependencyList="$(MergedDependencyListPath)" CopyPackagesList="$(CopyPackagesListPath)" TemplatePackagesList="$(TemplatePackages)" PackageSourcePath="$(PackageSource)" WarnOnMissingPackage="$(WarnOnMissingPackage)" FailOnLowerVersion="$(FailOnLowerVersion)" ExternalReferencePackages="@(ExternalReferencePackage)"/>
<ItemGroup>
<LinesToWrite Include="$(PackageSource)"/>
<LinesToWrite Include="$(SetupDrop)"/>
<LinesToWrite Include="Template Version: $(TemplateBuildBranch):$(TemplateVersion)"/>
</ItemGroup>
<WriteLinesToFile File="$(CoherenceDropFile)" Lines="@(LinesToWrite)" Overwrite="True"/>
</Target>
<Target Name="PublishReferencePackages" Condition="'$(IsOfficialBuild)' == 'true'">
<GetDotNetPackageFolder Condition="'$(DNX_PACKAGES)' == ''">
<Output PropertyName="DNX_PACKAGES" TaskParameter="PackageFolderPath"/>
</GetDotNetPackageFolder>
<RemoveDir Directories="$(TemplatesBin)\ExternalPackages" Condition="Exists('$(TemplatesBin)\ExternalPackages')"/>
<MakeDir Directories="$(TemplatesBin)\ExternalPackages"/>
<GetResolvedExternalPackageInfo CopyPackagesList="$(CopyPackagesListPath)">
<Output TaskParameter="PackageInfo" ItemName="ExternalReferencePackageInfo"/>
</GetResolvedExternalPackageInfo>
<Copy SourceFiles="$(DNX_PACKAGES)\%(ExternalReferencePackageInfo.Identity)\%(ExternalReferencePackageInfo.Version)\%(ExternalReferencePackageInfo.Identity).%(ExternalReferencePackageInfo.Version).nupkg" DestinationFolder="$(TemplatesBin)\ExternalPackages"/>
</Target>
<Target Name="Build" DependsOnTargets="SetupPackageSource">
<ItemGroup>
<ProjectsToBuild Include="dirs.proj"/>
</ItemGroup>
<Message Text="Coherence Build = '$(CoherenceBuildNumber)'" Condition="'$(CoherenceBuildNumber)' != ''"/>
<MakeDir Directories="$(TemplatesBin)"/>
<MSBuild Projects="@(ProjectsToBuild)" Targets="Build" BuildInParallel="true" Properties="Configuration=$(Configuration);PackageSource=$(PackageSource)"/>
</Target>
</Project>