Skip to content

Commit 82947ea

Browse files
committed
Add a new sdl crate to absorb the SDL console
For now, this only moves the code from the std crate into a new sdl crate. The SDL support in the cli is left where it is.
1 parent 4f8475f commit 82947ea

29 files changed

Lines changed: 343 additions & 52 deletions

.github/workflows/package.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ if grep 'Changes in' NEWS.md | head -n 1 | fgrep 'X.Y.Z'; then
3434
echo "Skipping endbasic publish test in development version"
3535
else
3636
( cd std && cargo publish --dry-run )
37+
( cd sdl && cargo publish --dry-run )
3738
( cd rpi && cargo publish --dry-run )
3839
( cd cli && cargo publish --dry-run )
3940
fi

.github/workflows/test.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ jobs:
4545
- uses: actions/checkout@v2
4646
- run: sudo apt update
4747
- run: sudo apt install libsdl2-dev libsdl2-ttf-dev
48-
- run: cargo test --package='*' --features=sdl -- --include-ignored --skip sdl
48+
- run: cargo test --package='*' --features=sdl
49+
-- --include-ignored --skip sdl_console
4950

5051
macos-test:
5152
runs-on: macos-latest
@@ -58,10 +59,11 @@ jobs:
5859
- uses: actions/checkout@v2
5960
- run: brew install sdl2 sdl2_ttf
6061
- run: cargo test --package=endbasic-core -- --include-ignored
61-
- run: cargo test --package=endbasic-std --features=sdl
62-
-- --include-ignored --skip sdl
62+
- run: cargo test --package=endbasic-std -- --include-ignored
63+
- run: cargo test --package=endbasic-sdl
64+
-- --include-ignored --skip sdl_console
6365
- run: cargo test --package=endbasic --features=sdl
64-
-- --include-ignored --skip sdl
66+
-- --include-ignored --skip sdl_console
6567
- run: cargo test --package=endbasic-web -- --include-ignored
6668

6769
windows-test:
@@ -76,7 +78,8 @@ jobs:
7678
- run: choco install unzip
7779
- run: ./.github/workflows/setup-sdl.ps1
7880
- run: cargo test --package=endbasic-core -- --include-ignored
79-
- run: cargo test --package=endbasic-std --features=sdl
81+
- run: cargo test --package=endbasic-std -- --include-ignored
82+
- run: cargo test --package=endbasic-sdl
8083
-- --include-ignored
8184
- run: cargo test --package=endbasic --features=sdl
8285
-- --include-ignored

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ members = [
33
"cli",
44
"core",
55
"rpi",
6+
"sdl",
67
"std",
78
"web",
89
]

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ for the time being.**
5959
filename.
6060

6161
* Refactored the std crate to minimize optional features in library crates
62-
by moving the Raspberry Pi support into a new `endbasic-rpi` crate.
62+
by moving the SDL console into a new `endbasic-sdl` crate and the
63+
Raspberry Pi support into a new `endbasic-rpi` crate.
6364

6465
## Changes in version 0.7.0
6566

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ The following documents provide more information:
5555
* For standard library contents, see [`std/README.md`](std/README.md).
5656
* For usage details of the command-line interpreter, see
5757
[`cli/README.md`](cli/README.md).
58+
* For SDL support, see [`sdl/README.md`](sdl/README.md).
5859
* For Raspberry Pi specific features, see [`rpi/README.md`](rpi/README.md).
5960
* For the web interface, see [`web/README.md`](web/README.md).
6061
* For changes across versions, see [`NEWS.md`](NEWS.md).

RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030

3131
* `( cd core && cargo publish )`
3232
* `( cd std && cargo publish )`
33+
* `( cd sdl && cargo publish )`
3334
* `( cd rpi && cargo publish )`
3435
* `( cd cli && cargo publish )`

cli/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ edition = "2018"
1414
[features]
1515
default = ["bin"]
1616
bin = ["endbasic-std/crossterm", "tokio"]
17-
sdl = ["endbasic-std/sdl", "tempfile"]
17+
sdl = ["endbasic-sdl", "tempfile"]
1818
rpi = ["endbasic-rpi"]
1919

2020
[dependencies]
@@ -36,6 +36,11 @@ version = "0.7.0" # ENDBASIC-VERSION
3636
path = "../rpi"
3737
optional = true
3838

39+
[dependencies.endbasic-sdl]
40+
version = "0.7.0" # ENDBASIC-VERSION
41+
path = "../sdl"
42+
optional = true
43+
3944
[dependencies.endbasic-std]
4045
version = "0.7.0" # ENDBASIC-VERSION
4146
path = "../std"

cli/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
#![warn(unsafe_code)]
2424

2525
use endbasic_core::exec::{Machine, StopReason};
26+
#[cfg(feature = "sdl")]
27+
use endbasic_sdl::SdlConsole;
2628
use endbasic_std::console::{self, Console};
2729
use endbasic_std::program::{continue_if_modified, Program};
28-
#[cfg(feature = "sdl")]
29-
use endbasic_std::sdl::SdlConsole;
3030
use endbasic_std::storage::Storage;
3131
use std::cell::RefCell;
3232
use std::io;

cli/src/sdl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
//! Configuration support for the graphical console.
1717
18-
use endbasic_std::sdl::Resolution;
18+
use endbasic_sdl::Resolution;
1919
use std::fs::File;
2020
use std::io::{self, Write};
2121
use std::path::{Path, PathBuf};

sdl/Cargo.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "endbasic-sdl"
3+
version = "0.7.0" # ENDBASIC-VERSION
4+
license = "Apache-2.0"
5+
authors = ["Julio Merino <jmmv@endbasic.dev>"]
6+
categories = ["development-tools", "parser-implementations"]
7+
keywords = ["basic", "interpreter", "learning", "programming"]
8+
description = "The EndBASIC programming language - SDL graphical console"
9+
homepage = "https://www.endbasic.dev/"
10+
repository = "https://github.com/endbasic/endbasic"
11+
readme = "README.md"
12+
edition = "2018"
13+
14+
[dependencies]
15+
async-trait = "0.1"
16+
once_cell = "1.8"
17+
18+
[dependencies.endbasic-std]
19+
version = "0.7.0" # ENDBASIC-VERSION
20+
path = "../std"
21+
22+
[dependencies.sdl2]
23+
version = "0.34"
24+
default-features = false
25+
features = ["ttf"]
26+
27+
[dev-dependencies]
28+
flate2 = "1.0"
29+
futures-lite = "1.1"

0 commit comments

Comments
 (0)