Skip to content

Commit

Permalink
Add 11.5 support (#33)
Browse files Browse the repository at this point in the history
* add 11.5 support

* Use inferred static array of love versions

---------

Co-authored-by: Cameron McHenry <[email protected]>
  • Loading branch information
gingerbeardman and camchenry authored Jan 7, 2024
1 parent 1e4cf49 commit d090ab6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
asset_name: boon-linux-amd64
strategy:
matrix:
love: [11.2, 11.3, 11.4, 0.10.2]
love: [11.2, 11.3, 11.4, 11.5, 0.10.2]
steps:
- uses: actions/checkout@v2
- name: Download latest boon
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
asset_name: boon-macos-amd64
strategy:
matrix:
love: [11.2, 11.3, 11.4, 0.10.2]
love: [11.2, 11.3, 11.4, 11.5, 0.10.2]
steps:
- uses: actions/checkout@v2
- name: Download latest boon
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
asset_name: boon-windows-amd64
strategy:
matrix:
love: [11.2, 11.3, 11.4, 0.10.2]
love: [11.2, 11.3, 11.4, 11.5, 0.10.2]
steps:
- uses: actions/checkout@v2
- name: Download latest boon
Expand Down
3 changes: 3 additions & 0 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ pub fn get_love_version_file_name(
bitness: Bitness,
) -> String {
match (version, platform, bitness) {
(LoveVersion::V11_5, Platform::Windows, Bitness::X64) => "love-11.5-win64",
(LoveVersion::V11_5, Platform::Windows, Bitness::X86) => "love-11.5-win32",

(LoveVersion::V11_4, Platform::Windows, Bitness::X64) => "love-11.4-win64",
(LoveVersion::V11_4, Platform::Windows, Bitness::X86) => "love-11.4-win32",

Expand Down
4 changes: 4 additions & 0 deletions src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ fn get_love_download_location(
) -> Result<LoveDownloadLocation> {
let release_location = "https://github.com/love2d/love/releases/download";
let (version_string, release_file_name) = match (version, platform, bitness) {
(LoveVersion::V11_5, Platform::Windows, Bitness::X64) => ("11.5", "love-11.5-win64.zip"),
(LoveVersion::V11_5, Platform::Windows, Bitness::X86) => ("11.5", "love-11.5-win32.zip"),
(LoveVersion::V11_5, Platform::MacOs, Bitness::X64) => ("11.5", "love-11.5-macos.zip"),

(LoveVersion::V11_4, Platform::Windows, Bitness::X64) => ("11.4", "love-11.4-win64.zip"),
(LoveVersion::V11_4, Platform::Windows, Bitness::X86) => ("11.4", "love-11.4-win32.zip"),
(LoveVersion::V11_4, Platform::MacOs, Bitness::X64) => ("11.4", "love-11.4-macos.zip"),
Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
mod types;
use crate::build::get_boon_data_path;
use crate::types::{
Bitness, BuildSettings, BuildStatistics, LoveVersion, Platform, Project, Target,
Bitness, BuildSettings, BuildStatistics, LoveVersion, Platform, Project, Target, LOVE_VERSIONS
};

mod build;
Expand Down Expand Up @@ -48,8 +48,8 @@ enum BoonOpt {
long,
short,
help = "Specify which target version of LÖVE to build for",
possible_values=&LoveVersion::variants(),
default_value="11.4",
possible_values=LOVE_VERSIONS,
default_value="11.5",
)]
version: LoveVersion,
directory: String,
Expand All @@ -66,12 +66,12 @@ enum BoonOpt {
enum LoveSubcommand {
#[structopt(about = "Download a version of LÖVE")]
Download {
#[structopt(possible_values=&LoveVersion::variants())]
#[structopt(possible_values=LOVE_VERSIONS)]
version: LoveVersion,
},
#[structopt(about = "Remove a version of LÖVE")]
Remove {
#[structopt(possible_values=&LoveVersion::variants())]
#[structopt(possible_values=LOVE_VERSIONS)]
version: LoveVersion,
},
#[structopt(about = "List installed LÖVE versions")]
Expand Down
22 changes: 9 additions & 13 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ pub enum Bitness {
X64, // 64 bit
}

const LOVE_VERSIONS: [&str; 6] = ["11.4", "11.3", "11.2", "11.1", "11.0", "0.10.2"];
pub static LOVE_VERSIONS: &[&str] = &["11.5", "11.4", "11.3", "11.2", "11.1", "11.0", "0.10.2"];

/// Represents a specific version of LÖVE2D
#[derive(Copy, Clone, Debug, Primitive)]
pub enum LoveVersion {
V11_4 = 0,
V11_3 = 1,
V11_2 = 2,
V11_1 = 3,
V11_0 = 4,
V0_10_2 = 5,
V11_5 = 0,
V11_4 = 1,
V11_3 = 2,
V11_2 = 3,
V11_1 = 4,
V11_0 = 5,
V0_10_2 = 6,
}

/// File info about remote download
Expand Down Expand Up @@ -86,12 +88,6 @@ impl FromStr for LoveVersion {
}
}

impl LoveVersion {
pub const fn variants() -> [&'static str; 6] {
LOVE_VERSIONS
}
}

impl Display for LoveVersion {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", LOVE_VERSIONS[*self as usize])
Expand Down

0 comments on commit d090ab6

Please sign in to comment.