@@ -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.
3642group = " 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"
149148val releaseName = libName
150149val 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-
159151tasks.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
176161tasks.build.get().mustRunAfter(" clean" )
0 commit comments