4848
4949 <Target Name =" PackIfChanged" >
5050 <ItemGroup >
51- <_Temporary Remove =" @_Temporary)" />
51+ <_Temporary Remove =" @( _Temporary)" />
5252 <_Temporary Include =" $(git_commit_ids)" />
5353 </ItemGroup >
54+ <ItemGroup >
55+ <GitProjectDirectory Include =" $(MSBuildProjectDirectory)" />
56+ <GitProjectDirectory Include =" @(ProjectReference->DirectoryName())" />
57+ </ItemGroup >
58+ <Message Importance =" high" Text =" Project: $(MSBuildProjectName)" />
5459 <Message Importance =" high" Text =" Git Commit IDs: %(_Temporary.Identity)" />
55- <Message Importance =" high" Text =" GitProjectDirectory: $(GitProjectDirectory)" />
56- < Message Importance = " high " Text = " GitTestProjectDirectory: $(GitTestProjectDirectory) " Condition = " '$(GitTestProjectDirectory)'!='' " />
60+ <Message Importance =" high" Text =" GitProjectDirectory: $([MSBuild]::MakeRelative($(SolutionDir),'%( GitProjectDirectory.Identity)') )" />
61+
5762 <PropertyGroup >
5863 <_GitCommand >git log --pretty=tformat:"%%H" -n1 .</_GitCommand >
5964 </PropertyGroup >
60- <Exec Command =" $(_GitCommand)" WorkingDirectory =" $(GitProjectDirectory)" ConsoleToMSBuild =" true" Condition =" '$(ProjectCommitID)'==''" >
61- <Output TaskParameter =" ConsoleOutput" PropertyName =" ProjectCommitID" />
62- </Exec >
63- <Exec Command =" $(_GitCommand)" WorkingDirectory =" $(GitTestProjectDirectory)" ConsoleToMSBuild =" true" Condition =" '$(TestProjectCommitID)'=='' AND '$(GitTestProjectDirectory)'!=''" >
64- <Output TaskParameter =" ConsoleOutput" PropertyName =" TestProjectCommitID" />
65+ <Exec Command =" $(_GitCommand)" WorkingDirectory =" %(GitProjectDirectory.Identity)" ConsoleToMSBuild =" true" >
66+ <Output TaskParameter =" ConsoleOutput" ItemName =" ProjectCommitID" />
6567 </Exec >
66- <Message Importance =" high" Text =" ProjectCommitID: $(ProjectCommitID)" />
67- <Message Importance =" high" Text =" TestProjectCommitID: $(TestProjectCommitID)" Condition =" '$(TestProjectCommitID)'!=''" />
68+ <ItemGroup >
69+ <ProjectCommitID Condition =" '%(Identity)' != '' AND
70+ '@(ProjectCommitID)' != '' AND
71+ '@(_Temporary)' != ''" >
72+ <CommitIDFound >true</CommitIDFound >
73+ </ProjectCommitID >
74+ </ItemGroup >
75+ <Message Importance =" high" Text =" ProjectCommitID: %(ProjectCommitID.Identity) %(ProjectCommitID.CommitIDFound)" />
76+
6877 <Message Importance =" high" Text =" IsPackable: $(IsPackable)" />
6978 <Message Importance =" high" Text =" IsTestProject: $(IsTestProject)" />
79+
7080 <PropertyGroup >
71- <CommitIDFound Condition =" '$(ProjectCommitID)'=='%(_Temporary.Identity)'" >true</CommitIDFound >
72- <CommitIDFound Condition =" '$(TestProjectCommitID)'!='' AND '$(TestProjectCommitID)'=='%(_Temporary.Identity)'" >true</CommitIDFound >
73- <CommitIDFound Condition =" '$(ProjectToBuild)'=='$(MSBuildProjectName)'" >true</CommitIDFound >
81+ <CommitIDFound Condition =" '%(ProjectCommitID.CommitIDFound)'=='true'" >true</CommitIDFound >
7482 <CommitIDFound Condition =" '$(CommitIDFound)'==''" >false</CommitIDFound >
7583 </PropertyGroup >
84+ <Message Importance =" high" Text =" CommitIDFound: $(CommitIDFound)" />
7685 <ItemGroup >
77- <_Temporary Remove =" @_Temporary)" />
86+ <_Temporary Remove =" @(_Temporary)" />
87+ <_Temporary Include =" $(ProjectToBuild)" />
88+ </ItemGroup >
89+ <Message Importance =" high" Text =" Projects To Build: %(_Temporary.Identity)" />
90+ <PropertyGroup >
91+ <BuildProject >$(CommitIDFound)</BuildProject >
92+ <BuildProject Condition =" '$(MSBuildProjectName)'=='%(_Temporary.Identity)'" >true</BuildProject >
93+ </PropertyGroup >
94+ <Message Importance =" high" Text =" BuildProject: $(BuildProject)" />
95+
96+ <ItemGroup >
97+ <_Temporary Remove =" @(_Temporary)" />
7898 </ItemGroup >
79- <Message Importance =" high" Text =" CommitIDFound: $(CommitIDFound)" />
8099
81100 <!-- Pack libraries -->
82- <MSBuild Projects =" $(MSBuildProjectFile)" Targets =" Pack" Condition =" '$(IsPackable)'=='true' AND '$(CommitIDFound )'=='true'" />
101+ <MSBuild Projects =" $(MSBuildProjectFile)" Targets =" Pack" Condition =" '$(IsPackable)'=='true' AND '$(BuildProject )'=='true'" />
83102 <!-- Build sample and test projects to ensure they can build correctly -->
84- <MSBuild Projects =" $(MSBuildProjectFile)" Targets =" Build" Condition =" '$(IsPackable)'=='false' AND '$(CommitIDFound )'=='true'" />
103+ <MSBuild Projects =" $(MSBuildProjectFile)" Targets =" Build" Condition =" '$(IsPackable)'=='false' AND '$(BuildProject )'=='true'" />
85104 <!-- Rebuild test projects with project references for code coverage -->
86- <MSBuild Projects =" $(MSBuildProjectFile)" Targets =" Build" Condition =" '$(IsTestProject)'=='true' AND '$(CommitIDFound )'=='true'" />
87- <Message Importance =" high" Text =" ##vso[build.addbuildtag]$(MSBuildProjectName)" Condition =" '$(IsPackable)'=='true' AND '$(CommitIDFound )'=='true'" />
105+ <MSBuild Projects =" $(MSBuildProjectFile)" Targets =" Build" Condition =" '$(IsTestProject)'=='true' AND '$(BuildProject )'=='true'" />
106+ <Message Importance =" high" Text =" ##vso[build.addbuildtag]$(MSBuildProjectName)" Condition =" '$(IsPackable)'=='true' AND '$(BuildProject )'=='true'" />
88107 </Target >
89108</Project >
0 commit comments