Skip to content

Conversation

@Just1Developer
Copy link
Contributor

@Just1Developer Just1Developer commented Dec 14, 2025

Updater

This pull request adds what I've been wanting to add for quite some time: Updating.

Now, when the TimesheetGenerator is started, it will compare the latest online version to the version listed in its pom.xml. If the online version is newer (not equal, obviously), the TimesheetGenerator will prompt the user if they wish to update. If they do, the process is like this:

  1. Download the new generator to a temporary file.
  2. Attempt to Delete own executable. MacOS, for example, will allow this, while Windows will not.
  3. Success
    3.1. Move the newly downloaded jar to where the old jar once was, copying the name and everything
    3.2. Start the new TimesheetGenerator and close the current one via System.exit(0).
  4. Failure
    4.1. In this case, it gets a little bit more complicated: First, open the new temp jar file and tell it that it is an updater and the current real TimesheetGenerator filepath. After that, close.
    4.2. The temp file will attempt to delete the file at the given path. If its not possible within 10 seconds, it times out and exits.
    4.3. If successful, the temp file will copy itself to where the TimesheetGenerator was, launch that one, and kill itself.
    4.4. The temp file will be deleted anyway through either starting the TimesheetGenerator immediately after, or the next time, so there is no need to worry about it.

Image of the prompt:

image (Ignore the versions, I disabled the newer check for this because my local version is newer).

Additionally, all temporary jar files that follow the naming pattern are erased when starting the TimesheetGenerator UI.

- Doesn't work if the OS does not allow deleting of the file while the timesheet generator is still running
- Tested on Windows 11 and MacOS Tahoe 26.1
@Just1Developer Just1Developer requested review from a team as code owners December 14, 2025 16:31
@Just1Developer Just1Developer changed the title Feature/auto update Feature/update Dec 14, 2025
@Just1Developer
Copy link
Contributor Author

is sonarqube broken?

@Just1Developer Just1Developer changed the title Feature/update Feature/updater Dec 14, 2025
Copy link
Member

@robinmaisch robinmaisch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not easy to test the new feature, but it is looking good :)
If you can change this one thing, we are ready.

@sonarqubecloud
Copy link

@Just1Developer
Copy link
Contributor Author

I have spent a good amount of time testing it on (mainly) macOS and Windows, everything should work, as long as the releases are always names v0.1.2 or just 0.1.2

@robinmaisch robinmaisch merged commit 90f97a2 into kit-sdq:main Dec 15, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants