Skip to content

Commit 01feef1

Browse files
committed
Simplify cspoj through use of props and targets files
* includes common nuspec details removing the need to update each file * assemblies signed through use of props file instead of detailed in each csproj * now generates assembly info files from csproj + targets (allows assembly versions to be unique per project) * attaches repo + commit to nuspec + assembly info through use of Microsoft.SourceLink.GitHub nuget package * the above is configurable though csproj properties
1 parent 77065e6 commit 01feef1

File tree

35 files changed

+142
-626
lines changed

35 files changed

+142
-626
lines changed

build/default.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ task Test {
6262

6363
# TODO: Move to using dotnet test to execute the unit tests
6464
# the below works however the output format needs to be tweeked.
65-
exec { dotnet test ..\tests\NHapi.NUnit\NHapi.NUnit.csproj -c Release -f net461 --no-restore --no-build }
66-
exec { dotnet test ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj -c Release -f net461 --no-restore --no-build }
67-
exec { dotnet test ..\tests\NHapi.NUnit\NHapi.NUnit.csproj -c Release -f netcoreapp3.1 --no-restore --no-build }
68-
exec { dotnet test ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj -c Release -f netcoreapp3.1 --no-restore --no-build }
65+
exec { dotnet test ..\tests\NHapi.NUnit\NHapi.NUnit.csproj -r TestResults -c Release -f net461 --no-restore --no-build }
66+
exec { dotnet test ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj -r TestResults -c Release -f net461 --no-restore --no-build }
67+
exec { dotnet test ..\tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj -r TestResults -c Release -f net461 --no-restore --no-build }
68+
exec { dotnet test ..\tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj -r TestResults -c Release -f net6.0 --no-restore --no-build }
69+
exec { dotnet test ..\tests\NHapi.NUnit\NHapi.NUnit.csproj -r TestResults -c Release -f net6.0 --no-restore --no-build }
70+
exec { dotnet test ..\tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj -r TestResults -c Release -f net6.0 --no-restore --no-build }
6971
}
7072

