Skip to content

Commit aa2ddc8

Browse files
committed
Miscellaneous/NonMarketHousingSimulation - Simplify build-bevy workflow
1 parent da38f46 commit aa2ddc8

5 files changed

Lines changed: 23 additions & 113 deletions

File tree

‎.github/workflows/build-bevy.yml‎

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ jobs:
2929
if: matrix.os == 'ubuntu-latest'
3030
run: sudo apt-get update && sudo apt-get install -y g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev
3131

32-
# Use --profile dist so the binary lands in target/dist/ — which is where
33-
# Package.wxs (WiX MSI) and the macOS DMG script expect to find it.
3432
- name: Build Project
3533
working-directory: ${{ matrix.project.path }}
3634
shell: bash
@@ -58,54 +56,18 @@ jobs:
5856
[ -d "credits" ] && cp -r credits dist/credits || true
5957
cd dist && tar -czf ../${{ matrix.project.name }}_ubuntu-latest.tar.gz *
6058
61-
# Produces a proper .app bundle + DMG.
62-
#
63-
# The project is expected to ship a pre-configured app bundle skeleton at
64-
# build/macos/src/Game.app/ containing at minimum:
65-
# Contents/Info.plist – display name, bundle ID, version, icon ref
66-
# Contents/Resources/ – .icns icon file
67-
# Contents/PkgInfo – "APPL????"
68-
#
69-
# (This structure is created by bevy_game_template and is already present
70-
# in the repository.) The binary and assets are then copied in and the
71-
# bundle is renamed before packaging.
72-
#
73-
# If the skeleton is absent the step falls back to a minimal bundle with
74-
# no Info.plist (runs fine, but macOS Gatekeeper will warn on open).
7559
- name: Prepare Artifacts (macOS DMG)
7660
if: matrix.os == 'macos-latest'
7761
shell: bash
7862
working-directory: ${{ matrix.project.path }}
7963
run: |
80-
APP_BIN="${{ matrix.project.app_name }}"
81-
PROJ_NAME="${{ matrix.project.name }}"
82-
83-
# ── Locate or create the .app bundle skeleton ──────────────────────
84-
TEMPLATE_APP=$(find build/macos/src -maxdepth 1 -name "*.app" -type d 2>/dev/null | head -1)
85-
86-
if [ -n "$TEMPLATE_APP" ]; then
87-
# Use the repo-supplied skeleton (has Info.plist, icon, PkgInfo).
88-
BUNDLE="build/macos/src/$PROJ_NAME.app"
89-
mv "$TEMPLATE_APP" "$BUNDLE"
90-
else
91-
# Fallback: bare-bones bundle without Info.plist.
92-
echo "Warning: no .app skeleton found in build/macos/src/; creating a minimal bundle."
93-
BUNDLE="build/macos/src/$PROJ_NAME.app"
94-
mkdir -p "$BUNDLE/Contents"
95-
fi
96-
97-
# ── Copy binary and data into the bundle ───────────────────────────
98-
mkdir -p "$BUNDLE/Contents/MacOS"
99-
cp target/dist/$APP_BIN "$BUNDLE/Contents/MacOS/$APP_BIN"
100-
[ -d "assets" ] && cp -r assets/ "$BUNDLE/Contents/MacOS/assets" || true
101-
[ -d "credits" ] && cp -r credits/ "$BUNDLE/Contents/MacOS/credits" || true
102-
103-
# ── Package as DMG ─────────────────────────────────────────────────
104-
ln -sf /Applications build/macos/src/
105-
hdiutil create -fs HFS+ \
106-
-volname "$PROJ_NAME" \
107-
-srcfolder build/macos/src \
108-
"$PROJ_NAME.dmg"
64+
APP_NAME="${{ matrix.project.app_name }}"
65+
mkdir -p build/macos/src/$APP_NAME.app/Contents/MacOS/assets
66+
[ -d "assets" ] && cp -r assets/ build/macos/src/$APP_NAME.app/Contents/MacOS/assets || true
67+
[ -d "credits" ] && cp -r credits/ build/macos/src/$APP_NAME.app/Contents/MacOS/credits || true
68+
cp target/dist/$APP_NAME build/macos/src/$APP_NAME.app/Contents/MacOS/
69+
ln -s /Applications build/macos/src/
70+
hdiutil create -fs HFS+ -volname "${{ matrix.project.name }}" -srcfolder build/macos/src ${{ matrix.project.name }}.dmg
10971
11072
- name: Prepare Artifacts (Windows)
11173
if: matrix.os == 'windows-latest'
@@ -172,10 +134,6 @@ jobs:
172134
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platforms;android-35"
173135
cargo install --force cargo-apk
174136
175-
# Run from the workspace root (not from inside mobile/) so that Cargo
176-
# resolves the [workspace] section correctly and --package selects the
177-
# right crate. This is what prevents the android-game-activity vs.
178-
# android-native-activity feature-unification conflict.
179137
- name: Build Android
180138
if: matrix.target == 'android'
181139
working-directory: ${{ matrix.project.path }}
@@ -187,12 +145,6 @@ jobs:
187145
if: matrix.target == 'ios'
188146
run: rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
189147

