Skip to content

Commit

Permalink
Initialize repo properties from source control early
Browse files Browse the repository at this point in the history
Run our property inits whenever the InitializeSourceControlInformation target runs, which will typically be before assembly info/version generation is run, which is early enough for most usages.

Fixes #45
  • Loading branch information
kzu committed Dec 18, 2020
1 parent d790307 commit d0f9740
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/NuGetizer.Tasks/NuGetizer.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,16 @@ Copyright (c) .NET Foundation. All rights reserved.
</ItemGroup>
</Target>

<Target Name="_InitializeRepositoryProperties" DependsOnTargets="InitializeSourceControlInformation" Condition="'$(SourceControlInformationFeatureSupported)' == 'true'">
<Target Name="_InitializeRepositoryProperties"
AfterTargets="InitializeSourceControlInformation"
DependsOnTargets="InitializeSourceControlInformation"
Condition="'$(SourceControlInformationFeatureSupported)' == 'true'">
<PropertyGroup>
<!-- The project must specify PublishRepositoryUrl=true in order to publish the URL, in order to prevent inadvertent leak of internal URL. -->
<RepositoryUrl Condition="'$(RepositoryUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(PrivateRepositoryUrl)</RepositoryUrl>
<PackageProjectUrl Condition="'$(PackageProjectUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(PrivateRepositoryUrl)</PackageProjectUrl>
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(SourceRevisionId)</RepositoryCommit>
</PropertyGroup>
</PropertyGroup>
</Target>

<!--
Expand Down

0 comments on commit d0f9740

Please sign in to comment.