Skip to content

Commit

Permalink
Remove redundant depends on targets
Browse files Browse the repository at this point in the history
  • Loading branch information
gitfool authored and kzu committed May 30, 2024
1 parent a4baece commit 8c8cbed
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 47 deletions.
19 changes: 2 additions & 17 deletions src/GitInfo/build/GitInfo.AssemblyInfo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,10 @@

<!-- Private properties -->
<PropertyGroup>
<CoreCompileDependsOn>
GitInfo;
GitVersion;
GitThisAssembly;
GitInfoReport;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>
<CoreCompileDependsOn Condition="'$(GitThisAssembly)' == 'true'">GitThisAssembly;$(CoreCompileDependsOn)</CoreCompileDependsOn>
</PropertyGroup>

<PropertyGroup>
<GitThisAssemblyDependsOn>
GitInfo;
GitVersion;
_GitInputs;
_GitGenerateThisAssembly
</GitThisAssemblyDependsOn>
</PropertyGroup>

<Target Name="GitThisAssembly" DependsOnTargets="$(GitThisAssemblyDependsOn)"
<Target Name="GitThisAssembly" DependsOnTargets="GitVersion;_GitGenerateThisAssembly"
BeforeTargets="BuildOnlySettings" Condition="'$(GitThisAssembly)' == 'true'">

<ItemGroup Condition="'$(Language)' != 'F#'">
Expand Down
4 changes: 2 additions & 2 deletions src/GitInfo/build/GitInfo.AssemblyMetadata.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
for Git information.
$(GitThisAssemblyMetadata): set to 'false' to prevent assembly
metadata generation. Defaults to 'false'.
metadata generation. Defaults to 'false'.
==============================================================
-->

<Target Name="GitAssemblyMetadata" DependsOnTargets="GitInfo;GitVersion" BeforeTargets="BuildOnlySettings">
<Target Name="GitAssemblyMetadata" DependsOnTargets="GitVersion" BeforeTargets="BuildOnlySettings">

<ItemGroup Condition="'$(Language)' != 'VB'">
<AssemblyMetadata Include="GitInfo.IsDirty"
Expand Down
25 changes: 6 additions & 19 deletions src/GitInfo/build/GitInfo.ThisAssembly.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,29 @@

<!-- Private properties -->
<PropertyGroup>
<CoreCompileDependsOn>
GitInfo;
GitVersion;
GitThisAssembly;
GitInfoReport;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>
</PropertyGroup>

<PropertyGroup>
<GitThisAssemblyDependsOn>
GitInfo;
GitVersion;
</GitThisAssemblyDependsOn>
<CoreCompileDependsOn Condition="'$(GitThisAssembly)' == 'true'">GitThisAssembly;$(CoreCompileDependsOn)</CoreCompileDependsOn>
</PropertyGroup>

<ItemGroup>
<CompilerVisibleProperty Include="GitIsDirty" />
<CompilerVisibleProperty Include="GitThisAssembly" />
</ItemGroup>

<Target Name="GitThisAssembly" DependsOnTargets="$(GitThisAssemblyDependsOn)"
<Target Name="GitThisAssembly" DependsOnTargets="GitVersion"
BeforeTargets="PrepareConstants;GenerateMSBuildEditorConfigFileShouldRun" Condition="'$(GitThisAssembly)' == 'true'">

<ItemGroup>
<Constant Include="IsDirtyString" Value="true" Root="Git" Condition="$(GitIsDirty) == '1'" />
<Constant Include="IsDirtyString" Value="false" Root="Git" Condition="$(GitIsDirty) == '0'" />

<Constant Include="RepositoryUrl" Value="$(GitRepositoryUrl)" Root="Git" />

<Constant Include="Branch" Value="$(GitBranch)" Root="Git" />
<Constant Include="Commit" Value="$(GitCommit)" Root="Git" />
<Constant Include="Sha" Value="$(GitSha)" Root="Git" />
<Constant Include="CommitDate" Value="$(GitCommitDate)" Root="Git" />
<Constant Include="Commits" Value="$(GitCommits)" Root="Git" />

<Constant Include="Tag" Value="$(GitTag)" Root="Git" />
<Constant Include="BaseTag" Value="$(GitBaseTag)" Root="Git" />
<Constant Include="BaseVersion.Major" Value="$(GitBaseVersionMajor)" Root="Git" />
Expand All @@ -64,8 +51,8 @@
<Constant Include="SemVer.Label" Value="$(GitSemVerLabel)" Root="Git" />
<Constant Include="SemVer.DashLabel" Value="$(GitSemVerDashLabel)" Root="Git" />
<Constant Include="SemVer.Source" Value="$(GitSemVerSource)" Root="Git" />
</ItemGroup>
</ItemGroup>

</Target>

</Project>
11 changes: 2 additions & 9 deletions src/GitInfo/build/GitInfo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,9 @@
<GitCommitDateFormat Condition="'$(GitCommitDateFormat)' == '' And '$(OS)' != 'Windows_NT'">%cI</GitCommitDateFormat>
</PropertyGroup>


<!-- Private properties -->
<PropertyGroup>
<CoreCompileDependsOn>
GitInfo;
GitVersion;
GitThisAssembly;
GitInfoReport;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>
<CoreCompileDependsOn>GitVersion;GitInfoReport;$(CoreCompileDependsOn)</CoreCompileDependsOn>

<!-- Cache file used to avoid running all git commands. Only GitRoot will be retrieved to determine the path of this cache file. -->
<_GitInfoFile>$(GitCachePath)GitInfo.cache</_GitInfoFile>
Expand All @@ -157,7 +150,7 @@
<_GitHeadFile>$(GitCachePath)GitHead.cache</_GitHeadFile>
</PropertyGroup>

<Target Name="GitInfoReport" DependsOnTargets="GitInfo;GitVersion">
<Target Name="GitInfoReport" DependsOnTargets="GitVersion">
<Message Importance="$(GitInfoReportImportance)" Text="Git Info:
GitInfoBaseDir: $(GitInfoBaseDir)
GitRoot: $(GitRoot)
Expand Down

0 comments on commit 8c8cbed

Please sign in to comment.