190-
# Xcode calls build_rust_deps.sh which runs `cargo rustc --crate-type
191-
# staticlib --lib [--profile dist] --target aarch64-apple-ios`.
192-
# The root lib must NOT have `crate-type = ["cdylib", ...]` — doing so
193-
# causes Cargo to also produce a .dylib for iOS which the linker rejects
194-
# (it finds macOS SDK frameworks instead of iOS SDK ones).
195-
# That crate-type was removed from the root Cargo.toml.
196148
- name: Build iOS
197149
if: matrix.target == 'ios'
198150
working-directory: ${{ matrix.project.path }}

‎Miscellaneous/NonMarketHousingSimulation/Cargo.toml‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,9 @@ name = "non_market_housing_simulation"
33
version = "0.1.0"
44
edition = "2024"
55

6-
# The mobile crate is a separate entry point for Android and iOS.
7-
# It must be a workspace member so that Cargo resolves feature flags
8-
# across both crates together — without this, `cargo apk build --package mobile`
9-
# cannot find the root crate's workspace.
106
[workspace]
117
members = ["mobile"]
128

13-
# cdylib is intentionally absent.
14-
#
15-
# Previously "cdylib" was listed here to support compiling the lib directly as
16-
# a WASM module (via #[bevy_main]) and as a candidate dylib for Android. Both
17-
# of those roles are now gone:
18-
# • WASM → trunk compiles `main.rs` as the binary entry point; no cdylib needed.
19-
# • Mobile → the `mobile` crate is the cdylib/staticlib; this crate is rlib only.
20-
#
21-
# Keeping cdylib here caused `build_rust_deps.sh` (called by Xcode) to try to
22-
# produce a .dylib for aarch64-apple-ios, which fails because the linker picks
23-
# up macOS SDK frameworks instead of the iOS SDK ones.
249
[lib]
2510
crate-type = ["rlib"]
2611

@@ -37,8 +22,6 @@ codegen-units = 1
3722
strip = true
3823
panic = "abort"
3924

40-
# Used by the release workflow for distribution builds (--profile dist).
41-
# Inherits release but with maximum throughput opt-level instead of size.
4225
[profile.dist]
4326
inherits = "release"
4427
opt-level = 3
@@ -51,10 +34,6 @@ dev = [
5134
"bevy/dynamic_linking",
5235
]
5336

