mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-11 13:48:37 +02:00
build(local): simplify writeVersion task with WriteProperties plugin and enable build caching (#4139)
# Description of Changes - **What was changed**: - Replaced the custom `writeVersion` task in `build.gradle` with the built-in `WriteProperties` plugin configuration. - Updated `gradle.properties` to enable `org.gradle.caching` (uncommented) for local development. - **Why the change was made**: - To reduce boilerplate and leverage Gradle’s native property-writing capabilities for maintaining the version file. - To improve build performance by reusing outputs via the Gradle build cache. - **Scope**: - These updates only affect local development and do not change production or CI script --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details.
This commit is contained in:
parent
aec5a8ddc5
commit
6cd64a22ba
27
build.gradle
27
build.gradle
@ -65,28 +65,11 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('writeVersion') {
|
||||
def propsFile = file("$projectDir/app/common/src/main/resources/version.properties")
|
||||
def propsDir = propsFile.parentFile
|
||||
|
||||
doLast {
|
||||
if (propsDir.exists()) {
|
||||
if (propsFile.exists()) {
|
||||
println "File exists: $propsFile"
|
||||
} else {
|
||||
println "$propsFile does not exist. Creating file."
|
||||
propsFile.createNewFile()
|
||||
}
|
||||
} else {
|
||||
println "Creating directory: $propsDir"
|
||||
propsDir.mkdirs()
|
||||
propsFile.createNewFile()
|
||||
}
|
||||
|
||||
def props = new Properties()
|
||||
props.setProperty("version", version)
|
||||
props.store(propsFile.newWriter(), null)
|
||||
}
|
||||
tasks.register('writeVersion', WriteProperties) {
|
||||
outputFile = layout.projectDirectory.file('app/common/src/main/resources/version.properties')
|
||||
println "Writing version.properties to ${outputFile.path}"
|
||||
comment "${new Date()}"
|
||||
property 'version', project.provider { project.version.toString() }
|
||||
}
|
||||
|
||||
tasks.named('createExe') {
|
||||
|
@ -2,6 +2,7 @@
|
||||
org.gradle.parallel=true
|
||||
|
||||
# Enables build caching to reuse outputs from previous builds for faster execution
|
||||
# org.gradle.caching=true
|
||||
org.gradle.caching=true
|
||||
|
||||
org.gradle.build-scan=true
|
||||
# org.gradle.configuration-cache=true
|
||||
|
Loading…
Reference in New Issue
Block a user