Skip to content

Commit a2522fb

Browse files
committed
Update documentation for project version computing
1 parent 85b4886 commit a2522fb

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

modules/generate-reference-doc/src/main/scala/scala/cli/doc/GenerateReferenceDoc.scala

+22
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,28 @@ object GenerateReferenceDoc extends CaseApp[InternalDocOptions] {
574574
|```""".stripMargin
575575
)
576576

577+
b.section(
578+
"""## Project version
579+
|
580+
|A part of the BuildInfo object is the project version. By default, an attempt is made to deduce it using git tags
581+
|of the workspace repository. If this fails (e.g. no git repository is present), the version is set to `0.1.0-SNAPSHOT`.
582+
|You can override this behaviour by passing the `--project-version` option to Scala CLI or by using a
583+
|`//> using projectVersion` directive.
584+
|
585+
|Please note that only tags that follow the semantic versioning are taken into consideration.
586+
|
587+
|Values available for project version configuration are:
588+
|- `git:tag` or `git`: use the latest stable git tag, if it is older than HEAD then try to increment it
589+
| and add a suffix `-SNAPSHOT`, if no tag is available then use `0.1.0-SNAPSHOT`
590+
|- `git:dynver`: use the latest (stable or unstable) git tag, if it is older than HEAD then use the output of
591+
| `-{distance from last tag}-g{shortened version of HEAD commit hash}-SNAPSHOT`, if no tag is available then use `0.1.0-SNAPSHOT`
592+
|
593+
|The difference between stable and unstable tags are, that the latter can contain letters, e.g. `v0.1.0-RC1`.
594+
|It is also possible to specify the path to the repository, e.g. `git:tag:../my-repo`, `git:dynver:../my-repo`.
595+
|
596+
|""".stripMargin
597+
)
598+
577599
b.mkString
578600
}
579601

website/docs/commands/publishing/publish.md

+11
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ To override this default value, set the `publish.computeVersion` directive, like
8181
//> using publish.computeVersion git:tag
8282
```
8383

84+
Please note that only tags that follow the semantic versioning are taken into consideration.
85+
86+
Values available for project version configuration are:
87+
- `git:tag` or `git`: use the latest stable git tag, if it is older than HEAD then try to increment it
88+
and add a suffix `-SNAPSHOT`, if no tag is available then use `0.1.0-SNAPSHOT`
89+
- `git:dynver`: use the latest (stable or unstable) git tag, if it is older than HEAD then use the output of
90+
`-{distance from last tag}-g{shortened version of HEAD commit hash}-SNAPSHOT`, if no tag is available then use `0.1.0-SNAPSHOT`
91+
92+
The difference between stable and unstable tags are, that the latter can contain letters, e.g. `v0.1.0-RC1`.
93+
It is also possible to specify the path to the repository, e.g. `git:tag:../my-repo`, `git:dynver:../my-repo`.
94+
8495
## Repository settings
8596

8697
A repository is required for the `publish` command, and might need other settings to work fine

website/docs/reference/build-info.md

+20
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,23 @@ object BuildInfo {
9090
}
9191
```
9292

93+
## Project version
94+
95+
A part of the BuildInfo object is the project version. By default, an attempt is made to deduce it using git tags
96+
of the workspace repository. If this fails (e.g. no git repository is present), the version is set to `0.1.0-SNAPSHOT`.
97+
You can override this behaviour by passing the `--project-version` option to Scala CLI or by using a
98+
`//> using projectVersion` directive.
99+
100+
Please note that only tags that follow the semantic versioning are taken into consideration.
101+
102+
Values available for project version configuration are:
103+
- `git:tag` or `git`: use the latest stable git tag, if it is older than HEAD then try to increment it
104+
and add a suffix `-SNAPSHOT`, if no tag is available then use `0.1.0-SNAPSHOT`
105+
- `git:dynver`: use the latest (stable or unstable) git tag, if it is older than HEAD then use the output of
106+
`-{distance from last tag}-g{shortened version of HEAD commit hash}-SNAPSHOT`, if no tag is available then use `0.1.0-SNAPSHOT`
107+
108+
The difference between stable and unstable tags are, that the latter can contain letters, e.g. `v0.1.0-RC1`.
109+
It is also possible to specify the path to the repository, e.g. `git:tag:../my-repo`, `git:dynver:../my-repo`.
110+
111+
112+

0 commit comments

Comments
 (0)