Skip to content

Commit 55e25d8

Browse files
committed
🖆 Apply kzu/oss template via dotnet-file
Fixes #59
1 parent 0ddb8e0 commit 55e25d8

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

.netconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@
7575
weak
7676
[file "src/Directory.Build.props"]
7777
url = https://github.com/kzu/oss/blob/main/src/Directory.Build.props
78-
etag = 5b0cf9c055f179dc0b0f15a7e6dfbc6b8ea4b949eec61c0f3000afa2198970a6
78+
etag = d0b93d7533832a4d62cff69c71540bad3284bf92a7d2096b1a91607d72099d2b
7979
weak
8080
[file "src/Directory.Build.targets"]
8181
url = https://github.com/kzu/oss/blob/main/src/Directory.Build.targets
82-
etag = 6e628510436de9303695f2f8c8fb743b698a0d93adc8e4c127bbbae0f74166b7
82+
etag = 87357cb36379ac589c3981bddec4c5f7f89c55356573bd203acbea4b66fe3427
8383
weak
8484
[file "src/kzu.snk"]
8585
url = https://github.com/kzu/oss/blob/main/src/kzu.snk

src/Directory.Build.props

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565

6666
<!-- Generate satellite assemblies using csc.exe to avoid some al.exe issues. See https://github.com/dotnet/msbuild/pull/2726 -->
6767
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
68+
69+
<!-- See: https://www.cazzulino.com/project-dependencies-as-project-references.html -->
70+
<AddSyntheticProjectReferencesForSolutionDependencies>false</AddSyntheticProjectReferencesForSolutionDependencies>
6871
</PropertyGroup>
6972

7073
<PropertyGroup Label="Version">

src/Directory.Build.targets

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<!-- To extend/change the defaults, create a Directory.targets alongside this file -->
33

4-
<PropertyGroup>
4+
<PropertyGroup Condition="'$(IsPackable)' == ''">
55
<!-- The Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets unconditionally sets
66
PackageId=AssemblyName if no PackageId is provided, and then defaults IsPackable=true if
77
a PackageId is set (?!), meaning that by default everything is packable in Sdk-style
@@ -13,6 +13,7 @@
1313
IsPackable a more sensible default, making it false if no PackageId was provided at this
1414
point. -->
1515
<IsPackable Condition="'$(PackageId)' == ''">false</IsPackable>
16+
<IsPackable Condition="'$(PackageId)' != ''">true</IsPackable>
1617
</PropertyGroup>
1718

1819
<!-- Microsoft.NET.Sdk\targets\Microsoft.NET.DefaultAssemblyInfo.targets does this and is imported
@@ -57,19 +58,35 @@
5758
<ProjectProperty Include="RepositoryCommit" />
5859
</ItemGroup>
5960

61+
<!-- Make sure the source control info is available before calling source generators -->
62+
<Target Name="EnsureProjectInformation" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun" DependsOnTargets="InitializeSourceControlInformation" />
63+
64+
<Target Name="_InitializeRepositoryProperties"
65+
DependsOnTargets="InitializeSourceControlInformation"
66+
Condition="'$(SourceControlInformationFeatureSupported)' == 'true'">
67+
<PropertyGroup>
68+
</PropertyGroup>
69+
</Target>
70+
6071
<!-- Always append the link to the direct source tree for the current build -->
6172
<Target Name="UpdatePackageMetadata"
62-
BeforeTargets="PrepareForBuild;GetAssemblyVersion;GetPackageMetadata;GenerateNuspec;Pack"
73+
BeforeTargets="PrepareForBuild;GenerateMSBuildEditorConfigFileShouldRun;GetAssemblyVersion;GetPackageMetadata;GenerateNuspec;Pack"
6374
DependsOnTargets="InitializeSourceControlInformation"
6475
Condition="'$(SourceControlInformationFeatureSupported)' == 'true' And
65-
'$(IsPackable)' == 'true' And
66-
'$(RepositoryUrl)' != '' And
67-
'$(SourceRevisionId)' != ''">
76+
'$(IsPackable)' == 'true'">
6877
<PropertyGroup>
69-
<Description>$(Description)
78+
<Description Condition="'$(SourceRevisionId)' != ''">$(Description)
7079

71-
Built from $(RepositoryUrl)/tree/$(SourceRevisionId.Substring(0, 9))</Description>
80+
Built from $(RepositoryUrl)/tree/$(SourceRevisionId.Substring(0, 9))
81+
</Description>
7282
<PackageDescription>$(Description)</PackageDescription>
83+
84+
<!-- The project must specify PublishRepositoryUrl=true in order to publish the URL, in order to prevent inadvertent leak of internal URL. -->
85+
<RepositoryUrl Condition="'$(RepositoryUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(PrivateRepositoryUrl)</RepositoryUrl>
86+
<PackageProjectUrl Condition="'$(PackageProjectUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(RepositoryUrl)</PackageProjectUrl>
87+
88+
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(SourceRevisionId)</RepositoryCommit>
89+
<RepositorySha Condition="'$(SourceRevisionId)' != ''">$(SourceRevisionId.Substring(0, 9))</RepositorySha>
7390
</PropertyGroup>
7491
</Target>
7592

0 commit comments

Comments
 (0)