DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

ea4c58c1c5de4d29e5b2503b1c2e751de1371ca5 — skye 1 year, 7 months ago c99b97a
feat(client): add asset bundling
4 files changed, 159 insertions(+), 7 deletions(-)

M Cargo.lock
M client/Cargo.toml
A client/build.rs
M client/src/main.rs
M Cargo.lock => Cargo.lock +117 -0
@@ 87,6 87,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"

[[package]]
name = "aes"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
dependencies = [
 "cfg-if",
 "cipher",
 "cpufeatures",
 "opaque-debug",
]

[[package]]
name = "ahash"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 421,6 433,22 @@ dependencies = [
]

[[package]]
name = "bevy_assets_bundler"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c2df4c903127209e98f3487288b7be88f9e19d5d3edd2d3d26d2ee1ef0d234"
dependencies = [
 "aes",
 "anyhow",
 "bevy",
 "block-modes",
 "bs58",
 "cfg-if",
 "tar",
 "tracing",
]

[[package]]
name = "bevy_core"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1166,6 1194,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"

[[package]]
name = "block-modes"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e"
dependencies = [
 "block-padding",
 "cipher",
]

[[package]]
name = "block-padding"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"

[[package]]
name = "block-sys"
version = "0.1.0-beta.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1185,6 1229,12 @@ dependencies = [
]

[[package]]
name = "bs58"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3"

[[package]]
name = "bstr"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1296,6 1346,15 @@ dependencies = [
]

[[package]]
name = "cipher"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
dependencies = [
 "generic-array",
]

[[package]]
name = "clang-sys"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1431,6 1490,15 @@ dependencies = [
]

[[package]]
name = "cpufeatures"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58"
dependencies = [
 "libc",
]

[[package]]
name = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1791,6 1859,18 @@ dependencies = [
]

[[package]]
name = "filetime"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153"
dependencies = [
 "cfg-if",
 "libc",
 "redox_syscall 0.2.16",
 "windows-sys 0.48.0",
]

[[package]]
name = "fixedbitset"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1909,6 1989,16 @@ dependencies = [
]

[[package]]
name = "generic-array"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
 "typenum",
 "version_check",
]

[[package]]
name = "gethostname"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2361,6 2451,7 @@ name = "laurelin_client"
version = "0.1.0"
dependencies = [
 "bevy",
 "bevy_assets_bundler",
 "bevy_editor_pls",
 "bevy_egui",
 "bevy_mod_picking",


@@ 2861,6 2952,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"

[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"

[[package]]
name = "opener"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3595,6 3692,17 @@ dependencies = [
]

[[package]]
name = "tar"
version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6"
dependencies = [
 "filetime",
 "libc",
 "xattr",
]

[[package]]
name = "tempfile"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 4529,6 4637,15 @@ dependencies = [
]

[[package]]
name = "xattr"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc"
dependencies = [
 "libc",
]

[[package]]
name = "xi-unicode"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

M client/Cargo.toml => client/Cargo.toml +6 -0
@@ 10,6 10,9 @@ license = "GPL-3.0-only"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
bevy_assets_bundler = "0.6.0"

[dependencies]
futures-lite = "1.13.0"



@@ 46,6 49,9 @@ features = [
    "x11",
]

[dependencies.bevy_assets_bundler]
version = "0.6.0"

[dependencies.bevy_rapier3d]
version = "0.21.0"
features = [

A client/build.rs => client/build.rs +15 -0
@@ 0,0 1,15 @@
use bevy_assets_bundler::*;

// build.rs
// encryption key: [u8; 16] array
// make sure the key is consistent between build.rs and main.rs
fn main() {
    let key = [
        25, 221, 123, 82, 182, 95, 251, 128, 83, 192, 172, 139, 92, 102, 34, 248,
    ];
    let mut options = AssetBundlingOptions::default();
    options.set_encryption_key(key);
    options.encode_file_names = true;
    options.enabled_on_debug_build = true;
    AssetBundler::from(options).build();
}

M client/src/main.rs => client/src/main.rs +21 -7
@@ 11,6 11,7 @@

use api::user::User;
use bevy::prelude::*;
use bevy_assets_bundler::*;
use bevy_editor_pls::EditorPlugin;
use bevy_egui::EguiPlugin;
use bevy_mod_picking::prelude::*;


@@ 33,14 34,27 @@ enum AppState {
}

fn main() {
    let key = [
        25, 221, 123, 82, 182, 95, 251, 128, 83, 192, 172, 139, 92, 102, 34, 248,
    ];
    let mut asset_bundling_options = AssetBundlingOptions::default();
    asset_bundling_options.set_encryption_key(key);
    asset_bundling_options.encode_file_names = true;
    asset_bundling_options.enabled_on_debug_build = true;

    let mut app = App::new();
    app.add_plugins(DefaultPlugins.set(WindowPlugin {
        primary_window: Some(Window {
            title: String::from("Laurelin Client"),
            ..Default::default()
        }),
        ..Default::default()
    }));
    app.add_plugins(
        DefaultPlugins
            .set(WindowPlugin {
                primary_window: Some(Window {
                    title: String::from("Laurelin Client"),
                    ..Default::default()
                }),
                ..Default::default()
            })
            .build()
            .add_before::<AssetPlugin, _>(BundledAssetIoPlugin::from(asset_bundling_options)),
    );

    app.add_plugin(RapierPhysicsPlugin::<NoUserData>::default());
    app.add_plugin(TextMeshPlugin);