Seemingly incremental builds

This commit is contained in:
Daniel Flanagan 2024-08-01 14:02:38 -05:00
parent e5023f897e
commit 0ccbec9e1b
4 changed files with 35 additions and 32 deletions

29
Cargo.lock generated
View file

@ -523,6 +523,25 @@ dependencies = [
"encase_derive_impl", "encase_derive_impl",
] ]
[[package]]
name = "bevy_framepace"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa5f7d858e66d0f4c4fe3e1a678da440037ce383c4c51bff3c1fa06a121ebc0"
dependencies = [
"bevy_app",
"bevy_diagnostic",
"bevy_ecs",
"bevy_log",
"bevy_reflect",
"bevy_render",
"bevy_time",
"bevy_utils",
"bevy_window",
"bevy_winit",
"spin_sleep",
]
[[package]] [[package]]
name = "bevy_gizmos" name = "bevy_gizmos"
version = "0.14.0" version = "0.14.0"
@ -2014,6 +2033,7 @@ name = "kodotag-rs"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bevy", "bevy",
"bevy_framepace",
] ]
[[package]] [[package]]
@ -3083,6 +3103,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "spin_sleep"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368a978649eaf70006b082e79c832bd72556ac1393eaf564d686e919dca2347f"
dependencies = [
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "spirv" name = "spirv"
version = "0.3.0+sdk-1.3.268.0" version = "0.3.0+sdk-1.3.268.0"

View file

@ -35,6 +35,7 @@ bevy = { version = "0.14.0", default-features = false, features = [
# "bevy_dev_tools", # possibly-useful development tools # "bevy_dev_tools", # possibly-useful development tools
# "detailed_trace", # probably useful troubleshooting information during runtime # "detailed_trace", # probably useful troubleshooting information during runtime
] } ] }
bevy_framepace = "0.17.1"
[profile.dev] [profile.dev]
opt-level = 1 opt-level = 1

View file

@ -65,16 +65,10 @@
}; };
}; };
build = outputs.packages.${pkgs.system}.default; build = outputs.packages.${pkgs.system}.default;
build-no-crane = outputs.packages.${pkgs.system}.kodotag-no-crane;
}); });
packages = genPkgs (pkgs: let packages = genPkgs (pkgs: let
rustToolchainFor = p: rustToolchainFor = p: p.rust-bin.stable.latest.default;
p.rust-bin.selectLatestNightlyWith (toolchain:
toolchain.default.override {
extensions = ["rust-src"];
targets = ["x86_64-unknown-linux-gnu"];
});
rustToolchain = rustToolchainFor pkgs; rustToolchain = rustToolchainFor pkgs;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchainFor; craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchainFor;
@ -92,10 +86,6 @@
}; };
in { in {
kodotag = craneLib.buildPackage { kodotag = craneLib.buildPackage {
# TODO: incremental rust builds with nix would be awesome
pname = "kodotag";
version = "0.1.0";
inherit src; inherit src;
strictDeps = true; strictDeps = true;
cargoVendorDir = craneLib.vendorMultipleCargoDeps { cargoVendorDir = craneLib.vendorMultipleCargoDeps {
@ -118,9 +108,7 @@
nativeBuildInputs = buildTimeDeps pkgs; nativeBuildInputs = buildTimeDeps pkgs;
buildInputs = linkTimeDeps pkgs; buildInputs = linkTimeDeps pkgs;
hash = pkgs.lib.fakeHash; # hash = pkgs.lib.fakeHash;
# cargoHash = "";
cargoHash = "sha256-d7luBIWHWn2ZpmSnIgpuLXsy1URUIojpPFboMtqa2ps=";
# a hack to avoid using mold as our linker when building with nix # a hack to avoid using mold as our linker when building with nix
postUnpack = '' postUnpack = ''
@ -129,24 +117,7 @@
''; '';
}; };
kodotag-no-crane = pkgs.rustPlatform.buildRustPackage { default = outputs.packages.${pkgs.system}.kodotag;
pname = "kodotag";
version = "0.1.0";
nativeBuildInputs = buildTimeDeps pkgs;
buildInputs = linkTimeDeps pkgs;
src = ./.;
hash = pkgs.lib.fakeHash;
# cargoHash = "";
cargoHash = "sha256-d7luBIWHWn2ZpmSnIgpuLXsy1URUIojpPFboMtqa2ps=";
# a hack to avoid using mold as our linker when building with nix
postUnpack = ''
ls -la
rm -r ./*/.cargo
'';
};
default = outputs.packages.${pkgs.system}.kodotag-no-crane;
}); });
devShells = genPkgs (pkgs: { devShells = genPkgs (pkgs: {

View file

@ -58,6 +58,7 @@ fn main() -> AppExit {
}) })
.set(ImagePlugin::default_nearest()), .set(ImagePlugin::default_nearest()),
FrameTimeDiagnosticsPlugin, FrameTimeDiagnosticsPlugin,
// bevy_framepace::FramepacePlugin,
)); ));
load_internal_binary_asset!( load_internal_binary_asset!(
@ -105,6 +106,7 @@ fn main() -> AppExit {
.after(player::control) .after(player::control)
.after(movement::resolve_velocity), .after(movement::resolve_velocity),
) )
.after(input::process_input)
.in_set(InGameSet), .in_set(InGameSet),
(main_menu::update).in_set(MainMenuSet), (main_menu::update).in_set(MainMenuSet),
), ),