Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: restructure Platform #714

Merged
merged 2 commits into from
Jun 29, 2024
Merged

Conversation

skaldarnar
Copy link
Member

@skaldarnar skaldarnar commented Nov 27, 2023

Contains

Restructure the Platform utility class and splits out OS and Arch as separate enums.

Loosely based on #708.

How to test

Nothing should change based on this PR.

Outstanding before merging

  • Gather opinions on whether we should split this up for more flexibility in modeling (that we probabyl don't need) or rather go the opposite way and have a more restrictive enum regarding supported platforms. See my discussion notes in the PR.
    The feedback received sounded like we can can move forward with with this mostly as is. I've incorporated the idea of making Platform and enum itself.

Comment on lines 20 to 33
//TODO(skaldarnar): I'm not fully settled on how to model the Platform. I thought splitting this up into two enums
// for OS and Architecture would help with more type-safe construction of these values, simplify comparison to
// select the right JRE for a game, etc.
//
// On the other hand, the set of supported platforms is so limited, and continuing on a non-supported platform
// does not make much sense. So, maybe it is better to have a rather restrictive and explicit enum in the form of
// WINDOWS_X64
// LINUX_X64
// I'm adding the architecture to this list, as I hope that we'll be able to support old Intel and new M1 Macs at
// some point in the future, adding the following to the list:
// MAC_X64
// MAC_AARCH64
// The biggest drawback of being super-strict here is that development on non-supported platforms becomes
// impossible where it was just "not ideal" before.
Copy link
Contributor

Choose a reason for hiding this comment

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

It think this should be as type-safe as possible. It shouldn't be possible to run the launcher on unsupported platforms unintentionally. Having seperate enums for OS and Architecture allows for greater flexibility in adding new platforms in the future and also makes it easier to significantly differentiate by OS alone where needed. You could also possibly make Platform itself an enum for further type safety.

@skaldarnar skaldarnar force-pushed the topic/restructure-platform-info branch from 11bb4a3 to 76ee046 Compare June 27, 2024 11:29
@skaldarnar skaldarnar added the Type: Maintenance Maintenance or chores not adding new features or fixing bugs. label Jun 27, 2024
@BenjaminAmos BenjaminAmos merged commit e334afb into master Jun 29, 2024
3 checks passed
@BenjaminAmos BenjaminAmos deleted the topic/restructure-platform-info branch June 29, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Maintenance or chores not adding new features or fixing bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants