diff --git a/pom.xml b/pom.xml index d2f6b05..ead6821 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.andrewlalis perfin - 1.0.0 + 1.0.1 21 diff --git a/scripts/SetVersion.java b/scripts/SetVersion.java new file mode 100644 index 0000000..69e1341 --- /dev/null +++ b/scripts/SetVersion.java @@ -0,0 +1,53 @@ +import java.io.*; +import java.nio.file.*; +import java.util.*; + +/** + * Utility script that updates the program's version in the many places where + * it's used, as opposed to making a fancy system to introspect the POM to get + * the version. Simply call java scripts/SetVersion.java <your version here> + * and it'll update all the necessary files. + */ +class SetVersion { + public static void main(String[] args) throws Exception { + if (args.length < 1) { + System.out.println("Missing required version argument."); + System.exit(1); + } + String version = args[0].strip(); + System.out.println("Setting application to version " + version + " Is this okay? (yes/no)"); + var reader = new BufferedReader(new InputStreamReader(System.in)); + String response = reader.readLine(); + if (!response.equalsIgnoreCase("yes")) { + System.out.println("Exiting."); + System.exit(1); + } + + replaceInFile( + Path.of("scripts", "package-linux-deb.sh"), + "--app-version .* \\\\", + "--app-version \"" + version + "\" \\\\" + ); + replaceInFile( + Path.of("scripts", "package-windows-msi.ps1"), + "--app-version .* `", + "--app-version \"" + version + "\" `" + ); + replaceInFile( + Path.of("pom.xml"), + ".*", + "" + version + "" + ); + replaceInFile( + Path.of("src", "main", "resources", "main-view.fxml"), + "text=\"Perfin .*\"", + "text=\"Perfin Version " + version + "\"" + ); + } + + private static void replaceInFile(Path file, String pattern, String replacement) throws IOException { + System.out.println("Replacing " + pattern + " with " + replacement + " in " + file); + String fileContent = Files.readString(file); + Files.writeString(file, fileContent.replaceFirst(pattern, replacement)); + } +} \ No newline at end of file diff --git a/scripts/package-linux-deb.sh b/scripts/package-linux-deb.sh index a9718e4..b5ddb50 100755 --- a/scripts/package-linux-deb.sh +++ b/scripts/package-linux-deb.sh @@ -24,7 +24,7 @@ module_path="$module_path:target/modules/h2-2.2.224.jar" jpackage \ --name "Perfin" \ - --app-version "1.0.0" \ + --app-version "1.0.1" \ --description "Desktop application for personal finance. Add your accounts, track transactions, and store receipts, invoices, and more." \ --icon design/perfin-logo_256.png \ --vendor "Andrew Lalis" \ diff --git a/scripts/package-windows-msi.ps1 b/scripts/package-windows-msi.ps1 index 0d1976a..cee26cc 100644 --- a/scripts/package-windows-msi.ps1 +++ b/scripts/package-windows-msi.ps1 @@ -12,7 +12,7 @@ $modulePath = "$modulePath;target\modules\h2-2.2.224.jar" jpackage ` --name "Perfin" ` - --app-version "1.0.0" ` + --app-version "1.0.1" ` --description "Desktop application for personal finance. Add your accounts, track transactions, and store receipts, invoices, and more." ` --icon design\perfin-logo_256.ico ` --vendor "Andrew Lalis" ` diff --git a/src/main/resources/main-view.fxml b/src/main/resources/main-view.fxml index 02ee160..596ec87 100644 --- a/src/main/resources/main-view.fxml +++ b/src/main/resources/main-view.fxml @@ -23,7 +23,7 @@ -