Skip to content

Commit

Permalink
Merge pull request #1103 from lahma/refine-nuget-package
Browse files Browse the repository at this point in the history
Include all projects in NuGet package
  • Loading branch information
tonyqus committed Jun 26, 2023
2 parents fac36d0 + 15e31d8 commit 7a218cc
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 47 deletions.
23 changes: 11 additions & 12 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

<!-- SourceLink related properties https://github.com/dotnet/SourceLink#using-sourcelink -->
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- Optional: Include the PDB in the built .nupkg -->
<!-- <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> -->

<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<RunSettingsFilePath>$(MSBuildThisFileDirectory)\test.runsettings</RunSettingsFilePath>
<DebugType>portable</DebugType>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

<VersionPrefix>2.6.1</VersionPrefix>
<Title>NPOI</Title>
Expand All @@ -34,6 +25,10 @@
<PackageTags>xlsx xls Excel Word docx office ole</PackageTags>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE" Pack="true" Visible="false" PackagePath="" />
<None Include="..\Read Me.txt" Pack="true" Visible="false" PackagePath="" />
Expand All @@ -46,6 +41,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NuGetizer" Version="1.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
5 changes: 0 additions & 5 deletions OpenXmlFormats/NPOI.OpenXmlFormats.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NPOI.OpenXmlFormats</AssemblyName>
<RootNamespace>NPOI.OpenXmlFormats</RootNamespace>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\npoi.snk</AssemblyOriginatorKeyFile>
<OutputPath>..\solution\$(Configuration)\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\main\NPOI.Core.csproj" />
<ProjectReference Include="..\openxml4Net\NPOI.OpenXml4Net.Core.csproj" />
Expand Down
26 changes: 22 additions & 4 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,18 @@ protected override void OnBuildInitialized()
.Before(Restore)
.Executes(() =>
{
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory());
DeleteCompilationArtifacts();
ArtifactsDirectory.CreateOrCleanDirectory();
});

static void DeleteCompilationArtifacts()
{
var solutionDirectory = RootDirectory / "solution";
solutionDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory());
(solutionDirectory / "Debug").DeleteDirectory();
(solutionDirectory / "Release").DeleteDirectory();
}

Target Restore => _ => _
.Executes(() =>
{
Expand All @@ -68,9 +77,12 @@ protected override void OnBuildInitialized()
.SetVerbosity(DotNetVerbosity.Minimal)
// obsolete missing XML documentation comment, XML comment on not valid language element, XML comment has badly formed XML, no matching tag in XML comment
// need to use escaped separator in order for this to work
.AddProperty("NoWarn", string.Join("%3B", new [] { 618, 1591, 1587, 1570, 1572, 1573 }))
.AddProperty("NoWarn", string.Join("%3B", new [] { 169, 612, 618, 1591, 1587, 1570, 1572, 1573, 1574 }))
.SetProjectFile(Solution)
);
// copy files from projects in order to get them to be part of pack
});

Target Test => _ => _
Expand Down Expand Up @@ -103,15 +115,21 @@ protected override void OnBuildInitialized()
.Produces(ArtifactsDirectory / "**")
.Executes(() =>
{
// make sure we make fresh build
DeleteCompilationArtifacts();
var packTarget = Solution.GetProject("NPOI.Pack");
DotNetPack(_ =>_
.SetConfiguration(Configuration)
.SetOutputDirectory(ArtifactsDirectory)
.SetDeterministic(IsServerBuild)
.SetContinuousIntegrationBuild(IsServerBuild)
// obsolete missing XML documentation comment, XML comment on not valid language element, XML comment has badly formed XML, no matching tag in XML comment
// need to use escaped separator in order for this to work
.AddProperty("NoWarn", string.Join("%3B", new [] { 618, 1591, 1587, 1570, 1572, 1573 }))
.SetProject(Solution.GetProject("NPOI.Core"))
.AddProperty("NoWarn", string.Join("%3B", new [] { 169, 612, 618, 1591, 1587, 1570, 1572, 1573, 1574 }))
.SetProperty("EnablePackageValidation", "false")
.SetProject(packTarget)
);
});
}
13 changes: 7 additions & 6 deletions main/NPOI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NPOI</AssemblyName>
<RootNamespace>NPOI</RootNamespace>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\npoi.snk</AssemblyOriginatorKeyFile>
<OutputPath>..\solution\$(Configuration)\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\font_metrics.properties" />
<EmbeddedResource Include="Resources\functionMetadata.txt" />
Expand All @@ -27,7 +21,14 @@
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta19" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.4" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'net472' ">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<Reference Include="System.Configuration" />
</ItemGroup>

