Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bevy-explorer and multiple ndk-glue versions in bevy #154

Merged
merged 3 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ crossbow-android = { path = "platform/android", version = "0.2.3", optional = tr
crossbow-ios = { path = "platform/ios", version = "0.2.3", optional = true }

[patch.crates-io]
bevy = { git = "https://github.com/dodorare/bevy", rev = "732fc8c585ebd3a622153771a8c51ace93024a04" }
miniquad = { git = "https://github.com/not-fl3/miniquad", rev = "d67ffe6950cf73df307e2d23aaa4726f14399985" }

[features]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/subxt-with-bevy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```sh
[dependencies]
substrate-subxt = "0.21"
bevy = "0.8.0"
bevy = "0.8.1"
```

## Bevy explorer example
Expand Down
2 changes: 1 addition & 1 deletion examples/bevy-2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
crossbow = { version = "0.2.3", path = "../../" }
log = "0.4"
anyhow = "1.0"
bevy = { version = "0.8.0", default-features = false, features = ["bevy_winit", "render", "bevy_asset"] }
bevy = { version = "0.8.1", default-features = false, features = ["bevy_winit", "render", "bevy_asset"] }

[package.metadata]
app_name = "Bevy 2D"
Expand Down
16 changes: 15 additions & 1 deletion examples/bevy-explorer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ log = "0.4"
anyhow = "1.0"
subxt = "0.21"
tokio = { version = "1.17", features = ["sync", "macros", "rt-multi-thread"] }
bevy = { version = "0.8.0", default-features = false, features = ["bevy_winit", "render", "bevy_asset"] }
bevy = { version = "0.8.1", default-features = false, features = ["bevy_winit", "render", "bevy_asset"] }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
jsonrpsee = { version = "0.10.1", features = ["async-client", "client-ws-transport"] }

Expand All @@ -22,6 +22,20 @@ assets = ["../../assets"]
release_build_targets = ["aarch64-linux-android"]
resources = ["../../assets/res/android"]

[[package.metadata.android.plugins_local_projects]]
include = ":crossbow"
dont_implement = true
project_dir = "../../platform/android/java"
[[package.metadata.android.plugins_local_projects]]
include = ":crossbow:lib"
[package.metadata.android.manifest]
package = "com.crossbow.example.permissions"
[[package.metadata.android.manifest.uses_permission]]
name = "android.permission.INTERNET"
[package.metadata.android.manifest.uses_sdk]
min_sdk_version = 19
target_sdk_version = 31

[package.metadata.apple]
release_build_targets = ["aarch64-apple-ios", "x86_64-apple-ios"]
resources = ["../../assets/res/apple"]
Binary file removed examples/bevy-explorer/res/metadata.scale
Binary file not shown.
Binary file not shown.
10 changes: 6 additions & 4 deletions examples/bevy-explorer/src/explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use subxt::{
};
use tokio::sync::mpsc;

#[subxt::subxt(runtime_metadata_path = "res/metadata.scale")]
#[subxt::subxt(runtime_metadata_path = "res/polkadot_metadata.scale")]
pub mod bevy_explorer {}

#[cfg(not(target_os = "android"))]
Expand All @@ -28,14 +28,16 @@ impl ExplorerStateChannel {
}
}

pub fn explorer_startup(task_pool: Res<AsyncComputeTaskPool>, channel: Res<ExplorerStateChannel>) {
pub fn explorer_startup(channel: Res<ExplorerStateChannel>) {
let thread_pool = AsyncComputeTaskPool::get();
let tx = channel.tx.clone();

#[cfg(target_os = "android")]
let certificate = CertificateStore::WebPki;
#[cfg(not(target_os = "android"))]
let certificate = CertificateStore::Native;

task_pool
thread_pool
.spawn(async move {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async {
Expand Down Expand Up @@ -77,7 +79,7 @@ pub fn explorer_startup(task_pool: Res<AsyncComputeTaskPool>, channel: Res<Explo
finalized_block_parent_hash: finalized.parent_hash.to_string(),
})
.await
.unwrap();
.ok();
}
});
})
Expand Down