Skip to content

Commit a153d04

Browse files
authored
Merge pull request #6 from ionide/support-multitargeted-builds
2 parents 53dfbd0 + 04d49e3 commit a153d04

File tree

6 files changed

+77
-23
lines changed

6 files changed

+77
-23
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [0.1.2] - 2022.02.13
4+
5+
### Added
6+
7+
- Now supports multiTargeted builds and packs by the addition of the buildMultiTargeting folder. The outer build is hooked at the GenerateNuspec target.
8+
39
## [0.1.1] - 2022.01.14
410

511
### Added

src/Ionide.KeepAChangelog.Tasks/Ionide.KeepAChangelog.Tasks.fsproj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@
88
<DebugType>embedded</DebugType>
99
<IsPackable>true</IsPackable>
1010
<Description>MSBuild Tasks and Targets that set your Assembly Version, Package Version, and Package Release Notes from your KeepAChangelog-compatible Changelogs.</Description>
11-
<Version>0.1.1</Version>
12-
<PackageReleaseNotes>### Added
11+
<Version>0.1.2</Version>
12+
<PackageReleaseNotes>
13+
### Added
1314

14-
- Now writes an assembly-level AssemblyMetadataAttribute with the key "BuildDate" whose value is the `YYYY-mm-dd`-formatted date in the release changelog
15+
- Now supports multiTargeted builds and packs by the addition of the buildMultiTargeting folder. The outer build is hooked at the GenerateNuspec target.
1516
</PackageReleaseNotes>
1617
</PropertyGroup>
1718

1819
<ItemGroup>
1920
<Compile Include="Library.fs" />
20-
<!-- these lines pack the build props/targets files to the `build` folder in the generated package.
21-
by convention, the .NET SDK will look for build\<Package Id>.props and build\<Package Id>.targets
22-
for automatic inclusion in the build. -->
23-
<Content Include="build\Ionide.KeepAChangelog.Tasks.props" PackagePath="build\" />
24-
<Content Include="build\Ionide.KeepAChangelog.Tasks.targets" PackagePath="build\" />
21+
<!-- these lines pack the single-TFM build props/targets files to the `build` folder in the generated package.
22+
By convention, the .NET SDK will look for `build\<Package Id>.props` and `build\<Package Id>.targets`
23+
for automatic inclusion in a single-TFM build. -->
24+
<Content Include="build\*" PackagePath="build\" />
25+
<!-- these lines pack the multi-target TFM build props/targets files to the `buildMultiTargeting` folder in the generated package.
26+
By convention, the .NET SDK will look for `buildMultiTargeting\<Package Id>.props` and `buildMultiTargeting\<Package Id>.targets`
27+
for automatic inclusion in a multi-TFM build. -->
28+
<Content Include="buildMultiTargeting\*" PackagePath="buildMultiTargeting\" />
2529
</ItemGroup>
2630
<ItemGroup>
2731
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.0.0" PrivateAssets="All" IncludeAssets="Compile" />

src/Ionide.KeepAChangelog.Tasks/build/Ionide.KeepAChangelog.Tasks.targets

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2-
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)../lib/netstandard2.0/Ionide.KeepAChangelog.Tasks.dll" TaskName="Ionide.KeepAChangelog.Tasks.ParseChangeLogs"/>
2+
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)../lib/netstandard2.0/Ionide.KeepAChangelog.Tasks.dll" TaskName="Ionide.KeepAChangelog.Tasks.ParseChangeLogs" />
33

44
<PropertyGroup>
5+
<!-- For single-target builds (or inner builds of a multi-targeted build) we must run before any of the normal versioning-related targets are run.
6+
This is surprisingly hard to time correctly. PrepareForBuild is the best location I've been able to find, and Rainer agrees this is a logical spot. -->
57
<PrepareForBuildDependsOn>
68
SetVersionFromChangelog;
79
$(PrepareForBuildDependsOn)
810
</PrepareForBuildDependsOn>
911
</PropertyGroup>
10-
11-
<Target Name="GetChangelogVersion"
12-
Condition="'$(ChangelogFile)' != '' and Exists('$(ChangelogFile)')"
13-
Inputs="$(ChangelogFile)"
14-
Outputs="UnreleasedChangelog;CurrentReleaseChangelog;AllReleasedChangelogslLatestReleaseNotes">
15-
<Ionide.KeepAChangelog.Tasks.ParseChangeLogs
16-
ChangelogFile="$(ChangelogFile)">
17-
<Output TaskParameter="UnreleasedChangelog" ItemName="UnreleasedChangelog"/>
18-
<Output TaskParameter="CurrentReleaseChangelog" ItemName="CurrentReleaseChangelog"/>
12+
13+
<Target Name="GetChangelogVersion" Condition="'$(ChangelogFile)' != '' and Exists('$(ChangelogFile)')" Inputs="$(ChangelogFile)" Outputs="UnreleasedChangelog;CurrentReleaseChangelog;AllReleasedChangelogslLatestReleaseNotes">
14+
<Ionide.KeepAChangelog.Tasks.ParseChangeLogs ChangelogFile="$(ChangelogFile)">
15+
<Output TaskParameter="UnreleasedChangelog" ItemName="UnreleasedChangelog" />
16+
<Output TaskParameter="CurrentReleaseChangelog" ItemName="CurrentReleaseChangelog" />
1917
<Output TaskParameter="AllReleasedChangelogs" ItemName="AllReleasedChangelogs" />
2018
<Output TaskParameter="LatestReleaseNotes" ItemName="LatestReleaseNotes" />
2119
</Ionide.KeepAChangelog.Tasks.ParseChangeLogs>
2220
</Target>
2321

24-
<Target Name="SetVersionFromChangelog"
25-
DependsOnTargets="GetChangelogVersion">
22+
<Target Name="SetVersionFromChangelog" DependsOnTargets="GetChangelogVersion">
2623
<PropertyGroup Condition="'@(CurrentReleaseChangelog)' != ''">
2724
<Version>%(CurrentReleaseChangelog.Identity)</Version>
2825
<PackageVersion>%(CurrentReleaseChangelog.Identity)</PackageVersion>
2926
<PackageReleaseNotes>@(LatestReleaseNotes)</PackageReleaseNotes>
3027
</PropertyGroup>
3128

3229
<ItemGroup Condition="'@(CurrentReleaseChangelog)' != '' and '$(GenerateAssemblyInfo)' == 'true'">
33-
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(GenerateRepositoryUrlAttribute)' == 'true' and ('$(RepositoryUrl)' != '' or '$(PublishRepositoryUrl)' == 'true')" >
30+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(GenerateRepositoryUrlAttribute)' == 'true' and ('$(RepositoryUrl)' != '' or '$(PublishRepositoryUrl)' == 'true')">
3431
<_Parameter1>BuildDate</_Parameter1>
3532
<_Parameter2>%(CurrentReleaseChangelog.Date)</_Parameter2>
3633
</AssemblyAttribute>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<ChangelogFile Condition="'$(ChangelogFile)' == ''">CHANGELOG.md</ChangelogFile>
4+
</PropertyGroup>
5+
</Project>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)../lib/netstandard2.0/Ionide.KeepAChangelog.Tasks.dll" TaskName="Ionide.KeepAChangelog.Tasks.ParseChangeLogs" />
3+
4+
<PropertyGroup>
5+
<!-- For multitargeting builds, the 'outer' build is used for things like packing, and so never hits the `PrepareForBuildDependsOn` condition group
6+
That works for 'inner', TFM-specific builds. Therefore we need another hook. Luckily, for packaging we can be much less restrictive on
7+
_when_ the versioning information is collected, because assemblies don't need to be stamped, so this can just happen sometime before
8+
the GenerateNuspec task. -->
9+
<GenerateNuspecDependsOn>
10+
SetVersionFromChangelog;
11+
$(GenerateNuspecDependsOn)
12+
</GenerateNuspecDependsOn>
13+
</PropertyGroup>
14+
15+
<Target Name="GetChangelogVersion" Condition="'$(ChangelogFile)' != '' and Exists('$(ChangelogFile)')" Inputs="$(ChangelogFile)" Outputs="UnreleasedChangelog;CurrentReleaseChangelog;AllReleasedChangelogslLatestReleaseNotes">
16+
<Ionide.KeepAChangelog.Tasks.ParseChangeLogs ChangelogFile="$(ChangelogFile)">
17+
<Output TaskParameter="UnreleasedChangelog" ItemName="UnreleasedChangelog" />
18+
<Output TaskParameter="CurrentReleaseChangelog" ItemName="CurrentReleaseChangelog" />
19+
<Output TaskParameter="AllReleasedChangelogs" ItemName="AllReleasedChangelogs" />
20+
<Output TaskParameter="LatestReleaseNotes" ItemName="LatestReleaseNotes" />
21+
</Ionide.KeepAChangelog.Tasks.ParseChangeLogs>
22+
</Target>
23+
24+
<Target Name="SetVersionFromChangelog" DependsOnTargets="GetChangelogVersion">
25+
<PropertyGroup Condition="'@(CurrentReleaseChangelog)' != ''">
26+
<Version>%(CurrentReleaseChangelog.Identity)</Version>
27+
<PackageVersion>%(CurrentReleaseChangelog.Identity)</PackageVersion>
28+
<PackageReleaseNotes>@(LatestReleaseNotes)</PackageReleaseNotes>
29+
</PropertyGroup>
30+
31+
<ItemGroup Condition="'@(CurrentReleaseChangelog)' != '' and '$(GenerateAssemblyInfo)' == 'true'">
32+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(GenerateRepositoryUrlAttribute)' == 'true' and ('$(RepositoryUrl)' != '' or '$(PublishRepositoryUrl)' == 'true')">
33+
<_Parameter1>BuildDate</_Parameter1>
34+
<_Parameter2>%(CurrentReleaseChangelog.Date)</_Parameter2>
35+
</AssemblyAttribute>
36+
</ItemGroup>
37+
</Target>
38+
39+
</Project>

src/Ionide.KeepAChangelog/Ionide.KeepAChangelog.fsproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
<DebugType>embedded</DebugType>
77
<IsPackable>true</IsPackable>
88
<Description>A self-contained parser for the KeepAChangelog format.</Description>
9-
<Version>0.1.1</Version>
10-
<PackageReleaseNotes>Initial release of the KeepAChangelog parser.</PackageReleaseNotes>
9+
<Version>0.1.2</Version>
10+
<PackageReleaseNotes>
11+
### Added
12+
13+
- Now supports multiTargeted builds and packs by the addition of the buildMultiTargeting folder. The outer build is hooked at the GenerateNuspec target.</PackageReleaseNotes>
1114
</PropertyGroup>
1215

1316
<ItemGroup>

0 commit comments

Comments
 (0)