</Project>
8 changes: 0 additions & 8 deletions ooxml/NPOI.OOXML.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NPOI.OOXML</AssemblyName>
<RootNamespace>NPOI</RootNamespace>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\npoi.snk</AssemblyOriginatorKeyFile>
<OutputPath>..\solution\$(Configuration)\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<Compile Remove="POIFS\Crypt\Dsig\KeyInfoKeySelector.cs" />
<Compile Remove="POIFS\Crypt\Dsig\Services\RelationshipTransformService.cs" />
Expand Down
5 changes: 0 additions & 5 deletions openxml4Net/NPOI.OpenXml4Net.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NPOI.OpenXml4Net</AssemblyName>
<RootNamespace>NPOI.OpenXml4Net</RootNamespace>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\npoi.snk</AssemblyOriginatorKeyFile>
<OutputPath>..\solution\$(Configuration)\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\main\NPOI.Core.csproj" />
</ItemGroup>
Expand Down
10 changes: 6 additions & 4 deletions solution/NPOI.Core.Test.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "..\build\_build.c
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NPOI.Benchmarks", "..\benchmarks\NPOI.Benchmarks\NPOI.Benchmarks.csproj", "{3DA1149D-46F8-4181-9976-E002BF2BFB76}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPOI.Pack", "NPOI.Pack.csproj", "{6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -60,14 +62,14 @@ Global
{DA2CA3BD-1CAC-470C-9FA2-611A5768A76A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA2CA3BD-1CAC-470C-9FA2-611A5768A76A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA2CA3BD-1CAC-470C-9FA2-611A5768A76A}.Release|Any CPU.Build.0 = Release|Any CPU
{94B18BCF-84E8-401F-BAAB-0496AA136628}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94B18BCF-84E8-401F-BAAB-0496AA136628}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94B18BCF-84E8-401F-BAAB-0496AA136628}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94B18BCF-84E8-401F-BAAB-0496AA136628}.Release|Any CPU.Build.0 = Release|Any CPU
{3DA1149D-46F8-4181-9976-E002BF2BFB76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DA1149D-46F8-4181-9976-E002BF2BFB76}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DA1149D-46F8-4181-9976-E002BF2BFB76}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DA1149D-46F8-4181-9976-E002BF2BFB76}.Release|Any CPU.Build.0 = Release|Any CPU
{6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D7A6E15-C914-4FCA-B8E4-FF5C7437C2E0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
19 changes: 19 additions & 0 deletions solution/NPOI.Pack.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- This is an umbrella project that gathers dependencies for dotnet pack -->

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<IncludeBuildOutput>false</IncludeBuildOutput>
<PackageId>NPOI</PackageId>
<OutputPath>..\solution\$(Configuration)\</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\main\NPOI.Core.csproj" />
<ProjectReference Include="..\ooxml\NPOI.OOXML.Core.csproj" />
<ProjectReference Include="..\openxml4Net\NPOI.OpenXml4Net.Core.csproj" />
<ProjectReference Include="..\OpenXmlFormats\NPOI.OpenXmlFormats.Core.csproj" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions testcases/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>

<PropertyGroup>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RunSettingsFilePath>$(MSBuildProjectDirectory)\..\..\test.runsettings</RunSettingsFilePath>
</PropertyGroup>

</Project>
1 change: 0 additions & 1 deletion testcases/main/NPOI.TestCases.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NPOI.TestCases</AssemblyName>
<RootNamespace>TestCases</RootNamespace>
<SignAssembly>true</SignAssembly>
Expand Down
1 change: 0 additions & 1 deletion testcases/ooxml/NPOI.OOXML.TestCases.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NPOI.OOXML.TestCases</AssemblyName>
<RootNamespace>TestCases</RootNamespace>
<SignAssembly>true</SignAssembly>
Expand Down
1 change: 0 additions & 1 deletion testcases/openxml4net/NPOI.OOXML4Net.TestCases.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>NPOI.OOXML4Net.TestCases</AssemblyName>
<RootNamespace>TestCases</RootNamespace>
<SignAssembly>true</SignAssembly>
Expand Down

0 comments on commit 7a218cc

Please sign in to comment.