7173
Task Package -depends Build {

src/Directory.Build.props

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project>
2+
<PropertyGroup>
3+
<IsPackable Condition=" '$(IsPackable)' == '' ">true</IsPackable>
4+
<GenerateAssemblyInfo Condition=" '$(GenerateAssemblyInfo)' == '' ">true</GenerateAssemblyInfo>
5+
<IncludeCommonPackageInfo>false</IncludeCommonPackageInfo>
6+
<IncludeCommonAssemblyAttributes>false</IncludeCommonAssemblyAttributes>
7+
<!-- Other -->
8+
<LangVersion>latest</LangVersion>
9+
</PropertyGroup>
10+
11+
<!-- Signed Assemblies -->
12+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
13+
<AssemblyOriginatorKeyFile>..\..\NHapi.snk</AssemblyOriginatorKeyFile>
14+
<SignAssembly>true</SignAssembly>
15+
<PublicKey>0024000004800000940000000602000000240000525341310004000001000100b938fa88814fb99f1d02dfce84c41f38eb1ca31f694b706248e6e21ceed1b1d150416c1375603c7a5dd6d3b2cdec97ccbbdd7a1d6fac61a1ad96ebf88e889ba113913c2f36890ea75108a1d8a23affc0c87357f07dec77c69a519215d0d4043759397b1a8fea1dc881b440ba4232ad4e24d7a8d90bb004549cf4f9dd2d6c13d8</PublicKey>
16+
</PropertyGroup>
17+
18+
<ItemGroup>
19+
<Compile Include="..\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />
20+
</ItemGroup>
21+
</Project>

src/Directory.Build.targets

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project>
2+
<!-- Common Package Attributes (nuspec) -->
3+
<PropertyGroup Condition=" '$(IsPackable)' == 'true' And '$(IncludeCommonPackageInfo)' == 'true' ">
4+
<Authors>Chad Chenoweth;Duane Edwards;Jake Aitchison</Authors>
5+
<PackageLicenseExpression>MPL-2.0</PackageLicenseExpression>
6+
<PackageProjectUrl>https://github.com/nHapiNET/nHapi</PackageProjectUrl>
7+
<RepositoryUrl>https://github.com/nHapiNET/nHapi.git</RepositoryUrl>
8+
<RepositoryType>git</RepositoryType>
9+
<PackageTags>HL7;parsing;healthcare;HAPI;xml</PackageTags>
10+
<PackageReleaseNotes>https://github.com/nHapiNET/nHapi/releases/tag/v$(Version)</PackageReleaseNotes>
11+
<PackageReadmeFile>docs\README.md</PackageReadmeFile>
12+
</PropertyGroup>
13+
14+
<!-- Common Packed Files -->
15+
<ItemGroup Condition=" '$(IsPackable)' == 'true' And '$(IncludeCommonPackageInfo)' == 'true' ">
16+
<None Include="..\..\README.md" Pack="true" PackagePath="\docs\" />
17+
</ItemGroup>
18+
19+
<!-- Common Assembly Attributes -->
20+
<PropertyGroup Condition=" '$(GenerateAssemblyInfo)' == 'true' And '$(IncludeCommonAssemblyAttributes)' == 'true' ">
21+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
22+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
23+
</PropertyGroup>
24+
25+
<PropertyGroup Condition=" '$(IsPackable)' == 'true' And '$(IncludeCommonPackageInfo)' == 'true' And '$(Configuration)' == 'Release' ">
26+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
27+
</PropertyGroup>
28+
29+
<!-- Build Time Tools (Includes commit sha in AssemblyInfo etc)-->
30+
<ItemGroup Condition=" '$(IsPackable)' == 'true' And '$(IncludeCommonPackageInfo)' == 'true' And '$(Configuration)' == 'Release' ">
31+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" IsImplicitlyDefined="true" />
32+
</ItemGroup>
33+
</Project>

src/ModelGenerator/ModelGenerator.csproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFrameworks>net35;net6.0</TargetFrameworks>
6-
<AssemblyOriginatorKeyFile>..\..\NHapi.snk</AssemblyOriginatorKeyFile>
6+
<IsPackable>false</IsPackable>
77
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
88
</PropertyGroup>
99

1010
<ItemGroup>
1111
<AdditionalFiles Include="$(SolutionDir)stylecop.json" Link="Properties\stylecop.json" />
1212
</ItemGroup>
1313

14-
<ItemGroup>
15-
<None Include="..\..\NHapi.snk" Link="NHapi.snk" />
16-
</ItemGroup>
17-
18-
<ItemGroup>
19-
<Compile Include="..\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />
20-
</ItemGroup>
21-
2214
<ItemGroup>
2315
<Compile Update="Properties\Settings.Designer.cs">
2416
<DesignTimeSharedInput>True</DesignTimeSharedInput>

src/NHapi.Base/NHapi.Base.csproj

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,21 @@
44
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
55
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
66
<PackageId>nhapi.base</PackageId>
7-
<PackageVersion>3.0.4</PackageVersion>
8-
<Authors>Chad Chenoweth;Duane Edwards;Jake Aitchison</Authors>
9-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10-
<PackageProjectUrl>https://github.com/nHapiNET/nHapi</PackageProjectUrl>
11-
<RepositoryUrl>https://github.com/nHapiNET/nHapi.git</RepositoryUrl>
12-
<RepositoryType>git</RepositoryType>
13-
<Description>The core components for parsing/encoding HL7 messages. Contains the base classes and interfaces for datatypes, segments, and messages.</Description>
14-
<PackageTags>HL7;parsing;healthcare;HAPI;xml</PackageTags>
15-
<PackageReleaseNotes>https://github.com/nHapiNET/nHapi/releases/tag/v3.0.4</PackageReleaseNotes>
16-
<PackageReadmeFile>docs\README.md</PackageReadmeFile>
17-
<AssemblyOriginatorKeyFile>..\..\NHapi.snk</AssemblyOriginatorKeyFile>
18-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<Version>3.0.4</Version>
8+
<PackageDescription>The core components for parsing/encoding HL7 messages. Contains the base classes and interfaces for datatypes, segments, and messages.</PackageDescription>
9+
<Description>NHapi Common Library</Description>
1910
<NoWarn>1591</NoWarn>
11+
<IncludeCommonPackageInfo>true</IncludeCommonPackageInfo>
12+
<IncludeCommonAssemblyAttributes>true</IncludeCommonAssemblyAttributes>
2013
</PropertyGroup>
21-
22-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
23-
<SignAssembly>true</SignAssembly>
24-
</PropertyGroup>
25-
14+
2615
<ItemGroup>
27-
<AdditionalFiles Include="$(SolutionDir)stylecop.json" Link="Properties\stylecop.json" />
16+
<InternalsVisibleTo Include="$(AssemblyName).NUnit" />
17+
<InternalsVisibleTo Include="NHapi.SourceGeneration" />
2818
</ItemGroup>
2919

3020
<ItemGroup>
31-
<None Include="..\..\NHapi.snk" Link="NHapi.snk" />
32-
</ItemGroup>
33-
34-
<ItemGroup>
35-
<None Include="..\..\README.md" Pack="true" PackagePath="\docs\" />
36-
</ItemGroup>
37-
38-
<ItemGroup>
39-
<Compile Include="..\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />
21+
<AdditionalFiles Include="$(SolutionDir)stylecop.json" Link="Properties\stylecop.json" />
4022
</ItemGroup>
4123

4224
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">

src/NHapi.Base/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/NHapi.Model.V21/NHapi.Model.V21.csproj

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,14 @@
44
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
55
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
66
<PackageId>nhapi.model.v21</PackageId>
7-
<PackageVersion>3.0.2</PackageVersion>
8-
<Authors>Chad Chenoweth;Duane Edwards;Jake Aitchison</Authors>
9-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10-
<PackageProjectUrl>https://github.com/nHapiNET/nHapi</PackageProjectUrl>
11-
<RepositoryUrl>https://github.com/nHapiNET/nHapi.git</RepositoryUrl>
12-
<RepositoryType>git</RepositoryType>
13-
<Description>Contains the data types, segments, and messages that follow the HL7 2.1 schema.</Description>
14-
<PackageTags>HL7;parsing;healthcare;HAPI;xml</PackageTags>
15-
<PackageReleaseNotes>https://github.com/nHapiNET/nHapi/releases/tag/v3.0.2</PackageReleaseNotes>
16-
<PackageReadmeFile>docs\README.md</PackageReadmeFile>
17-
<AssemblyOriginatorKeyFile>..\..\NHapi.snk</AssemblyOriginatorKeyFile>
18-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<Version>3.0.2</Version>
8+
<PackageDescription>Contains the data types, segments, and messages that follow the HL7 2.1 schema.</PackageDescription>
9+
<Description>NHapi Model V.2.1</Description>
10+
<IncludeCommonPackageInfo>true</IncludeCommonPackageInfo>
11+
<IncludeCommonAssemblyAttributes>true</IncludeCommonAssemblyAttributes>
1912
<NoWarn>1591</NoWarn>
2013
</PropertyGroup>
2114

22-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
23-
<SignAssembly>true</SignAssembly>
24-
</PropertyGroup>
25-
26-
<ItemGroup>
27-
<None Include="..\..\NHapi.snk" Link="NHapi.snk" />
28-
</ItemGroup>
29-
30-
<ItemGroup>
31-
<None Include="..\..\README.md" Pack="true" PackagePath="\docs\" />
32-
</ItemGroup>
33-
34-
<ItemGroup>
35-
<Compile Include="..\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />
36-
</ItemGroup>
37-
3815
<ItemGroup>
3916
<EmbeddedResource Include="EventMapping\EventMap.properties" />
4017
</ItemGroup>

src/NHapi.Model.V21/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/NHapi.Model.V22/NHapi.Model.V22.csproj

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,14 @@
44
<TargetFrameworks>net35;netstandard2.0</TargetFrameworks>
55
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
66
<PackageId>nhapi.model.v22</PackageId>
7-
<PackageVersion>3.0.2</PackageVersion>
8-
<Authors>Chad Chenoweth;Duane Edwards;Jake Aitchison</Authors>
9-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10-
<PackageProjectUrl>https://github.com/nHapiNET/nHapi</PackageProjectUrl>
11-
<RepositoryUrl>https://github.com/nHapiNET/nHapi.git</RepositoryUrl>
12-
<RepositoryType>git</RepositoryType>
13-
<Description>Contains the data types, segments, and messages that follow the HL7 2.2 schema.</Description>
14-
<PackageTags>HL7;parsing;healthcare;HAPI;xml</PackageTags>
15-
<PackageReleaseNotes>https://github.com/nHapiNET/nHapi/releases/tag/v3.0.2</PackageReleaseNotes>
16-
<PackageReadmeFile>docs\README.md</PackageReadmeFile>
17-
<AssemblyOriginatorKeyFile>..\..\NHapi.snk</AssemblyOriginatorKeyFile>
18-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<Version>3.0.2</Version>
8+
<PackageDescription>Contains the data types, segments, and messages that follow the HL7 2.2 schema.</PackageDescription>
9+
<Description>NHapi Model V.2.2</Description>
10+
<IncludeCommonPackageInfo>true</IncludeCommonPackageInfo>
11+
<IncludeCommonAssemblyAttributes>true</IncludeCommonAssemblyAttributes>
1912
<NoWarn>1591</NoWarn>
2013
</PropertyGroup>
2114

22-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
23-
<SignAssembly>true</SignAssembly>
24-
</PropertyGroup>
25-
26-
<ItemGroup>
27-
<None Include="..\..\NHapi.snk" Link="NHapi.snk" />
28-
</ItemGroup>
29-
30-
<ItemGroup>
31-
<None Include="..\..\README.md" Pack="true" PackagePath="\docs\" />
32-
</ItemGroup>
33-
34-
<ItemGroup>
35-
<Compile Include="..\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />
36-
</ItemGroup>
37-
3815
<ItemGroup>
3916
<EmbeddedResource Include="EventMapping\EventMap.properties" />
4017
</ItemGroup>

src/NHapi.Model.V22/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)