A version object for C Thing Software projects. This is a semantic version with additional build identification information. The additional information indicates the build type and whether the build is being performed by the C Thing Software Continuous Integration service or on a developer's machine. The following versioning scheme is used:
| Build Environment | Requested Build Type | Actual Build Type | Semantic Version |
|---|---|---|---|
| CTHING_CI == false1 or undefined (i.e. developer build) | snapshot | snapshot | n.n.n-0 |
| CTHING_CI == true (i.e. CI build) | snapshot | snapshot | n.n.n-t (t = ms since Unix Epoch) |
| CTHING_CI == false or undefined | release | snapshot | n.n.n-0 |
| CTHING_CI == true | release | release | n.n.n |
1The values true and false are case-insensitive
The library is available from Maven Central using the following Maven dependency:
<dependency>
<groupId>org.cthing</groupId>
<artifactId>cthing-projectversion</artifactId>
<version>3.0.0</version>
</dependency>or the following Gradle dependency:
implementation("org.cthing:cthing-projectversion:3.0.0")The typical usage of this class is to set the version in Gradle build files for C Thing Software projects.
import org.cthing.projectversion.BuildType
import org.cthing.projectversion.ProjectVersion
...
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath(libs.cthingProjectVersion)
}
}
...
version = ProjectVersion("1.2.3", BuildType.snapshot)
...The library is compiled for Java 17. If a Java 17 toolchain is not available, one will be downloaded.
Gradle is used to build the library:
./gradlew buildThe Javadoc for the library can be generated by running:
./gradlew javadocThis project is released on the Maven Central repository. Perform the following steps to create a release.
- Commit all changes for the release
- In the
build.gradle.ktsfile- Ensure that
baseVersionis set to the version for the release. The project follows semantic versioning. - Set
isSnapshottofalse
- Ensure that
- Commit the changes
- Wait until CI and GitHub build the release candidate
- Run the command
mkrelease cthing-projectversion <version> - In a browser go to the Maven Central Repository
- Log in
- Select
Publishfrom the menubar - Press
Publish Component - Enter a name for the deployment
- Choose the file
cthing-projectversion-bundle-<version>.zip - Press
Publish Component - Refresh the page until the deployment has been validated
- Press
Publish - Refresh the page until the status is
Published - Log out
- Delete the file
cthing-projectversion-bundle-<version>.zip - In a browser, go to the project on GitHub
- Generate a release with the tag
<version> - In the build.gradle.kts file, edit the
ProjectVersionobject- Increment the version patch number
- Set the build type to
BuildType.snapshot
- Update the
CHANGELOG.mdwith the changes in the release and prepare for next release changes - Update the
Usagesection in theREADME.mdwith the latest artifact release version - Commit these changes
