@@ -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.
3651group = " 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"
149146val releaseName = libName
150147val 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-
159149tasks.register<WriteProperties >(" writeLibraryProperties" ) {
160150 group = " processing"
161151 destinationFile = project.file(" library.properties" )
0 commit comments