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

OSS Gate Workshop: online:2021-10-30: tsutsuji86: YamlDotNet: Work log #1493

Closed
tsutsuji86 opened this issue Oct 30, 2021 · 23 comments
Closed

Comments

@tsutsuji86
Copy link
Contributor

This is a work log of a "OSS Gate workshop".
"OSS Gate workshop" is an activity to increase OSS developers.
Here's been discussed in Japanese. Thanks.

作業ログ作成時の説明

以下のテンプレートを埋めてタイトルに設定します。埋め方例はスクロールすると見えてきます。

OSS Gate Workshop: ${LOCATION}: ${YEAR}-${MONTH}-${DAY}: ${ACCOUNT_NAME}: ${OSS_NAME}: Work log

タイトル例↓:

OSS Gate Workshop: Tokyo: 2017-01-16: kou: Rabbit: Work log

OSS Gateワークショップ関連情報

  • スライド:ワークショップの進行に使っているスライドがあります。
  • チャット:OSS開発に関することならなんでも相談できます。ワークショップが終わった後もオンラインで相談しながら継続的にOSSの開発に参加しましょう!
  • シナリオ:ワークショップの目的・内容・進め方の詳細が書いています。
  • 過去のビギナーの作業ログ:他の人の作業ログから学べることがいろいろあるはずです。
@tsutsuji86
Copy link
Contributor Author

tsutsuji86 commented Oct 30, 2021

YamlDotNeetをやってみようと思います。
https://github.com/aaubry/YamlDotNet
YamlDotNet is a .NET library for YAML

上記ページの上部にMIT Licenseと書かれている。
https://opensource.org/licenses/alphabetical
の一覧の中に「MITライセンス」があるので、これはOSSと思われる。

@tsutsuji86
Copy link
Contributor Author

https://github.com/aaubry/YamlDotNet/wiki/Samples
にあるSampleを実行してみます。

@hata6502
Copy link
Contributor

YamlDotNet にはライセンスファイルが2つあるようです。

  • LICENSE-libyaml
  • LICENSE.txt

念の為 LICENSE-libyaml についても調査すると、安心できそうです。

@tsutsuji86
Copy link
Contributor Author

まずはこちらのサンプルを試してみる。
https://github.com/aaubry/YamlDotNet/wiki/Samples.LoadingAYamlStream

Visual Studio 2019 Communityで新規ソリューションYamlDotNetSampleを作成した。

そこに、C#コンソールの新規プロジェクトとして、Loading a YAML Streamを作成した。

@tsutsuji86
Copy link
Contributor Author

https://github.com/aaubry/YamlDotNet/wiki

上記ページのInstallingには、パッケージマネージャーコンソールでのインストール方法
PM> Install-Package YamlDotNet
が書いてあるが、「NuGetパッケージの管理」を使って、参照から「YamlDotNet」を検索してインストールした。

@tsutsuji86
Copy link
Contributor Author

ちなみに、https://github.com/aaubry/YamlDotNet/wiki/Samples
に掲載されているSampleのコードは、Xunitを介したコンソール出力の例になっており、
私はこれの使い方がよくわかっていないので、一般的なConsole.WriteLineを使う方法で試してみる。

@piroor
Copy link
Contributor

piroor commented Oct 30, 2021

READMEのQuickstartの部分からリンクされている
https://dotnetfiddle.net/CQ7ZKi
を開いてみた。
どういう物かよく分かっていなかったが、ページを開いた時点でもう実行済みの状態になっているということらしい。
コードをリアルタイムで書き換えて「Run」を押すと、下のコンソールの出力内容が変化して、動いていることを確認できた。

@ttyniwa
Copy link

