From 3f377f68268c211016ed9a9a9356ca738ae7aa8a Mon Sep 17 00:00:00 2001 From: k1mlka Date: Mon, 29 May 2023 09:59:59 +0900 Subject: [PATCH 1/5] AppContext instead of Assembly --- MeCab.DotNet/MeCabParam.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MeCab.DotNet/MeCabParam.cs b/MeCab.DotNet/MeCabParam.cs index b166861..cc66633 100644 --- a/MeCab.DotNet/MeCabParam.cs +++ b/MeCab.DotNet/MeCabParam.cs @@ -87,8 +87,7 @@ public MeCabParam() #if !NETSTANDARD1_3 // In unit test context, the current folder path is set unstable. - var assemblyFolderPath = Path.GetDirectoryName( - this.GetType().Assembly.Location); + var assemblyFolderPath = AppContext.BaseDirectory; var inPackagePath = CombinePath(assemblyFolderPath!, "..", "InPackage"); var dicdir = File.Exists(inPackagePath) ? CombinePath(assemblyFolderPath, "..", "..", "content", "dic") : From fa03a3c0462224e0155111f61dad597594a3f0b3 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sat, 3 Jun 2023 14:33:44 +0900 Subject: [PATCH 2/5] Made compatibility on .NET Framework. --- MeCab.DotNet/MeCabParam.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MeCab.DotNet/MeCabParam.cs b/MeCab.DotNet/MeCabParam.cs index cc66633..883b46c 100644 --- a/MeCab.DotNet/MeCabParam.cs +++ b/MeCab.DotNet/MeCabParam.cs @@ -87,7 +87,12 @@ public MeCabParam() #if !NETSTANDARD1_3 // In unit test context, the current folder path is set unstable. +#if NETFRAMEWORK + var assemblyFolderPath = Path.GetDirectoryName( + this.GetType().Assembly.Location); +#else var assemblyFolderPath = AppContext.BaseDirectory; +#endif var inPackagePath = CombinePath(assemblyFolderPath!, "..", "InPackage"); var dicdir = File.Exists(inPackagePath) ? CombinePath(assemblyFolderPath, "..", "..", "content", "dic") : From d63a8e8eaecf1233484dcf933cef92fbbde6f4cd Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sat, 3 Jun 2023 14:34:05 +0900 Subject: [PATCH 3/5] Adjusted warnings. --- MeCab.DotNet/MeCab.DotNet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MeCab.DotNet/MeCab.DotNet.csproj b/MeCab.DotNet/MeCab.DotNet.csproj index 9a61f1d..b60b79f 100644 --- a/MeCab.DotNet/MeCab.DotNet.csproj +++ b/MeCab.DotNet/MeCab.DotNet.csproj @@ -10,7 +10,7 @@ latest true bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - 1591,1572,1573 + $(NoWarn);1591;1572;1573;NETSDK1138;NU1803 https://github.com/kekyo/MeCab.DotNet.git git From d3f65978b067feb736f20676eeb4a768d87f6cf7 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sat, 3 Jun 2023 15:35:22 +0900 Subject: [PATCH 4/5] Adjusted package versions. --- .github/workflows/build.yml | 84 +++++++++++++++---- Directory.Build.props | 60 +++++++++++++ MeCab.DotNet.Tests/MeCab.DotNet.Tests.csproj | 15 +--- MeCab.DotNet.sln | 9 +- MeCab.DotNet/Extension/FeatureExtension.cs | 2 +- .../IpaDic/IpaDicFeatureExtension.cs | 2 +- .../UniDic/UniDicFeatureExtension.cs | 2 +- MeCab.DotNet/MeCab.DotNet.csproj | 37 +------- MeCab.DotNet/MeCabParam.cs | 40 +++++---- MeCab.DotNet/MeCabTagger.cs | 1 + PerformanceTest/PerformanceTest.csproj | 2 +- README.ja.md | 15 ++-- README.md | 15 ++-- WindowsFormsSample/WindowsFormsSample.csproj | 7 +- build-nupkg.bat | 10 ++- build-nupkg.sh | 13 +-- 16 files changed, 206 insertions(+), 108 deletions(-) create mode 100644 Directory.Build.props diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8e01dc..c8db315 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,35 +1,87 @@ name: .NET -on: [push, pull_request, workflow_dispatch] +on: [push] jobs: build: + runs-on: ubuntu-latest + steps: - runs-on: windows-latest + #----------------------------------------------------------------------- + # Checkout - steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Setup .NET Core 2.1 + # lfs: true + #- name: Checkout LFS objects + # run: git lfs checkout + + - name: Extract branch name + id: extract_branch_name + run: | + export branch_name=`git name-rev --name-only --exclude=tags/* HEAD` + echo "Detected current branch: ${branch_name}" + echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT + + #----------------------------------------------------------------------- + # Setup environments + + - name: Setup .NET 2.2 uses: actions/setup-dotnet@v1 with: - dotnet-version: 2.1.811 - - name: Setup .NET Core 3.1 + dotnet-version: 2.2.* + - name: Setup .NET 3.1 uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.404 + dotnet-version: 3.1.* - name: Setup .NET 5 uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.100 - - name: Install dependencies - run: dotnet restore MeCab.Dotnet/MeCab.Dotnet.csproj - - name: Install dependencies (Tests) - run: dotnet restore MeCab.Dotnet.Tests/MeCab.Dotnet.Tests.csproj + dotnet-version: 5.0.* + - name: Setup .NET 6 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.* + - name: Setup .NET 7 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.* + + - name: Setup NuGet package reference + run: | +# dotnet nuget add source ${{secrets.GH_LOCAL_NUGET_URL}} -n ref1 -u ${{secrets.GH_LOCAL_NUGET_USER}} -p ${{secrets.GH_LOCAL_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config +# dotnet nuget add source ${{secrets.GH_NUGET_URL}} -n ref2 -u ${{secrets.GH_NUGET_USER}} -p ${{secrets.GH_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config + + #----------------------------------------------------------------------- + # Build + + - name: NuGet restore + run: dotnet restore -p:Configuration=Release MeCab.DotNet.sln + - name: Build - run: dotnet build --configuration Release --no-restore MeCab.Dotnet/MeCab.Dotnet.csproj - - name: Build (Test) - run: dotnet build --configuration Release --no-restore MeCab.Dotnet.Tests/MeCab.Dotnet.Tests.csproj + run: dotnet build -p:Configuration=Release -p:BuildIdentifier=${GITHUB_RUN_NUMBER} MeCab.DotNet.sln + + - name: Build NuGet packages + run: dotnet pack -p:Configuration=Release -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts MeCab.DotNet.sln + + #----------------------------------------------------------------------- + # Test + - name: Test - run: dotnet test --no-restore --verbosity normal MeCab.Dotnet.Tests/MeCab.Dotnet.Tests.csproj + run: dotnet test --no-restore --verbosity normal -p:CITest=True MeCab.DotNet.sln + timeout-minutes: 10 + + #----------------------------------------------------------------------- + # Deploy packages (develop) + + #- name: Deploy NuGet package (develop/ref1) + # if: startsWith( github.ref, 'refs/tags/' ) + # run: dotnet nuget push artifacts/MeCab.DotNet.*.nupkg --source ref1 + + #----------------------------------------------------------------------- + # Deploy packages (main) + + #- name: Deploy NuGet package (main/ref2) + # if: (startsWith( github.ref, 'refs/tags/' )) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'main')) + # run: dotnet nuget push artifacts/MeCab.DotNet.*.nupkg --source ref1 diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..e049c7d --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,60 @@ + + + + latest + AnyCPU + + true + true + false + false + true + git + https://github.com/kekyo/MeCab.DotNet.git + false + + MeCab + false + true + $(NoWarn);CS1570;CS1572;CS1573;CS1591;CA1416;CS8981 + + MeCab.DotNet + MeCab.DotNet + Copyright (c) 2001-2008, Taku Kudo; Copyright (c) 2004-2008, Nippon Telegraph and Telephone Corporation; Copyright (c) 2015 Tsuyoshi Komuta; Portions Copyright (c) 2019-2021 Kouji Matsui + + MeCab.DotNet - Morphological analysis engine for .NET 7,6,5, .NET Core and .NET Frameworks managed library. + Nippon Telegraph and Telephone Corporation + Taku Kudo; Tsuyoshi Komuta; Kouji Matsui (@kozy_kekyo) + GPL-2.0-only OR LGPL-2.1-only + https://github.com/kekyo/MeCab.DotNet.git + MeCab.DotNet-100.png + mecab;morphological;analysis + .pdb + $(NoWarn);NU1605;NU1701;NU1803 + + + + portable + false + false + false + + + + embedded + true + true + true + + + + + + + + + + + + + diff --git a/MeCab.DotNet.Tests/MeCab.DotNet.Tests.csproj b/MeCab.DotNet.Tests/MeCab.DotNet.Tests.csproj index 9b769ac..326d972 100644 --- a/MeCab.DotNet.Tests/MeCab.DotNet.Tests.csproj +++ b/MeCab.DotNet.Tests/MeCab.DotNet.Tests.csproj @@ -1,20 +1,13 @@  - net45;netcoreapp2.1;net5.0 - MeCab - - portable - true - AnyCPU - latest + net48;net6.0 - - - - + + + diff --git a/MeCab.DotNet.sln b/MeCab.DotNet.sln index 924fbe8..c8c4463 100644 --- a/MeCab.DotNet.sln +++ b/MeCab.DotNet.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29326.143 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeCab.DotNet", "MeCab.DotNet\MeCab.DotNet.csproj", "{3EE156E1-FEDE-4EC5-B64A-3287EC3AB2E3}" EndProject @@ -16,13 +16,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitignore = .gitignore BSD = BSD build-nupkg.bat = build-nupkg.bat + build-nupkg.sh = build-nupkg.sh + .github\workflows\build.yml = .github\workflows\build.yml COPYING = COPYING + Directory.Build.props = Directory.Build.props LGPL = LGPL LICENSE = LICENSE README.ja.md = README.ja.md README.md = README.md - .github\workflows\build.yml = .github\workflows\build.yml - build-nupkg.sh = build-nupkg.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Images", "Images", "{13615BDE-BA2F-41A8-9A75-EEBF5CA290C9}" diff --git a/MeCab.DotNet/Extension/FeatureExtension.cs b/MeCab.DotNet/Extension/FeatureExtension.cs index e760b0c..f393822 100644 --- a/MeCab.DotNet/Extension/FeatureExtension.cs +++ b/MeCab.DotNet/Extension/FeatureExtension.cs @@ -1,4 +1,4 @@ -#if NET35 || NET40 || NET45 || NETSTANDARD1_3 || NETSTANDARD2_0 || NETSTANDARD2_1 || NET5_0 +#if !NET20 using MeCab; using System; using System.Collections.Generic; diff --git a/MeCab.DotNet/Extension/IpaDic/IpaDicFeatureExtension.cs b/MeCab.DotNet/Extension/IpaDic/IpaDicFeatureExtension.cs index 5da6a82..ce42c3a 100644 --- a/MeCab.DotNet/Extension/IpaDic/IpaDicFeatureExtension.cs +++ b/MeCab.DotNet/Extension/IpaDic/IpaDicFeatureExtension.cs @@ -1,4 +1,4 @@ -#if NET35 || NET40 || NET45 || NETSTANDARD1_3 || NETSTANDARD2_0 || NETSTANDARD2_1 || NET5_0 +#if !NET20 using MeCab; using System; using System.Collections.Generic; diff --git a/MeCab.DotNet/Extension/UniDic/UniDicFeatureExtension.cs b/MeCab.DotNet/Extension/UniDic/UniDicFeatureExtension.cs index 504031b..e2a54ee 100644 --- a/MeCab.DotNet/Extension/UniDic/UniDicFeatureExtension.cs +++ b/MeCab.DotNet/Extension/UniDic/UniDicFeatureExtension.cs @@ -1,4 +1,4 @@ -#if NET35 || NET40 || NET45 || NETSTANDARD1_3 || NETSTANDARD2_0 || NETSTANDARD2_1 || NET5_0 +#if !NET20 using MeCab; using System; using System.Collections.Generic; diff --git a/MeCab.DotNet/MeCab.DotNet.csproj b/MeCab.DotNet/MeCab.DotNet.csproj index b60b79f..62b4b2e 100644 --- a/MeCab.DotNet/MeCab.DotNet.csproj +++ b/MeCab.DotNet/MeCab.DotNet.csproj @@ -1,46 +1,15 @@  - net20;net35;net40-client;net45;netstandard1.3;netstandard2.0;netstandard2.1;net5.0 - MeCab - - portable - true - AnyCPU - latest + net20;net35;net40-client;net45;net461;net48;net481;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net5.0;net6.0;net7.0 true bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - $(NoWarn);1591;1572;1573;NETSDK1138;NU1803 - https://github.com/kekyo/MeCab.DotNet.git - git + true MeCab.DotNet - MeCab.DotNet - Morphological analysis engine for .NET 5, .NET Core 1/2/3 and .NET Frameworks managed library. - MeCab.DotNet - MeCab.DotNet - Copyright (c) 2001-2008, Taku Kudo; Copyright (c) 2004-2008, Nippon Telegraph and Telephone Corporation; Copyright (c) 2015 Tsuyoshi Komuta; Portions Copyright (c) 2019-2021 Kouji Matsui - MeCab.DotNet - Morphological analysis engine for .NET 5, .NET Core 1/2/3 and .NET Frameworks managed library. - Nippon Telegraph and Telephone Corporation - Taku Kudo; Tsuyoshi Komuta; Kouji Matsui (@kozy_kekyo) - GPL-2.0-only OR LGPL-2.1-only - https://github.com/kekyo/MeCab.DotNet.git - MeCab.DotNet-100.png - mecab;morphological;analysis - .pdb + MeCab.DotNet - Morphological analysis engine for .NET 7,6,5, .NET Core and .NET Frameworks managed library. - - - - - - - - - - - - diff --git a/MeCab.DotNet/MeCabParam.cs b/MeCab.DotNet/MeCabParam.cs index 883b46c..9c85c00 100644 --- a/MeCab.DotNet/MeCabParam.cs +++ b/MeCab.DotNet/MeCabParam.cs @@ -67,7 +67,16 @@ public class MeCabParam public string RcFile { get; set; } -#if NETSTANDARD1_3 +#if !NETSTANDARD1_3 + /// + /// コンストラクタ + /// + public MeCabParam() : + this(null) + { + } +#endif + /// /// コンストラクタ /// @@ -75,29 +84,28 @@ public class MeCabParam /// netstandard1.3では、デフォルトのdicフォルダパスを自動的に構成できないため、 /// 引数に指定する必要があります。 public MeCabParam(string dicdir) -#else - /// - /// コンストラクタ - /// - public MeCabParam() -#endif { this.Theta = MeCabParam.DefaultTheta; this.RcFile = MeCabParam.DefaultRcFile; -#if !NETSTANDARD1_3 - // In unit test context, the current folder path is set unstable. + if (dicdir == null) + { +#if NETSTANDARD1_3 + throw new ArgumentNullException(); +#else + // In unit test context, the current folder path is set unstable. #if NETFRAMEWORK - var assemblyFolderPath = Path.GetDirectoryName( - this.GetType().Assembly.Location); + var assemblyFolderPath = Path.GetDirectoryName( + this.GetType().Assembly.Location); #else - var assemblyFolderPath = AppContext.BaseDirectory; + var assemblyFolderPath = AppContext.BaseDirectory; #endif - var inPackagePath = CombinePath(assemblyFolderPath!, "..", "InPackage"); - var dicdir = File.Exists(inPackagePath) ? - CombinePath(assemblyFolderPath, "..", "..", "content", "dic") : - CombinePath(assemblyFolderPath, "dic"); + var inPackagePath = CombinePath(assemblyFolderPath!, "..", "InPackage"); + dicdir = File.Exists(inPackagePath) ? + CombinePath(assemblyFolderPath, "..", "..", "content", "dic") : + CombinePath(assemblyFolderPath, "dic"); #endif + } this.DicDir = dicdir; this.UserDic = new string[0]; diff --git a/MeCab.DotNet/MeCabTagger.cs b/MeCab.DotNet/MeCabTagger.cs index a1b5e06..1527f29 100644 --- a/MeCab.DotNet/MeCabTagger.cs +++ b/MeCab.DotNet/MeCabTagger.cs @@ -208,6 +208,7 @@ public unsafe IEnumerable ParseNBestToNode(string str) /// 解析を行い結果を確からしいものから順番に取得する /// /// 解析対象の文字列へのポインタ + /// /// 文頭の形態素を確からしい順に取得するための列挙子の公開 public unsafe IEnumerable ParseNBestToNode(char* str, int len) { diff --git a/PerformanceTest/PerformanceTest.csproj b/PerformanceTest/PerformanceTest.csproj index d352e3c..8c07c6d 100644 --- a/PerformanceTest/PerformanceTest.csproj +++ b/PerformanceTest/PerformanceTest.csproj @@ -2,7 +2,7 @@ Exe - net45;netcoreapp3.1;net5.0 + net48;net6.0 LibNMeCabTest portable diff --git a/README.ja.md b/README.ja.md index 7e6a5ef..da7660c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,6 +1,6 @@ # MeCab.DotNet -日本語形態素解析エンジン for .NET Core. +日本語形態素解析エンジン for .NET 7,6,5, .NET Core and .NET Framework. ![MeCab.DotNet](Images/MeCab.DotNet-120.png) @@ -16,7 +16,7 @@ NOTE: 将来的に、MeCab.DotNetとNMeCabを統合する作業をしていま ["NMeCab"](https://ja.osdn.net/projects/nmecab/) は、上記MeCabを、.NET Framework 2.0のマネージライブラリとして実装し直したものです。ただ、もう更新されていないようです... --> [GitHubで復活しました](https://github.com/komutan/NMeCab) -"MeCab.DotNet" (このプロジェクト)は、上記NMeCabを最新の.NET Core 1/2/3と.NET Frameworkで使えるように移植し、NuGetのパッケージに固めて使いやすくしたものです。 +"MeCab.DotNet" (このプロジェクト)は、上記NMeCabを最新の.NET 7,6,5, .NET Coreと.NET Frameworkで使えるように移植し、NuGetのパッケージに固めて使いやすくしたものです。 形態素解析とは、任意の日本語の文書を入力として、その文字や単語が日本語文法的に何であるのかを解析するというものです。これを使うと、自由に書かれた日本語の文脈に沿って、文書文字列を機械的に解析することが出来るようになります。 サンプルコードを参照すれば、おおよその使い方が理解できると思います。 @@ -24,17 +24,21 @@ NOTE: 将来的に、MeCab.DotNetとNMeCabを統合する作業をしていま # 使い方 MeCab.DotNetのターゲットプラットフォームです: -* .NET 5 -* .NET Core 1/2/3 (実際には.NET Standard 1.3/2.0/2.1に適合します) -* .NET Framework 2.0/3.5/4.0/4.5 (3.5と4.0はClient profile, 2.0は拡張メソッドは非対応) + +* .NET 7, 6, 5 +* .NET Core 3.1 to 2.0 +* .NET Standard 2.1 to 1.3 +* .NET Framework 4.8.1 to 2.0 (3.5と4.0はClient profile, 2.0は拡張メソッドは非対応) NMeCabからの変更点: + * より幅広いプラットフォームに対応し、PCLは切り捨て。 * 名前空間の競合を避けるため、`NMeCab`を`MeCab`に変えています。 * App.configベースの構成を削除 (辞書フォルダ指定などが必要な場合は、`MeCabParam`クラスを使用します) * 若干のユーティリティメソッドの追加。 導入の方法: + 1. [NuGetから"MeCab.DotNet"をインストール](https://www.nuget.org/packages/MeCab.DotNet). 2. 大抵の場合、デフォルトのIPADICという辞書(自動的に`dic`フォルダに追加されます)を使って、無難な解析を行うことが出来ます(つまり、辞書ファイルについて何もしなくてもOK)。しかし、もしカスタムの辞書を使いたい場合は、csproj内の`PropertyGroup`に、`MeCabUseDefaultDictionary`を追加してその値を`False`にしてください。カスタム辞書を`dic`フォルダに追加して使用できるようになります。 3. ビルドして実行します! @@ -119,4 +123,5 @@ let main argv = ``` # ライセンス + GPL2またはLGPL2.1です(NMeCabプロジェクトから引き継いでいます)。 diff --git a/README.md b/README.md index 8145acf..b9f589e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MeCab.DotNet -A Japanese language morphological analysis engine for .NET Core. +A Japanese language morphological analysis engine for .NET 7,6,5, .NET Core and .NET Framework. ![MeCab.DotNet](Images/MeCab.DotNet-120.png) @@ -16,22 +16,26 @@ NOTE: We will merge both MeCab.DotNet and NMeCab in future release. [See related ["NMeCab"](https://ja.osdn.net/projects/nmecab/) is a re-implementation of MeCab engine on .NET Framework 2.0 managed library, but didn't update long time (looks like suspended...) --> [Revived here (GitHub)](https://github.com/komutan/NMeCab) -"MeCab.DotNet" (this project) is a ported of NMeCab on .NET Core 1/2/3 and .NET Frameworks and packed into NuGet format. +"MeCab.DotNet" (this project) is a ported of NMeCab on .NET, .NET Core and .NET Frameworks and packed into NuGet format. # How to use MeCab.DotNet targetted platforms: -* .NET 5 -* .NET Core 1/2/3 (Built on .NET Standard 1.3/2.0/2.1) -* .NET Framework 2.0/3.5/4.0/4.5 (3.5 and 4.0 are Client profile, 2.0 doesn't include extension methods) + +* .NET 7, 6, 5 +* .NET Core 3.1 to 2.0 +* .NET Standard 2.1 to 1.3 +* .NET Framework 4.8.1 to 2.0 (3.5 and 4.0 are Client profile, 2.0 doesn't include extension methods) Changed from NMeCab: + * Wider .NET platform supporting and deprecated PCL libraries. * Changed namespace `NMeCab` to `MeCab`. * Removed App.config based configuration (You can only use `MeCabParam` for additional configuration parameters.) * Added more usable methods. Enabling steps: + 1. [Install from NuGet named "MeCab.DotNet"](https://www.nuget.org/packages/MeCab.DotNet). 2. Usually you'll use default dictionary named IPADIC, the package will append `dic` folder into your project automatically. But have to declare `MeCabUseDefaultDictionary` property and set value to `False` inside `PropertyGroup` in csproj if you wanna use your own dictionary. 3. Build and run! @@ -116,4 +120,5 @@ let main argv = ``` # License + Under GPL2, LGPL2.1 derived from NMeCab project. diff --git a/WindowsFormsSample/WindowsFormsSample.csproj b/WindowsFormsSample/WindowsFormsSample.csproj index a309d08..255eee7 100644 --- a/WindowsFormsSample/WindowsFormsSample.csproj +++ b/WindowsFormsSample/WindowsFormsSample.csproj @@ -2,13 +2,8 @@ Exe - net45;netcoreapp3.1;net5.0-windows + net48;net6.0-windows true - - portable - true - AnyCPU - latest diff --git a/build-nupkg.bat b/build-nupkg.bat index c356b1e..1327f29 100644 --- a/build-nupkg.bat +++ b/build-nupkg.bat @@ -1,3 +1,9 @@ @echo off -rem dotnet pack -p:Configuration=Release -o artifacts MeCab.DotNet\MeCab.DotNet.csproj -msbuild -t:pack -p:Configuration=Release -p:PackageOutputPath=..\artifacts MeCab.DotNet\MeCab.DotNet.csproj + +echo. +echo "===========================================================" +echo "Build MeCab.DotNet" +echo. + +dotnet build -p:Configuration=Release MeCab.DotNet.sln +dotnet pack -p:Configuration=Release -o artifacts MeCab.DotNet.sln diff --git a/build-nupkg.sh b/build-nupkg.sh index a54d0f1..ef5bf5a 100755 --- a/build-nupkg.sh +++ b/build-nupkg.sh @@ -1,6 +1,9 @@ -#!/bin/sh +#!/bin/bash -dotnet clean -c Release -p:Platform="Any CPU" MeCab.DotNet/MeCab.DotNet.csproj -dotnet restore MeCab.DotNet/MeCab.DotNet.csproj -dotnet build -c Release -p:Platform="Any CPU" MeCab.DotNet/MeCab.DotNet.csproj -dotnet pack -p:Configuration=Release -p:Platform=AnyCPU -o artifacts MeCab.DotNet/MeCab.DotNet.csproj +echo "" +echo "===========================================================" +echo "Build MeCab.DotNet" +echo "" + +dotnet build -p:Configuration=Release MeCab.DotNet.sln +dotnet pack -p:Configuration=Release -o artifacts MeCab.DotNet.sln From e72381169d8522e89874ab1d69f70ed244f7627e Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sat, 3 Jun 2023 16:19:46 +0900 Subject: [PATCH 5/5] Switched GA host to windows. --- .github/workflows/build.yml | 6 ++-- MeCab.DotNet.sln | 30 +++++++++++-------- .../PerformanceTest}/PerformanceTest.csproj | 8 +---- .../PerformanceTest}/Program.cs | 0 .../PerformanceTest}/kokoro.txt | 0 .../WindowsFormsSample}/Form1.Designer.cs | 0 .../WindowsFormsSample}/Form1.cs | 0 .../WindowsFormsSample}/Form1.resx | 0 .../WindowsFormsSample}/Program.cs | 0 .../WindowsFormsSample.csproj | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) rename {PerformanceTest => samples/PerformanceTest}/PerformanceTest.csproj (53%) rename {PerformanceTest => samples/PerformanceTest}/Program.cs (100%) rename {PerformanceTest => samples/PerformanceTest}/kokoro.txt (100%) rename {WindowsFormsSample => samples/WindowsFormsSample}/Form1.Designer.cs (100%) rename {WindowsFormsSample => samples/WindowsFormsSample}/Form1.cs (100%) rename {WindowsFormsSample => samples/WindowsFormsSample}/Form1.resx (100%) rename {WindowsFormsSample => samples/WindowsFormsSample}/Program.cs (100%) rename {WindowsFormsSample => samples/WindowsFormsSample}/WindowsFormsSample.csproj (78%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8db315..da0e949 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push] jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest steps: #----------------------------------------------------------------------- @@ -20,9 +20,9 @@ jobs: - name: Extract branch name id: extract_branch_name run: | - export branch_name=`git name-rev --name-only --exclude=tags/* HEAD` + $branch_name=$(git name-rev --name-only --exclude=tags/* HEAD) echo "Detected current branch: ${branch_name}" - echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT + echo "::set-output name=branch_name::${branch_name}" #----------------------------------------------------------------------- # Setup environments diff --git a/MeCab.DotNet.sln b/MeCab.DotNet.sln index c8c4463..a2c3498 100644 --- a/MeCab.DotNet.sln +++ b/MeCab.DotNet.sln @@ -5,10 +5,6 @@ VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeCab.DotNet", "MeCab.DotNet\MeCab.DotNet.csproj", "{3EE156E1-FEDE-4EC5-B64A-3287EC3AB2E3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsFormsSample", "WindowsFormsSample\WindowsFormsSample.csproj", "{BAB9F854-1C9A-4BF6-83C0-DE3F516547E1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerformanceTest", "PerformanceTest\PerformanceTest.csproj", "{5BF64AE2-E2D4-40E4-BBCC-2F185717AA25}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeCab.DotNet.Tests", "MeCab.DotNet.Tests\MeCab.DotNet.Tests.csproj", "{59B69A5D-B54E-4659-9CD6-502FCD7B0881}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{322FBF2B-4698-4887-9578-C70080C96E05}" @@ -34,6 +30,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Images", "Images", "{13615B Images\README.md = Images\README.md EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{A535BFA3-6093-4330-BB1C-DE1FCD23264F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerformanceTest", "samples\PerformanceTest\PerformanceTest.csproj", "{1ED95223-6D45-41A1-915A-01FE18A44DCC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsFormsSample", "samples\WindowsFormsSample\WindowsFormsSample.csproj", "{BFD819A2-DEE0-4677-B4FA-A06089ECBA96}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -44,22 +46,26 @@ Global {3EE156E1-FEDE-4EC5-B64A-3287EC3AB2E3}.Debug|Any CPU.Build.0 = Debug|Any CPU {3EE156E1-FEDE-4EC5-B64A-3287EC3AB2E3}.Release|Any CPU.ActiveCfg = Release|Any CPU {3EE156E1-FEDE-4EC5-B64A-3287EC3AB2E3}.Release|Any CPU.Build.0 = Release|Any CPU - {BAB9F854-1C9A-4BF6-83C0-DE3F516547E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BAB9F854-1C9A-4BF6-83C0-DE3F516547E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BAB9F854-1C9A-4BF6-83C0-DE3F516547E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BAB9F854-1C9A-4BF6-83C0-DE3F516547E1}.Release|Any CPU.Build.0 = Release|Any CPU - {5BF64AE2-E2D4-40E4-BBCC-2F185717AA25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5BF64AE2-E2D4-40E4-BBCC-2F185717AA25}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5BF64AE2-E2D4-40E4-BBCC-2F185717AA25}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5BF64AE2-E2D4-40E4-BBCC-2F185717AA25}.Release|Any CPU.Build.0 = Release|Any CPU {59B69A5D-B54E-4659-9CD6-502FCD7B0881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59B69A5D-B54E-4659-9CD6-502FCD7B0881}.Debug|Any CPU.Build.0 = Debug|Any CPU {59B69A5D-B54E-4659-9CD6-502FCD7B0881}.Release|Any CPU.ActiveCfg = Release|Any CPU {59B69A5D-B54E-4659-9CD6-502FCD7B0881}.Release|Any CPU.Build.0 = Release|Any CPU + {1ED95223-6D45-41A1-915A-01FE18A44DCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1ED95223-6D45-41A1-915A-01FE18A44DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1ED95223-6D45-41A1-915A-01FE18A44DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1ED95223-6D45-41A1-915A-01FE18A44DCC}.Release|Any CPU.Build.0 = Release|Any CPU + {BFD819A2-DEE0-4677-B4FA-A06089ECBA96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BFD819A2-DEE0-4677-B4FA-A06089ECBA96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BFD819A2-DEE0-4677-B4FA-A06089ECBA96}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BFD819A2-DEE0-4677-B4FA-A06089ECBA96}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {1ED95223-6D45-41A1-915A-01FE18A44DCC} = {A535BFA3-6093-4330-BB1C-DE1FCD23264F} + {BFD819A2-DEE0-4677-B4FA-A06089ECBA96} = {A535BFA3-6093-4330-BB1C-DE1FCD23264F} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {1FAB0102-E077-48E3-A3EE-943C2750F25A} EndGlobalSection diff --git a/PerformanceTest/PerformanceTest.csproj b/samples/PerformanceTest/PerformanceTest.csproj similarity index 53% rename from PerformanceTest/PerformanceTest.csproj rename to samples/PerformanceTest/PerformanceTest.csproj index 8c07c6d..0defd06 100644 --- a/PerformanceTest/PerformanceTest.csproj +++ b/samples/PerformanceTest/PerformanceTest.csproj @@ -3,16 +3,10 @@ Exe net48;net6.0 - LibNMeCabTest - - portable - true - AnyCPU - latest - + diff --git a/PerformanceTest/Program.cs b/samples/PerformanceTest/Program.cs similarity index 100% rename from PerformanceTest/Program.cs rename to samples/PerformanceTest/Program.cs diff --git a/PerformanceTest/kokoro.txt b/samples/PerformanceTest/kokoro.txt similarity index 100% rename from PerformanceTest/kokoro.txt rename to samples/PerformanceTest/kokoro.txt diff --git a/WindowsFormsSample/Form1.Designer.cs b/samples/WindowsFormsSample/Form1.Designer.cs similarity index 100% rename from WindowsFormsSample/Form1.Designer.cs rename to samples/WindowsFormsSample/Form1.Designer.cs diff --git a/WindowsFormsSample/Form1.cs b/samples/WindowsFormsSample/Form1.cs similarity index 100% rename from WindowsFormsSample/Form1.cs rename to samples/WindowsFormsSample/Form1.cs diff --git a/WindowsFormsSample/Form1.resx b/samples/WindowsFormsSample/Form1.resx similarity index 100% rename from WindowsFormsSample/Form1.resx rename to samples/WindowsFormsSample/Form1.resx diff --git a/WindowsFormsSample/Program.cs b/samples/WindowsFormsSample/Program.cs similarity index 100% rename from WindowsFormsSample/Program.cs rename to samples/WindowsFormsSample/Program.cs diff --git a/WindowsFormsSample/WindowsFormsSample.csproj b/samples/WindowsFormsSample/WindowsFormsSample.csproj similarity index 78% rename from WindowsFormsSample/WindowsFormsSample.csproj rename to samples/WindowsFormsSample/WindowsFormsSample.csproj index 255eee7..5e23eed 100644 --- a/WindowsFormsSample/WindowsFormsSample.csproj +++ b/samples/WindowsFormsSample/WindowsFormsSample.csproj @@ -7,7 +7,7 @@ - +