Skip to content

Commit 8f9446b

Browse files
committed
move definition of prettyVersion
1 parent c381f89 commit 8f9446b

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

build.gradle.kts

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ java {
1818
}
1919
}
2020

21+
// read in user-defined properties in release.properties file
22+
// to be saved in 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+
}
2127

2228
//==========================
2329
// USER BUILD CONFIGURATIONS
@@ -35,13 +41,6 @@ val libName = "myLibrary"
3541
// Replace "com.myDomain" with your own domain or organization name.
3642
group = "com.myDomain"
3743

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-
4544
// the following conditional allows for the version to be overwritten by a Github release
4645
// via the release workflow, which defines a property named "githubReleaseTag"
4746

@@ -50,7 +49,7 @@ version = if (project.hasProperty("githubReleaseTag")) {
5049
project.property("githubReleaseTag").toString().drop(1)
5150

5251
} else {
53-
"1.0.0"
52+
libraryProperties.getProperty("prettyVersion")
5453
}
5554

5655
// The location of your sketchbook folder. The sketchbook folder holds your installed
@@ -149,28 +148,14 @@ val releaseRoot = "$rootDir/release"
149148
val releaseName = libName
150149
val releaseDirectory = "$releaseRoot/$releaseName"
151150

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-
159151
tasks.register<WriteProperties>("writeLibraryProperties") {
160152
group = "processing"
161153
destinationFile = project.file("library.properties")
162154

163-
property("name", libraryProperties.getProperty("name"))
164-
property("version", libraryProperties.getProperty("version"))
165-
property("prettyVersion", project.version)
166-
property("authors", libraryProperties.getProperty("authors"))
167-
property("url", libraryProperties.getProperty("url"))
168-
property("categories", libraryProperties.getProperty("categories"))
169-
property("sentence", libraryProperties.getProperty("sentence"))
170-
property("paragraph", libraryProperties.getProperty("paragraph"))
171-
property("minRevision", libraryProperties.getProperty("minRevision"))
172-
property("maxRevision", libraryProperties.getProperty("maxRevision"))
173-
}
155+
for (prop in libraryProperties) {
156+
property(prop.key.toString(), prop.value)
157+
}
158+
}
174159

175160
// define the order of running, to ensure clean is run first
176161
tasks.build.get().mustRunAfter("clean")

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)