ttyniwa commented Oct 30, 2021

  • 見つけた課題は二つ
    • リポジトリをクローンしてビルドしたらエラーが発生した
      • ライブラリ開発者がする行為なので、敷居は高い
      • でも、エラーが発生せずにコンパイルできたほうが貢献しやすいので、問題が解消できたら報告してあげると喜ばれます
    • wikiのサンプルコードがHelperクラスとXUnit(?)を利用しており、YamlDotNetをインストールしただけではコピペしても動作しない
      • XUnitは一般的なライブラリかもしれないのであったほうがよい可能性はありそう
      • Helperに定義された関数は非常にシンプルなラッパーなので、ないほうが良さそう
  • 結論(午後のTODO)
    • Helperクラスを無しにして、直接 output.WriteLine を呼び出すように書き換えられないかIssueを提案してみる

@tsutsuji86
Copy link
Contributor Author

* リポジトリをクローンしてビルドしたらエラーが発生した
  
  * ライブラリ開発者がする行為なので、敷居は高い
  * でも、エラーが発生せずにコンパイルできたほうが貢献しやすいので、問題が解消できたら報告してあげると喜ばれます

午後ちょっと試したところ、ビルドが通ってSampleのテストも実行することができた。
何がどうなってビルドできるようになったかを確認するため、
もう一度クローニングして再度チャレンジ中。

@tsutsuji86
Copy link
Contributor Author

wikiのサンプルコードがHelperクラスとXUnit(?)を利用しており、YamlDotNetをインストールしただけではコピペしても動作しない

* XUnitは一般的なライブラリかもしれないのであったほうがよい可能性はありそう

* Helperに定義された関数は非常にシンプルなラッパーなので、ないほうが良さそう

開発者の過去のブログをみると当時は、Console.WriteLineを使ったサンプルだった。
https://aaubry.net/pages/yamldotnet.html

@tsutsuji86
Copy link
Contributor Author

* リポジトリをクローンしてビルドしたらエラーが発生した
  
  * ライブラリ開発者がする行為なので、敷居は高い
  * でも、エラーが発生せずにコンパイルできたほうが貢献しやすいので、問題が解消できたら報告してあげると喜ばれます

午後ちょっと試したところ、ビルドが通ってSampleのテストも実行することができた。 何がどうなってビルドできるようになったかを確認するため、 もう一度クローニングして再度チャレンジ中。

どうやらGitHubからクローニングしてできるmasterブランチにあるソリューションファイルではビルドできず、
それよりちょっと進んでいるunity-compatibleブランチをクローニングするとビルドできるようになった。
この2つのブランチは、Unityに関する項目だけの違いのようであるが、
ビルド時に生成されるnetcoreapp3.1のyamlDotNet.dllあたりに問題あるのかも。

@tsutsuji86
Copy link
Contributor Author

README.mdのQuick startにある.NET Fiddleへのリンク先に示されたコードは、
コピペするだけで実行できた。
これは「Serialization from an object to a string」と
「Deserialization from a string to an object」を含む完全な形のコードとなっている。

この例題では、出力に「System.Console.WriteLine();」が使われているので、わかりやすい。

@tsutsuji86
Copy link
Contributor Author

対象OSS: YamlDotNet

Title: masterブランチではビルドできないが、unity-compatibleブランチだとビルドできる

再現手順

  • OS:Windows 10 home
  • ビルド環境:
    Microsoft Visual Studio Community 2019
    Version 16.10.3
  • ビルド手順
    YamlDotNet.gitをクローニングしてできるmasterブランチ(コミット:baa5b66)のソリューションでビルドを行った。

実際に起ったこと

YamlDotNet.gitをクローニングしてできるmasterブランチ(コミット:baa5b66)のソリューションでビルドすると、
YamlDotNetプロジェクトでビルドエラーが発生する。

エラーメッセージ
重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
エラー CS0103 現在のコンテキストに 'RegexOptions' という名前は存在しません YamlDotNet (netcoreapp3.1) D:\Programming\OSS\YamlDotNet\YamlDotNet\Portability\unitysubset3.5\include\StandardRegexOptions.cs 28 アクティブ

unity-compatibleブランチをチェックアウトした場合(コミット:b7d71ec)、
問題なくビルドすることができた。

もしかしたら、unityとの互換性を想定していないmasterブランチでunityに関連する機能を呼び出そうとしているのかもしれない。

