Skip to content

Commit 212610e

Browse files
committed
move definition of prettyVersion
1 parent c381f89 commit 212610e

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

build.gradle.kts

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ java {
1818
}
1919
}
2020

21+
// read in user-defined properties in release.properties file
22+
// most of these properties will be saved to the library.properties file, a required file in the release
23+
// using task writeLibraryProperties
24+
val libraryProperties = Properties().apply {
25+
load(rootProject.file("release.properties").inputStream())
26+
}
27+
28+
// the following conditional allows for the version to be overwritten by a Github release
29+
// via the release workflow, which defines a property named "githubReleaseTag"
30+
version = if (project.hasProperty("githubReleaseTag")) {
31+
// remove leading "v" from tag (the leading "v" is required for the release workflow to trigger)
32+
project.property("githubReleaseTag").toString().drop(1)
33+
} else {
34+
libraryProperties.getProperty("prettyVersion")
35+
}
2136

2237
//==========================
2338
// USER BUILD CONFIGURATIONS
@@ -35,24 +50,6 @@ val libName = "myLibrary"
3550
// Replace "com.myDomain" with your own domain or organization name.
3651
group = "com.myDomain"
3752

38-
// The version of your library. It usually follows semantic versioning (semver),
39-
// which uses three numbers separated by dots: "MAJOR.MINOR.PATCH" (e.g., "1.0.0").
40-
// - MAJOR: Increases when you make incompatible changes.
41-
// - MINOR: Increases when you add new features that are backward-compatible.
42-
// - PATCH: Increases when you make backward-compatible bug fixes.
43-
// You can update these numbers as you release new versions of your library.
44-
45-
// the following conditional allows for the version to be overwritten by a Github release
46-
// via the release workflow, which defines a property named "githubReleaseTag"
47-
48-
version = if (project.hasProperty("githubReleaseTag")) {
49-
// remove leading "v" from tag (the leading "v" is required for the release workflow to trigger)
50-
project.property("githubReleaseTag").toString().drop(1)
51-
52-
} else {
53-
"1.0.0"
54-
}
55-
5653
// The location of your sketchbook folder. The sketchbook folder holds your installed
5754
// libraries, tools, and modes. It is needed if you:
5855
// 1. wish to copy the library to the Processing sketchbook, which installs the library locally
@@ -149,13 +146,6 @@ val releaseRoot = "$rootDir/release"
149146
val releaseName = libName
150147
val releaseDirectory = "$releaseRoot/$releaseName"
151148

152-
// read in user-defined properties in release.properties file
153-
// to be saved in library.properties file, a required file in the release
154-
// using task writeLibraryProperties
155-
val libraryProperties = Properties().apply {
156-
load(rootProject.file("release.properties").inputStream())
157-
}
158-
159149
tasks.register<WriteProperties>("writeLibraryProperties") {
160150
group = "processing"
161151
destinationFile = project.file("library.properties")

release.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ name=A Template Example Library
1010
# releases you've had. NOTE: This must be parsable as an int!
1111
version=1
1212

13+
# The version of your library. It usually follows semantic versioning (semver),
14+
# which uses three numbers separated by dots: "MAJOR.MINOR.PATCH" (e.g., "1.0.0").
15+
# - MAJOR: Increases when you make incompatible changes.
16+
# - MINOR: Increases when you add new features that are backward-compatible.
17+
# - PATCH: Increases when you make backward-compatible bug fixes.
18+
# You can update these numbers as you release new versions of your library.
19+
prettyVersion = 1.0.0
20+
1321
# List of authors. Links can be provided using the syntax [author name](url).
1422
authors=[Your Name](https://myDomain.com)
1523

0 commit comments

Comments
 (0)