Skip to content

Commit d1a19c9

Browse files
Separating project into different assemblies (#828)
* Separating into 3 assemblies, changing namespaces, renaming main APIs, adding Directory.Build.props, and general refactoring * Rebasing, fixing merge conflicts and updating workflows * Made core and csv projects fully independent Moving importer, exporter and templater classes into core project and making them extensible, changing project names, fixing directory.build.props dependency warnings, turning solution file to slnx format, adding (basic) async implementation of MiniExcelDataReader * Reverting to standard .sln solution file to fix CodeQL analysis * Codeql workflow fixes for new slnx solution format * Added global usings * Updating directory.build.props target framework after rebasing * Removing facade assembly, renaming MiniExcel.Core project to MiniExcel * Added some more global usings * Separate CSV test cases * Changing MiniExcelTests project name to MiniExcel.Tests * Fixing commit mistake * Adjusted csv test namespaces * Introduced extensible providers for exporter, importer and templater * Added public api for applying a template from a template stream * Added assembly for legacy methods * Fixing build errors * Moved the public api under relevant namespace, changed version from beta to preview * Removing warning suppressions and adding a check on seekable stream template for SaveAsByTemplate method * Renamed API methods deleting Excel and Csv suffixes for simplicity Also moved a few tests and test sections from the main testing assembly to the csv testing assembly * Changed namespaces .Api to .Providers in both main and csv assemblies * Added Directory.Packages.props file and moved package metadata content to Directory.Build.props * Reintroduced facade assembly containing legacy code - Renamed MiniExcel to MiniExcel.Core again - Added different packages titles and ids for the assemblies - Renamed the providers back to Api but simplified namespaces * Fixed accidentally adding old tests not part of the solution * Adjusting legacy namespaces and adding old attributes signatures * Renamed some methods and properties --------- Co-authored-by: Victor Irzak <[email protected]>
1 parent 7e692bc commit d1a19c9

File tree

180 files changed

+5810
-5026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+5810
-5026
lines changed

.github/workflows/benchmark.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: MiniExcel Benchmarks
33
on:
44
workflow_dispatch:
55
release:
6+
branches: [master, v1.x-maintenance]
67
types: [published]
78

89
permissions:
@@ -31,7 +32,7 @@ jobs:
3132
BenchmarkMode: Automatic
3233
BenchmarkSection: query
3334
- name: Renaming result file
34-
run: mv MiniExcelLibs.Benchmarks.BenchmarkSections.QueryXlsxBenchmark-report-github.md query-benchmark.md
35+
run: mv MiniExcelLib.Benchmarks.BenchmarkSections.QueryXlsxBenchmark-report-github.md query-benchmark.md
3536
working-directory: ./benchmarks/MiniExcel.Benchmarks/BenchmarkDotNet.Artifacts/results
3637
- name: Save benchmark results
3738
uses: actions/upload-artifact@v4
@@ -61,7 +62,7 @@ jobs:
6162
BenchmarkMode: Automatic
6263
BenchmarkSection: create
6364
- name: Renaming result file
64-
run: mv MiniExcelLibs.Benchmarks.BenchmarkSections.CreateXlsxBenchmark-report-github.md create-benchmark.md
65+
run: mv MiniExcelLib.Benchmarks.BenchmarkSections.CreateXlsxBenchmark-report-github.md create-benchmark.md
6566
working-directory: ./benchmarks/MiniExcel.Benchmarks/BenchmarkDotNet.Artifacts/results
6667
- name: Save benchmark results
6768
uses: actions/upload-artifact@v4
@@ -91,7 +92,7 @@ jobs:
9192
BenchmarkMode: Automatic
9293
BenchmarkSection: template
9394
- name: Renaming result file
94-
run: mv MiniExcelLibs.Benchmarks.BenchmarkSections.TemplateXlsxBenchmark-report-github.md template-benchmark.md
95+
run: mv MiniExcelLib.Benchmarks.BenchmarkSections.TemplateXlsxBenchmark-report-github.md template-benchmark.md
9596
working-directory: ./benchmarks/MiniExcel.Benchmarks/BenchmarkDotNet.Artifacts/results
9697
- name: Save benchmark results
9798
uses: actions/upload-artifact@v4

.github/workflows/codeql-analysis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ jobs:
5959

6060
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6161
# If this step fails, then you should remove it and run the build manually (see below)
62-
- name: Autobuild
63-
uses: github/codeql-action/autobuild@v3
62+
63+
# - name: Autobuild
64+
# uses: github/codeql-action/autobuild@v3
6465

6566
# ℹ️ Command-line programs to run using the OS shell.
6667
# 📚 https://git.io/JvXDl
@@ -69,9 +70,8 @@ jobs:
6970
# and modify them (or add more) to build your code if your project
7071
# uses a compiled language
7172

72-
#- run: |
73-
# make bootstrap
74-
# make release
73+
- name: Manual build
74+
run: dotnet build
7575

7676
- name: Perform CodeQL Analysis
7777
uses: github/codeql-action/analyze@v3

.github/workflows/dotnet.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: .NET
33
on:
44
pull_request:
55
push:
6-
branches:
7-
- master
6+
branches: [master, v1.x-maintenance]
87

98
jobs:
109
build:

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,5 +401,6 @@ FodyWeavers.xsd
401401
/BenchmarkDotNet.Artifacts
402402
/tests/MiniExcel.Tests.AspNetMvc/packages
403403
/TestTemplate
404-
/tests/MiniExcelTests/TemplateOptimization
405-
/samples/xlsx/Test_EnableWriteFilePath.xlsx
404+
/tests/MiniExcel.Tests/TemplateOptimization
405+
/samples/xlsx/Test_EnableWriteFilePath.xlsx
406+
/tests/MiniExcel.Core.Tests/TemplateOptimization/

LICENSE

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,7 @@
175175

176176
END OF TERMS AND CONDITIONS
177177

178-
APPENDIX: How to apply the Apache License to your work.
179-
180-
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
182-
replaced with your own identifying information. (Don't include
183-
the brackets!) The text should be enclosed in the appropriate
184-
comment syntax for the file format. We also recommend that a
185-
file or class name and description of purpose be included on the
186-
same "printed page" as the copyright notice for easier
187-
identification within third-party archives.
188-
189-
Copyright [yyyy] [name of copyright owner]
178+
Copyright 2021 Wei Lin
190179

191180
Licensed under the Apache License, Version 2.0 (the "License");
192181
you may not use this file except in compliance with the License.

MiniExcel.sln

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

MiniExcel.slnx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Solution>
2+
<Folder Name="/benchmarks/">
3+
<Project Path="benchmarks\MiniExcel.Benchmarks\MiniExcel.Benchmarks.csproj" />
4+
</Folder>
5+
<Folder Name="/Docs and settings/">
6+
<File Path=".gitattributes" />
7+
<File Path=".gitignore" />
8+
<File Path="appveyor.yml" />
9+
<File Path=".github\workflows\dotnet.yml" />
10+
<File Path="LICENSE" />
11+
<File Path="README-NuGet.md" />
12+
<File Path="README.md" />
13+
<File Path="README.zh-CN.md" />
14+
<File Path="README.zh-Hant.md" />
15+
<File Path=".github\workflows\benchmark.yml" />
16+
<File Path=".github\workflows\codeql-analysis.yml" />
17+
<File Path="src\Directory.Build.props" />
18+
<File Path="src\Directory.Packages.props" />
19+
<File Path="miniexcel.publickey" />
20+
<File Path="src\icon.png" />
21+
</Folder>
22+
<Folder Name="/Releases/">
23+
<File Path="docs\README.md" />
24+
<File Path="docs\README.zh-CN.md" />
25+
<File Path="docs\README.zh-Hant.md" />
26+
</Folder>
27+
<Folder Name="/src/">
28+
<Project Path="src\MiniExcel.Core\MiniExcel.Core.csproj" />
29+
<Project Path="src\MiniExcel.Csv\MiniExcel.Csv.csproj" />
30+
<Project Path="src\MiniExcel\MiniExcel.csproj" Type="Classic C#" />
31+
</Folder>
32+
<Folder Name="/tests/">
33+
<Project Path="tests/MiniExcel.Csv.Tests/MiniExcel.Csv.Tests.csproj" />
34+
<Project Path="tests/MiniExcel.Tests.Common/MiniExcel.Tests.Common.csproj" />
35+
<Project Path="tests\MiniExcel.Core.Tests\MiniExcel.Core.Tests.csproj" />
36+
</Folder>
37+
</Solution>

benchmarks/MiniExcel.Benchmarks/BenchmarkBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace MiniExcelLibs.Benchmarks;
1+
namespace MiniExcelLib.Benchmarks;
22

33
public abstract class BenchmarkBase
44
{

benchmarks/MiniExcel.Benchmarks/Config.cs renamed to benchmarks/MiniExcel.Benchmarks/BenchmarkConfig.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
using BenchmarkDotNet.Loggers;
88
using BenchmarkDotNet.Order;
99

10-
namespace MiniExcelLibs.Benchmarks;
10+
namespace MiniExcelLib.Benchmarks;
1111

12-
public class Config : ManualConfig
12+
internal class BenchmarkConfig : ManualConfig
1313
{
1414
private const int Launches = 1;
1515
private const int Warmups = 3;
1616
private const int Unrolls = 3;
1717
private const int Iterations = 3;
1818

19-
public Config()
19+
public static BenchmarkConfig Default => new();
20+
21+
private BenchmarkConfig()
2022
{
2123
AddLogger(ConsoleLogger.Default);
2224

benchmarks/MiniExcel.Benchmarks/BenchmarkSections/CreateXlsxBenchmark.cs renamed to benchmarks/MiniExcel.Benchmarks/BenchmarkSections/CreateExcelBenchmark.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,31 @@
44
using DocumentFormat.OpenXml;
55
using DocumentFormat.OpenXml.Packaging;
66
using DocumentFormat.OpenXml.Spreadsheet;
7-
using MiniExcelLibs.Benchmarks.Utils;
7+
using MiniExcelLib.Benchmarks.Utils;
8+
using MiniExcelLib.Core;
89
using NPOI.XSSF.UserModel;
910
using OfficeOpenXml;
1011

11-
namespace MiniExcelLibs.Benchmarks.BenchmarkSections;
12+
namespace MiniExcelLib.Benchmarks.BenchmarkSections;
1213

13-
public class CreateXlsxBenchmark : BenchmarkBase
14+
public class CreateExcelBenchmark : BenchmarkBase
1415
{
16+
private OpenXmlExporter _exporter;
17+
1518
[GlobalSetup]
1619
public void SetUp()
1720
{
1821
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
1922
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
23+
24+
_exporter = MiniExcel.Exporters.GetOpenXmlExporter();
2025
}
2126

2227
[Benchmark(Description = "MiniExcel Create Xlsx")]
2328
public void MiniExcelCreateTest()
2429
{
2530
using var path = AutoDeletingPath.Create();
26-
MiniExcel.SaveAs(path.FilePath, GetValue());
31+
_exporter.Export(path.FilePath, GetValue());
2732
}
2833

2934
[Benchmark(Description = "ClosedXml Create Xlsx")]
@@ -72,10 +77,9 @@ public void NPOICreateTest()
7277
row.CreateCell(9).SetCellValue(item.Column10);
7378
i++;
7479
}
75-
using (var fs = File.Create(path.FilePath))
76-
{
77-
wb.Write(fs);
78-
}
80+
81+
using var fs = File.Create(path.FilePath);
82+
wb.Write(fs);
7983
}
8084

8185
[Benchmark(Description = "OpenXmlSdk Create Xlsx by DOM mode")]

0 commit comments

Comments
 (0)