期待される結果

masterブランチでも、unity-compatibleブランチと同様にビルドできるとよい。

@tsutsuji86
Copy link
Contributor Author

YamlDotNet にはライセンスファイルが2つあるようです。

* LICENSE-libyaml

* LICENSE.txt

念の為 LICENSE-libyaml についても調査すると、安心できそうです。

2つのファイルの違いは、著作権者の違いのようで、
内容的には同じみたいです。

  • LICENSE-libyaml:Copyright (c) 2006 Kirill Simonov
  • LICENSE.txt:Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Antoine Aubry and contributors

@tsutsuji86
Copy link
Contributor Author

tsutsuji86 commented Nov 9, 2021

対象OSS: YamlDotNet

Title: masterブランチではビルドできないが、unity-compatibleブランチだとビルドできる。

再現手順

実際に起ったこと

YamlDotNet.gitをクローニングしてできるmasterブランチ(コミット:baa5b66)のソリューションでビルドすると、
YamlDotNetプロジェクトでビルドエラーが発生する。

unity-compatibleブランチをチェックアウトした場合(コミット:b7d71ec)、
問題なくビルドすることができた。

2つのコミットを比較したところ、unity-compatibleブランチでは、BuildUtils.UnityPrerequisitesというフォルダにファイルが存在しているのに対して、masterブランチでは、ファイルが存在していないことが分かった。
そこで、unity-compatibleブランチのBuildUtils.UnityPrerequisitesの中身を、masterブランチにコピーしたところ、ビルドすることができた。

また、同様の現象として、masterブランチでは、上記修正によりビルドが通った後に、ユニットテストの実行時にエラーが発生するが、
これは、YamlDotNet.Test\yaml-test-suiteフォルダの中身が不足していることが原因であった。

期待される結果

masterブランチでも、unity-compatibleブランチと同様にビルドでき、ユニットテストもすべてパスできるようになるとよい。

@tsutsuji86
Copy link
Contributor Author

tsutsuji86 commented Nov 9, 2021

Target OSS: YamlDotNet

Title: Can not build in MASTER branch, but can be built in Unity-Compatible branch.

Reproduction procedure

  • OS: Windows 10 Home
  • Build environment:
    Microsoft Visual Studio Community 2019
    Version 16.10.3
  • Build procedure:
    The master branch (commit: BAA5B66) was cloned from https://github.com/yamldotnet.git .
    And then, a solution file (YamlDotNet.sln) in master branch was opened with Visual Studio and builded.

What happened actually

When I build with the solution file of the master branch that can be cloned from git,
A build error occurs in the YamlDotNet project.

On the other hand, when I checked out the Unity-Compatible branch (commit: B7D71EC),
I was able to build without a problem.

Comparing two commits, it was found that the unity-compatible branch has various files in the folder [buildutils.unityPrerequisites], whereas the master branch does not have those files in a same folder.
Therefore, by copying that folder in unity-compatible branch to a master branch, YamlDotNet project was possible to build.

Also, as a similar phenomenon, the master branch causes an error when the unit test is executed after the build passes through the above correction.
This was due to the lack of the contents of the YYamlDotNet.Test\yaml-test-suite folder.

Expected results

master branch may be built as well as unity-compatible branch, and all unit tests may be passed.

@yuseitahara
Copy link
Contributor

yuseitahara commented Nov 10, 2021

細かいことなんですが、コメントします。

Title: Can not build in MASTER branch, but can be built in Unity-Compatible branch.

能動態と受動態を混ぜる必要はないと思います、あとは build master branch でよくで in は要らないです。

あとは実際のブランチ名は小文字の master ですよね?それなら大文字にしなくていいです。

なので、

Title: I can not build master branch, but I can build unity-compatible branch.

でどうでしょうか。

When I build with the solution file of the master branch that can be cloned from git,
A build error occurs in the YamlDotNet project.

もっと単純に書いていいと思います。あとcommitのhash値が大文字で書いてあるのはWindowsだとそういう風に表示されるんでしょうか。

When I tried to bulid with the solution file of the master branch(baa5b66), a build error occured, but I was able to build unity-compatible branch (b7d71ec) without any problems.

(中略) it was found that the unity-compatible branch (略)

普通に能動態で I found でいいと思います。受動態にする必要ないです。

YamlDotNet project was possible to build.

I was able to build it. でいいんじゃないでしょうか。普通に主語は私 I で書けばいいと思いますよ。

Also, as a similar phenomenon,

Also だけでいいと思います。

the master branch causes an error when the unit test is executed after the build passes through the above correction.

unit tests on master branch fail even after I fixed the above bulid problem. (tests と複数形にしてみました。実際にテストが複数あるのかどうか知らないのですが)

Expected results

私の感覚だと result で単数かなと思いました。まあそれは書いている人が何を考えているかを依りますが。
でも、ビルドとテストの二つのことを考えているから、やっぱり複数形のほうがいいですかね。

master branch may be built as well as unity-compatible branch, and all unit tests may be passed.

これは may じゃなくて should のほうがよくないですかね。

master branch should be buildable as well as unity-compatible branch and all unit tests should pass.

こんなんでどうでしょうか。

@yuseitahara
Copy link
Contributor

master branch should be buildable as well as unity-compatible branch and all unit tests should pass.

これについては、そりゃビルドもテストも通ったほうがいいのは当たり前なんですが、shouldで言ってもなんか他のことで忙しい開発者にはキツく聞こえるかもしれません。これらの問題を解決するPRを送れば相手は悪い気はしないんじゃないかと思います。

@yuseitahara
Copy link
Contributor

should だとキツいなあという気が自分で書いておいてなんですが、そう思いますので、そうすると

It would be nice if master branch was buildable as well as unity-compatible branch and all unit tests passed.

と書けばいいかなあと思いました。

@tsutsuji86
Copy link
Contributor Author

Target OSS: YamlDotNet

Title: I can not build master branch, but I can built unity-compatible branch.

Reproduction procedure

  • OS: Windows 10 Home
  • Build environment:
    Microsoft Visual Studio Community 2019
    Version 16.10.3
  • Build procedure:
    The master branch (commit: baa5b66) was cloned from https://github.com/yamldotnet.git .
    And then, a solution file (YamlDotNet.sln) in master branch was opened with Visual Studio and builded.

What happened actually

When I tried to build with the solution file of the master branch (baa5b66), a build error occurred in YamlDotNet project., but I was able to build unity-compatible branch (b7d71ec) without any problems.

Comparing two commits, I found that the unity-compatible branch has various files in the folder [buildutils.unityPrerequisites], whereas the master branch does not have those files in a same folder.
Therefore, by copying that folder in unity-compatible branch to a master branch, I was able to build it.

Also, some unit tests on master branch failed even after I fixed the above build problem.
This was due to the lack of the contents of the YamlDotNet.Test\yaml-test-suite folder.

Expected result

It would be nice if master branch was buildable as well as unity-compatible branch and all unit tests passed.

@tsutsuji86
Copy link
Contributor Author

Tahara様

丁寧な添削と貴重なコメントありがとうございます。
上記のご指摘を反映して書き直しました。

Google翻訳を使った後に、自分なりに添削したつもりだったのですが、
ブランチ名やコミット番号が大文字になっていたところをスルーしていました。

また、技術的な話を書くのに、主語として私(I)を使ってはいけない、とか
受動態で書かなければいけない、とか、
先入観を持っていたようで、どっちつかずな文章になっていました。

お忙しいところ、ご対応いただきありがとうございました。

@piroor
Copy link
Contributor

piroor commented Nov 11, 2021

添削後の報告文面を拝見しました。こちらで問題ないと自分は思いました!

@github-actions
Copy link

おつかれさまでした!

ワークショップの終了にともないissueを閉じますが、このまま作業メモとして使っても構いません 👌

ワークショップの感想を集めています!

ブログなどに書かれた際は、このページへリンクの追加をお願いします 🙏

またの参加をお待ちしています!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants