Skip to content

Commit

Permalink
Updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Sep 2, 2024
1 parent 6c29f73 commit 6a47baf
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
34 changes: 32 additions & 2 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
# Status

[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![NuGet RelaxVersioner (master)](https://img.shields.io/nuget/v/RelaxVersioner.svg?style=flat)](https://www.nuget.org/packages/RelaxVersioner)

|Package|Link|
|:----|:----|
|RelaxVersioner (MSBuild)|[![NuGet RelaxVersioner (MSBuild)](https://img.shields.io/nuget/v/RelaxVersioner.svg?style=flat)](https://www.nuget.org/packages/RelaxVersioner)|
|rv-cli (CLI)|[![NuGet RelaxVersioner (CLI)](https://img.shields.io/nuget/v/rv-cli.svg?style=flat)](https://www.nuget.org/packages/rv-cli)|

## これは何?

Git タグ・ブランチベースの、全自動バージョン情報挿入パッケージです。

* RelaxVersionerのNuGetパッケージをインストールするだけで、Gitのタグ・ブランチ・コミットメッセージだけを使って、バージョン管理が出来ます。つまり、追加のツール操作が不要なため、Gitさえ知っていれば学習コストがほとんどなく、CI環境にも容易に対応できます。
* サポートしている言語と環境は、以下の通りです(恐らく、現在のほとんどの.NET開発環境に適合します):
* C#・F#・VB.NET・C++/CLI、そしてNuGetパッケージング (dotnet cli packコマンド)
* C#・F#・VB.NET・C++/CLI、そしてNuGetパッケージング (dotnet cli packコマンド) とプレーンテキスト
* 全てのターゲットフレームワーク (`net8.0`, `netcoreapp3.1`, `net48`, `net20` や他の全て).
* Visual Studio 2022/2019/2017/2015, Rider, dotnet SDK cli, .NET 8/7/6/5, .NET Core 3.1/2.2 及び .NET Framework 4.6.1 以上の元で動作するMSBuild環境 (注: MSBuildの動作プラットフォームの事です、適用するターゲットフレームワークの事ではありません)、及びこれらを使用する任意のIDE。
* ローカルのGitリポジトリから、自動的にタグ・ブランチの名称を取得し、アセンブリ属性に適用することが出来ます。
Expand Down Expand Up @@ -204,6 +208,23 @@ namespace global

## ヒントや参考情報

### プレーンテキストフォーマットの出力

RelaxVersionerは、dotnet CLI toolに対応しています。
以下のようにCLIコマンドを使用することで、プレーンテキストフォーマットで出力することが出来ます:

```bash
$ rv --outputPath=version.txt .
```

`rv`コマンドは、 `dotnet tool install -g rv-cli` でインストールすることが出来ます。

コマンドのデフォルトのフォーマットはプレーンテキストフォーマットなので、上記のコマンドで出力されるファイルは `1.2.3` のようなバージョンのみ含まれたテキストファイルです。
`--language=C#` のようにオプションを追加すれば、単体のソースコード出力も可能です。

このCLIを使用すれば、.NETとは異なる対象に対してRelaxVersionerを組み合わせて使用できます。
例えば、GitHub ActionsのようなCI/CD環境で、NPMパッケージ生成にバージョンを適用することが出来ます。

### ビルド後にバージョン番号を使用する方法

RelaxVersionerは、ビルド後に、以下の位置にファイルを保存します:
Expand Down Expand Up @@ -367,6 +388,12 @@ nuspecファイルを使ってパッケージを生成する場合は、デフ
``` xml
<?xml version="1.0" encoding="utf-8"?>
<RelaxVersioner version="1.0">
<WriterRules>
<!-- この定義を適用する言語です。 -->
<Language>Text</Language>
<!-- テキストフォーマットでは、ルール名は出力されません。 -->
<Rule name="Text">{versionLabel}</Rule>
</WriterRules>
<WriterRules>
<!-- この定義を適用する言語です。 -->
<Language>C#</Language>
Expand Down Expand Up @@ -460,6 +487,9 @@ nuspecファイルを使ってパッケージを生成する場合は、デフ

## 履歴

* 3.5.0:
* プレーンテキストフォーマットをサポートしました。これを使用して、.NETとは異なる環境に適用できます。
* dotnet CLI toolに対応しました。 `dotnet tool install -g rv-cli` でインストールできます。
* 3.4.0:
* Gitサブモジュール内にプロジェクトが配置されている場合に正しい情報を取得できない問題を修正。
* GitReaderを1.8.0に上げました。
Expand Down
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Git tag/branch based, full-automatic version generator.

* If you use RelaxVersioner, version handling only use with Git tags/branches/commit messages. Of course you only need to install NuGet package and don't need more tooling knowledge, and easy integrates continuous-integration environments.
* Target language/environments (Probably fits most current .NET development environments):
* C#, F#, VB.NET, C++/CLI and NuGet packaging (dotnet cli packer).
* C#, F#, VB.NET, C++/CLI, NuGet packaging (dotnet cli packer) and plain text forms.
* All target frameworks (ALL: `net8.0`, `netcoreapp3.1`, `net48`, `net20` and others).
* Visual Studio 2022/2019/2017/2015, Rider, dotnet SDK cli, MSBuild on .NET 8/7/6/5, .NET Core 3.1/2.2 and .NET Framework 4.6.1 environment (NOT your project target frameworks) and related IDEs.
* Auto collect version information from local Git repository tags/branch name.
Expand Down Expand Up @@ -199,6 +199,23 @@ namespace global

## Hints and Tips

### Output in plain text format

RelaxVersioner supports the dotnet CLI tool.
You can output in plain text format by using the following CLI command:

```bash
$ rv --outputPath=version.txt .
```

The `rv` command can be installed with `dotnet tool install -g rv-cli`.

The default format of the command is plain text format, so the file output by the above command is a text file containing only the version, such as `1.2.3`.
You can add an option like `--language=C#` to output stand-alone source code.

With this CLI, you can use a combination of RelaxVersioner for different targets than .NET.
For example, you can apply versioning to NPM package generation in a CI/CD environment such as GitHub Actions.

### How to use version numbers after building process

RelaxVersioner saves the files in the following location after build:
Expand Down Expand Up @@ -347,6 +364,12 @@ When you are using a nuspec file to generate a NuGet package, there are addition
``` xml
<?xml version="1.0" encoding="utf-8"?>
<RelaxVersioner version="1.0">
<WriterRules>
<!-- Target languages -->
<Language>Text</Language>
<!-- The rule name will not use in text format. -->
<Rule name="Text">{versionLabel}</Rule>
</WriterRules>
<WriterRules>
<!-- Target languages -->
<Language>C#</Language>
Expand Down Expand Up @@ -439,6 +462,9 @@ When you are using a nuspec file to generate a NuGet package, there are addition

## History

* 3.5.0:
* Plain text formatting is now supported. This can be used to apply to different environments than .NET.
* dotnet CLI tool is now supported. It can be installed with `dotnet tool install -g rv-cli`.
* 3.4.0:
* Fixed a problem with getting correct information when a project is placed inside a Git submodule.
* Updated GitReader to 1.8.0.
Expand Down

0 comments on commit 6a47baf

Please sign in to comment.