Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add net472 build, use separate FSharp.Core for VS targeting? #10

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.1.3] - 2022.02.21

### Added

- Now supports running in Visual Studio thanks to a net472-targeted build and packaging

## [0.1.2] - 2022.02.13

### Added
Expand Down
33 changes: 26 additions & 7 deletions src/Ionide.KeepAChangelog.Tasks/Ionide.KeepAChangelog.Tasks.fsproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
<!-- we need the assemblies bundled, so set this so we don't expose any dependencies to the outside world -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
<DebugType>embedded</DebugType>
<IsPackable>true</IsPackable>
<Description>MSBuild Tasks and Targets that set your Assembly Version, Package Version, and Package Release Notes from your KeepAChangelog-compatible Changelogs.</Description>
<Version>0.1.2</Version>
<Version>0.1.3</Version>
<PackageReleaseNotes>
### Added

- Now supports multiTargeted builds and packs by the addition of the buildMultiTargeting folder. The outer build is hooked at the GenerateNuspec target.
- Now supports running in Visual Studio thanks to a net472-targeted build and packaging
</PackageReleaseNotes>
</PropertyGroup>

Expand All @@ -21,26 +21,45 @@
<!-- these lines pack the single-TFM build props/targets files to the `build` folder in the generated package.
By convention, the .NET SDK will look for `build\<Package Id>.props` and `build\<Package Id>.targets`
for automatic inclusion in a single-TFM build. -->
<Content Include="build\*" PackagePath="build\" />
<Content Include="build\*" PackagePath="build\net472" />
<Content Include="build\*" PackagePath="build\netstandard2.0" />
<!-- these lines pack the multi-target TFM build props/targets files to the `buildMultiTargeting` folder in the generated package.
By convention, the .NET SDK will look for `buildMultiTargeting\<Package Id>.props` and `buildMultiTargeting\<Package Id>.targets`
for automatic inclusion in a multi-TFM build. -->
<Content Include="buildMultiTargeting\*" PackagePath="buildMultiTargeting\" />
<Content Include="buildMultiTargeting\*" PackagePath="buildMultiTargeting\net472" />
<Content Include="buildMultiTargeting\*" PackagePath="buildMultiTargeting\netstandard2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.0.0" PrivateAssets="All" IncludeAssets="Compile" />
<PackageReference Include="SemanticVersion" Version="2.1.0" PrivateAssets="All" IncludeAssets="Compile" />
<PackageReference Include="FParsec" Version="1.1.1" PrivateAssets="All" IncludeAssets="Compile" />
<PackageReference Update="FSharp.Core" Version="4.7.2" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Update="FSharp.Core" PrivateAssets="All" IncludeAssets="Compile" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<ProjectReference Include="../Ionide.KeepAChangelog/Ionide.KeepAChangelog.fsproj" PrivateAssets="All" IncludeAssets="Compile" />
</ItemGroup>

<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<!-- the dependencies of your MSBuild task must be packaged inside the package, they cannot be expressed as normal PackageReferences -->
<BuildOutputInPackage Include="$(MSBuildThisProject)../Ionide.KeepAChangelog/bin/$(Configuration)/$(TargetFramework)/Ionide.KeepAChangelog.dll" />
<BuildOutputInPackage Include="$(PkgFSharp_Core)/lib/net45/FSharp.Core.dll" />
<!-- SemanticVersion .NET Framework DLL -->
<BuildOutputInPackage Include="$(PkgSemanticVersion)/lib/net462/SemanticVersion.dll" />
<!-- FParsec .NET Framework DLLS -->
<BuildOutputInPackage Include="$(PkgFParsec)/lib/net45/FParsec.dll" />
<BuildOutputInPackage Include="$(PkgFParsec)/lib/net45/FParsecCS.dll" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' ">
<!-- the dependencies of your MSBuild task must be packaged inside the package, they cannot be expressed as normal PackageReferences -->
<BuildOutputInPackage Include="$(MSBuildThisProject)../Ionide.KeepAChangelog/bin/$(Configuration)/$(TargetFramework)/Ionide.KeepAChangelog.dll" />
<BuildOutputInPackage Include="$(PkgSemanticVersion)/lib/netstandard2.0/SemanticVersion.dll" />
<BuildOutputInPackage Include="$(PkgFSharp_Core)/lib/netstandard2.0/FSharp.Core.dll" />
<!-- SemanticVersion .NET DLL -->
<BuildOutputInPackage Include="$(PkgSemanticVersion)/lib/netstandard2.0/SemanticVersion.dll" />
<!-- FParsec .NET DLLS -->
<BuildOutputInPackage Include="$(PkgFParsec)/lib/netstandard2.0/FParsec.dll" />
<BuildOutputInPackage Include="$(PkgFParsec)/lib/netstandard2.0/FParsecCS.dll" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Ionide.KeepAChangelog.Tasks/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module Util =
let section name items =
match items with
| [] -> []
| items -> $"### {name}" :: items @ [ "" ]
| items -> sprintf "### %s" name :: items @ [ "" ]

String.concat
System.Environment.NewLine
Expand Down Expand Up @@ -70,7 +70,7 @@ type ParseChangelogs() =
let file = this.ChangelogFile |> FileInfo

if not file.Exists then
this.Log.LogError($"The file {file.FullName} could not be found.")
this.Log.LogError(sprintf "The file %s could not be found." file.FullName)
false
else
match Parser.parseChangeLog file with
Expand Down Expand Up @@ -111,7 +111,7 @@ type ParseChangelogs() =
| Error (formatted, msg) ->

this.Log.LogError(
$"Error parsing Changelog at {file.FullName}. The error occurred at {msg.Position}.{System.Environment.NewLine}{formatted}"
sprintf "Error parsing Changelog at %s. The error occurred at %O.%s%s" file.FullName msg.Position System.Environment.NewLine formatted
)

false
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)../lib/netstandard2.0/Ionide.KeepAChangelog.Tasks.dll" TaskName="Ionide.KeepAChangelog.Tasks.ParseChangeLogs" />
<PropertyGroup>
<Ionide_KeepAChangelog_PackageRoot>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)..\..\"))</Ionide_KeepAChangelog_PackageRoot>
<Ionide_KeepAChangelog_AssemblyPath Condition=" '$(Ionide_KeepAChangelog_AssemblyPath)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">$(Ionide_KeepAChangelog_PackageRoot)lib\netstandard2.0\</Ionide_KeepAChangelog_AssemblyPath>
<Ionide_KeepAChangelog_AssemblyPath Condition=" '$(Ionide_KeepAChangelog_AssemblyPath)' == '' ">$(Ionide_KeepAChangelog_PackageRoot)lib\net472\</Ionide_KeepAChangelog_AssemblyPath>
</PropertyGroup>
<UsingTask AssemblyFile="$(Ionide_KeepAChangelog_AssemblyPath)Ionide.KeepAChangelog.Tasks.dll" TaskName="Ionide.KeepAChangelog.Tasks.ParseChangeLogs" />

<PropertyGroup>
<!-- 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.
Expand All @@ -11,6 +16,7 @@
</PropertyGroup>

<Target Name="GetChangelogVersion" Condition="'$(ChangelogFile)' != '' and Exists('$(ChangelogFile)')" Inputs="$(ChangelogFile)" Outputs="UnreleasedChangelog;CurrentReleaseChangelog;AllReleasedChangelogslLatestReleaseNotes">
<Message Text="$(Ionide_KeepAChangelog_PackageRoot); $(Ionide_KeepAChangelog_AssemblyPath)"/>
<Ionide.KeepAChangelog.Tasks.ParseChangeLogs ChangelogFile="$(ChangelogFile)">
<Output TaskParameter="UnreleasedChangelog" ItemName="UnreleasedChangelog" />
<Output TaskParameter="CurrentReleaseChangelog" ItemName="CurrentReleaseChangelog" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)../lib/netstandard2.0/Ionide.KeepAChangelog.Tasks.dll" TaskName="Ionide.KeepAChangelog.Tasks.ParseChangeLogs" />
<PropertyGroup>
<Ionide_KeepAChangelog_PackageRoot>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)..\..\"))</Ionide_KeepAChangelog_PackageRoot>
<Ionide_KeepAChangelog_AssemblyPath Condition=" '$(Ionide_KeepAChangelog_AssemblyPath)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">$(Ionide_KeepAChangelog_PackageRoot)lib\netstandard2.0\</Ionide_KeepAChangelog_AssemblyPath>
<Ionide_KeepAChangelog_AssemblyPath Condition=" '$(Ionide_KeepAChangelog_AssemblyPath)' == '' ">$(Ionide_KeepAChangelog_PackageRoot)lib\net472\</Ionide_KeepAChangelog_AssemblyPath>
</PropertyGroup>
<UsingTask AssemblyFile="$(Ionide_KeepAChangelog_AssemblyPath)Ionide.KeepAChangelog.Tasks.dll" TaskName="Ionide.KeepAChangelog.Tasks.ParseChangeLogs" />

<PropertyGroup>
<!-- For multitargeting builds, the 'outer' build is used for things like packing, and so never hits the `PrepareForBuildDependsOn` condition group
Expand Down
9 changes: 6 additions & 3 deletions src/Ionide.KeepAChangelog/Ionide.KeepAChangelog.fsproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DebugType>embedded</DebugType>
<IsPackable>true</IsPackable>
<Description>A self-contained parser for the KeepAChangelog format.</Description>
<Version>0.1.2</Version>
<Version>0.1.3</Version>
<PackageReleaseNotes>
### Added

- Now supports multiTargeted builds and packs by the addition of the buildMultiTargeting folder. The outer build is hooked at the GenerateNuspec target.</PackageReleaseNotes>
- Now supports running in Visual Studio thanks to a net472-targeted build and packaging
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<Compile Include="Library.fs" />
</ItemGroup>

<ItemGroup>
<!-- overwrite fsharp.core for VS build -->
<PackageReference Update="FSharp.Core" Version="4.7.2" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="FParsec" Version="1.1.1"/>
<PackageReference Include="SemanticVersion" Version="2.1.0"/>
</ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/Ionide.KeepAChangelog/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,25 @@ module Parser =
| Some parts -> String.concat " " (f :: parts))
<?> "line item"

pipe2 bullet content (fun bullet text -> $"{bullet} {text}")
pipe2 bullet content (fun bullet text -> sprintf "%c %s" bullet text)

let pCustomSection: Parser<string * string list> =
let sectionName =
skipString "###"
>>. spaces1
>>. restOfLine true // TODO: maybe not the whole line?
<?> $"custom section header"
<?> "custom section header"
sectionName
.>>. (many pEntry <?> $"{sectionName} entries")
.>>. (many pEntry <?> "custom section entries")
.>> attempt (opt newline)

let pSection sectionName : Parser<string list> =
(skipString "###"
>>. spaces1
>>. skipString sectionName)
<?> $"{sectionName} section header"
<?> sprintf "%s section header" sectionName
>>. many1 newline
>>. (many pEntry <?> $"{sectionName} entries")
>>. (many pEntry <?> sprintf "%s entries" sectionName)
.>> attempt (opt newline)

let pAdded = pSection "Added"
Expand Down