Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

build: Add Sync app version to AUR PKGBUILD files (#6222)

Ludy8cd6377131f5
diff --git a/build.gradle b/build.gradle
index b18f4b6730..0e33fdb56e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -89,10 +89,12 @@ def appVersionStr = project.version.toString()
def tauriConfigPath = layout.projectDirectory.file('frontend/src-tauri/tauri.conf.json').asFile.path
def sim1Path = layout.projectDirectory.file('frontend/src/core/testing/serverExperienceSimulations.ts').asFile.path
def sim2Path = layout.projectDirectory.file('frontend/src/proprietary/testing/serverExperienceSimulations.ts').asFile.path
+def aurDesktopPkgbuildPath = layout.projectDirectory.file('.github/aur/stirling-pdf-desktop/PKGBUILD').asFile.path
+def aurServerPkgbuildPath = layout.projectDirectory.file('.github/aur/stirling-pdf-server-bin/PKGBUILD').asFile.path
tasks.register('syncAppVersion') {
group = 'versioning'
- description = 'Synchronizes app version across desktop and simulation configs.'
+ description = 'Synchronizes app version across desktop, simulation, and AUR PKGBUILD configs.'
doLast {
println "Synchronizing application version to ${appVersionStr}"
@@ -120,6 +122,20 @@ tasks.register('syncAppVersion') {
}
}
}
+
+ [new File(aurDesktopPkgbuildPath), new File(aurServerPkgbuildPath)].each { f ->
+ if (f.exists()) {
+ def content = f.getText('UTF-8')
+ def matcher = (content =~ /(?m)^(pkgver=)(.*)$/)
+ if (!matcher.find()) {
+ throw new GradleException("Could not locate pkgver in ${f} for synchronization")
+ }
+ def updatedContent = matcher.replaceFirst("\$1${appVersionStr}")
+ if (content != updatedContent) {
+ f.write(updatedContent, 'UTF-8')
+ }
+ }
+ }
}
}