54-
# Bevy with explicit features — android-game-activity and android-native-activity
55-
# are intentionally omitted here. They are exclusive to the `mobile` crate.
56-
# Enabling either here would cause a Cargo feature-unification conflict when the
57-
# `mobile` crate (which depends on android-native-activity) is built.
5837
[dependencies]
5938
bevy = { version = "0.18", default-features = false, features = [
6039
"default_app",
@@ -70,7 +49,7 @@ bevy = { version = "0.18", default-features = false, features = [
7049
"bevy_winit",
7150
"default_font",
7251
"multi_threaded",
73-
"webgl2", # internally gated on wasm32; safe to include for all targets
52+
"webgl2",
7453
"x11",
7554
"wayland",
7655
"sysinfo_plugin",
@@ -102,8 +81,6 @@ web-sys = { version = "0.3", features = [
10281
send_wrapper = { version = "0.6", features = ["futures"] }
10382
console_error_panic_hook = "0.1"
10483

105-
# Required to make `rand`/`getrandom` work on wasm.
106-
# Backend is selected via `.cargo/config.toml` rustflags for wasm32-unknown-unknown.
10784
getrandom = { version = "0.3", features = ["wasm_js"] }
10885

10986
[build-dependencies]

‎Miscellaneous/NonMarketHousingSimulation/build/windows/installer/Installer.wixproj‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@
33
<PropertyGroup>
44
<DebugType>none</DebugType>
55
<OutputName>installer</OutputName>
6-
<!--
7-
WiX 4.0.0 has a known issue where publish events defined inside a
8-
custom <UI> fragment (InstallDirUi.wxs) are not recognised by the
9-
ICE17/20/31 validators even though they are correctly compiled into
10-
the MSI. Suppressing these three ICEs is the recommended workaround
11-
until WiX is updated to a version where this is fixed.
12-
ICE17 – button-event validation
13-
ICE20 – required dialog / property validation
14-
ICE31 – text-style validation
15-
-->
166
<SuppressIces>ICE17;ICE20;ICE31</SuppressIces>
177
</PropertyGroup>
188
<ItemGroup>

‎Miscellaneous/NonMarketHousingSimulation/src/lib.rs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ use crate::plugin::{MapConfig, MapSimulationPlugin};
3131
/// remote PMTiles URL. See the README for setup instructions.
3232
pub const RUN_LOCAL: bool = false;
3333

34-
const PMTILES_URL: &str =
35-
"https://content-spf.funguylabs.app/user-uploads/new-york.pmtiles";
34+
const PMTILES_URL: &str = "https://content-spf.funguylabs.app/user-uploads/new-york.pmtiles";
3635
const MBTILES_PATH: &str = "./res/new-york.mbtiles";
3736

3837
/// Top-level plugin for the simulation.
@@ -48,7 +47,7 @@ impl Plugin for AppPlugin {
4847
fn build(&self, app: &mut App) {
4948
let config = MapConfig {
5049
zoom: 14,
51-
origin_x: 4822, // centre of Manhattan at zoom 14
50+
origin_x: 4822, // center of Manhattan at zoom 14
5251
origin_y: 6160,
5352
lru_capacity: 25,
5453
..MapConfig::default()
@@ -63,7 +62,7 @@ impl Plugin for AppPlugin {
6362
}
6463
}
6564

66-
/// Spawns the directional sun light that illuminates the 3-D building meshes.
65+
/// Spawns the directional sun light that illuminates the 3d building meshes.
6766
fn setup_scene(mut commands: Commands) {
6867
commands.spawn((
6968
DirectionalLight {

‎Miscellaneous/NonMarketHousingSimulation/src/main.rs‎

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,23 @@ fn main() {
1111
console_error_panic_hook::set_once();
1212

1313
App::new()
14-
.add_plugins(
15-
DefaultPlugins.set(WindowPlugin {
16-
primary_window: Some(Window {
17-
title: "NYC Non-Market Housing Simulation".into(),
14+
.add_plugins(DefaultPlugins.set(WindowPlugin {
15+
primary_window: Some(Window {
16+
title: "NYC Non-Market Housing Simulation".into(),
1817

19-
// Desktop: open at a fixed resolution in borderless fullscreen.
20-
// WASM: resolution is ignored; the canvas is sized by CSS /
21-
// `fit_canvas_to_parent` instead.
22-
#[cfg(not(target_arch = "wasm32"))]
23-
resolution: (1400_u32, 900_u32).into(),
18+
#[cfg(not(target_arch = "wasm32"))]
19+
resolution: (1400_u32, 900_u32).into(),
2420

25-
#[cfg(not(target_arch = "wasm32"))]
26-
mode: WindowMode::BorderlessFullscreen(MonitorSelection::Primary),
21+
#[cfg(not(target_arch = "wasm32"))]
22+
mode: WindowMode::BorderlessFullscreen(MonitorSelection::Primary),
2723

28-
// Bind to the <canvas id="bevy"> element in index.html.
29-
canvas: Some("#bevy".to_owned()),
30-
fit_canvas_to_parent: true,
31-
// Let the browser handle F5 / Ctrl+R rather than Bevy.
32-
prevent_default_event_handling: false,
33-
34-
..default()
35-
}),
24+
canvas: Some("#bevy".to_owned()),
25+
fit_canvas_to_parent: true,
26+
prevent_default_event_handling: false,
3627
..default()
3728
}),
38-
)
29+
..default()
30+
}))
3931
.add_plugins(AppPlugin)
4032
.run();
4133
}

0 commit comments

Comments
 (0)