Skip to content

Commit

Permalink
🚧 Split luminol into separate crates (Astrabit-ST#45)
Browse files Browse the repository at this point in the history
* refactor: 🚧 Split luminol into separate crates

* refactor: 🚧 Start working out dependencies

* Sorta figure out dependencies

* Sorta start getting somewhere

* Move Luminol into crates folder

* Move the filesystem trait out of luminol-core

* refactor: 🚧 refactor luminol-graphics and it's a mess

* refactor:

* refactor: add UpdateState to luminol-core and move various traits

* refactor(filesystem): ♻️ require FileSystem::File to be 'static

* refactor: ♻️ don't take an &'static reference to graphics state

* refactor: ♻️ refactor modals

* refactor: ♻️ unify tabs and windows

* refactor: ♻️ start to fix up windows

* refactor: ♻️ hack together things so that they compile

* refactor: ♻️ partially resolve async code issues

* refactor: ♻️ it compiles (with a LOT of unfinished things)

* refactor: ♻️ NOW it compiles

* fix(graphics): 🐛 fix sprite shader compilation

* fix(data cache): ♻️ get data cache semi-working

* refactor(data cache): ♻️ actually load data cache

* refactor(config): ♻️ store code theme in global state again

* fix(ui): 🐛 fix windows and tabs not being added

* refactor: ♻️ use workspace metadata for package metadata

* refactor: ♻️ remove generic parameters on update state by using dynamic dispatch

I couldn't get generics to allow adding tabs or windows inside tabs or windows

* refactor(tabs): ♻️ pass update state when requesting tab name

* fix(tabs): 🐛 fix tabs not adding properly

* Update window.rs

* fix: 🐛 get top bar loading projects

* fix: 🐛 fix new project creation

because reqwest requires tokio we need to spawn a tokio runtime. i do not think this scales well to web

* refactor: 🚧 try splitting up the map tab

* Enable -Zthreads compiler flag

* Update nightly in workflows

* revert: ⏪ Undo making cursor state an enum (will tackle this later)

* Sorta resolve dependencies on wasm

Still a mess (and is especially complicated by the fact that you can't specify workspace target specific dependencies)

* Fix backing web filesystem implementation

Still need to work on the project filesystem though!
I'll be honest, I'm not sure how this will work, especially with the way I have the native filesystem set up

* Fix native build

* Remove jobs flag

* Fix audio on wasm

* Temporarily impl Send + Sync for wgpu callbacks

In wgpu 0.17 wgpu types are not Send + Sync, because they reference things in the JS heap (meaning they cannot leave the thread they were created on)

egui_wgpu's CallbackTrait requires Send + Sync even on wasm and we need to store wgpu types in callbacks. The callback_resources typemap passed to callbacks doesn't need to be Send + Sync.. but I can't find a simple way to add anything to the typemap.

emilk/egui#1399 feels relevant

* Fix winit not compiling in CI

emilk/egui#3228

* Get wasm filesystem compiling

* Get luminol compiling on wasm!

* Fix missed rename

* Dumb typo

* Move luminol crate to be root package

Trunk doesn't like virtual workspaces unfortunately
:(

* Run workspace tests

* fix(audio): 🐛 Completely read audio file on wasm

* perf(wasm): ⚡ Use oneshot crate for oneshot channels

* fix(filesystem): 🐛 Pass idb key instead of path to Filesystem::from_idb_key

* refactor(tilemap): ♻️ Use naga oil instead of const_format

* fix(ui): 🐛 Fix top bar opening & closing projects

* Bump nightly in trunk build

* Remove luminol- in folder prefixes
  • Loading branch information
melody-rs authored Nov 22, 2023
1 parent 6c1dc04 commit 6998d64
Show file tree
Hide file tree
Showing 185 changed files with 8,821 additions and 8,346 deletions.
20 changes: 18 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
# Possibly enable -Zshare-generics=y?

[target.x86_64-pc-windows-msvc]
linker = "rust-lld"
rustflags = ["-Z", "threads=8"]

[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=mold"]
rustflags = [
"-C",
"linker=clang",
"-C",
"link-arg=-fuse-ld=mold",
"-Z",
"threads=8",
]

[target.'cfg(target_arch = "wasm32")']
rustflags = ["--cfg=web_sys_unstable_apis", "-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"]
rustflags = [
"--cfg=web_sys_unstable_apis",
"-C",
"target-feature=+atomics,+bulk-memory,+mutable-globals",
"-Z",
"threads=8",
]
12 changes: 6 additions & 6 deletions .github/workflows/build-steam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build luminol (Release)
run: cargo build --features steamworks --release --jobs 1
run: cargo build --features steamworks --release
- name: Setup artifact
run: |
mkdir -p ${{ github.workspace }}/artifact
Expand All @@ -48,11 +48,11 @@ jobs:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build luminol (Release)
run: cargo build --features steamworks --release --jobs 1
run: cargo build --features steamworks --release
- name: Setup artifact
run: |
mkdir -p ${{ github.workspace }}/artifact
Expand All @@ -73,11 +73,11 @@ jobs:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build luminol (Release)
run: cargo build --features steamworks --release --jobs 1
run: cargo build --features steamworks --release
- name: Setup artifact
run: |
mkdir -p ${{ github.workspace }}/artifact
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build luminol (Release)
run: cargo build --release --jobs 1
run: cargo build --release
- name: Setup artifact
run: |
mkdir -p ${{ github.workspace }}/artifact
Expand All @@ -46,11 +46,11 @@ jobs:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build luminol (Release)
run: cargo build --release --jobs 1
run: cargo build --release
- name: Setup artifact
run: |
mkdir -p ${{ github.workspace }}/artifact
Expand All @@ -70,11 +70,11 @@ jobs:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build luminol (Release)
run: cargo build --release --jobs 1
run: cargo build --release
- name: Setup artifact
run: |
mkdir -p ${{ github.workspace }}/artifact
Expand All @@ -98,7 +98,7 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
targets: wasm32-unknown-unknown
components: rust-src
- name: Download and install Trunk binary
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- run: cargo check --all-features --jobs 1
- run: cargo check --all-features

check-wasm32:
name: Check wasm32
Expand All @@ -41,12 +41,12 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
targets: wasm32-unknown-unknown
components: rust-src
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- run: cargo check --jobs 1 --target wasm32-unknown-unknown -Z build-std=std,panic_abort
- run: cargo check --target wasm32-unknown-unknown -Z build-std=std,panic_abort

test:
name: Test Suite
Expand All @@ -60,10 +60,10 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- run: cargo test --lib --jobs 1
- run: cargo test --workspace

fmt:
name: Rustfmt
Expand All @@ -78,7 +78,7 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
components: rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2
Expand All @@ -97,8 +97,8 @@ jobs:
sudo apt install libgtk-3-dev libatk1.0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libasound2-dev clang mold -y
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2023-09-12
toolchain: nightly-2023-11-14
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- run: cargo clippy --jobs 1 -- # -D warnings
- run: cargo clippy -- # -D warnings
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"licenser.customHeaderFile": "${workspaceFolder}/.vscode/header.txt",
"licenser.disableAutoHeaderInsertion": false,
"rust-analyzer.cargo.features": [
"steamworks"
// "steamworks"
],
"editor.formatOnSave": true,
"rust-analyzer.check.command": "clippy",
Expand All @@ -22,7 +22,8 @@
"image cache",
"tilemap",
"config",
"audio"
"audio",
"graphics"
],
"rust-analyzer.showUnlinkedFileNotification": false,
"rust-analyzer.cargo.extraEnv": {
Expand Down
1 change: 1 addition & 0 deletions .wakatime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Luminol
Loading

0 comments on commit 6998d64

Please sign in to comment.