From a6519785cbeb1df6cf8f17445eb25aeb3ef4e18a Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Fri, 22 Apr 2022 21:16:35 +0200 Subject: [PATCH] Remove core crate --- .idea/maplibre-rs.iml | 2 +- Cargo.toml | 1 - maplibre-core/Cargo.toml | 85 --------- maplibre-core/src/lib.rs | 162 ----------------- maplibre/Cargo.toml | 82 ++++++++- {maplibre-core => maplibre}/build.rs | 0 .../src/benchmarking.rs | 0 {maplibre-core => maplibre}/src/coords.rs | 0 {maplibre-core => maplibre}/src/error.rs | 0 {maplibre-core => maplibre}/src/input/mod.rs | 0 .../src/input/pan_handler.rs | 0 .../src/input/pinch_handler.rs | 0 .../src/input/query_handler.rs | 0 .../src/input/shift_handler.rs | 0 .../src/input/tilt_handler.rs | 0 .../src/input/zoom_handler.rs | 0 .../src/io/geometry_index.rs | 0 {maplibre-core => maplibre}/src/io/mod.rs | 0 .../src/io/scheduler.rs | 0 .../src/io/shared_thread_state.rs | 0 .../src/io/source_client.rs | 0 .../src/io/static_tile_fetcher.rs | 0 .../src/io/tile_cache.rs | 0 .../src/io/tile_request_state.rs | 0 maplibre/src/lib.rs | 163 +++++++++++++++++- {maplibre-core => maplibre}/src/map_state.rs | 0 .../src/platform/mod.rs | 0 .../src/platform/noweb/http_client.rs | 0 .../src/platform/noweb/mod.rs | 0 .../src/platform/noweb/schedule_method.rs | 0 .../src/platform/web/http_client.rs | 0 .../platform/web/legacy_webworker_fetcher.rs | 0 .../src/platform/web/mod.rs | 0 .../src/platform/web/pool.rs | 0 .../src/platform/web/schedule_method.rs | 0 .../src/render/buffer_pool.rs | 0 .../src/render/camera.rs | 0 {maplibre-core => maplibre}/src/render/mod.rs | 0 .../src/render/options.rs | 0 .../src/render/piplines.rs | 0 .../src/render/render_state.rs | 0 .../src/render/shaders/mod.rs | 0 .../src/render/shaders/tile.fragment.wgsl | 0 .../src/render/shaders/tile.vertex.wgsl | 0 .../render/shaders/tile_mask.fragment.wgsl | 0 .../src/render/shaders/tile_mask.vertex.wgsl | 0 .../src/render/texture.rs | 0 .../src/render/tile_view_pattern.rs | 0 .../src/style/layer.rs | 0 {maplibre-core => maplibre}/src/style/mod.rs | 0 .../src/style/source.rs | 0 .../src/style/style.rs | 0 .../src/tessellation/mod.rs | 0 .../src/tessellation/zero_tessellator.rs | 0 .../src/tilejson/mod.rs | 0 .../src/tilejson/tilejson.rs | 0 .../src/util/fps_meter.rs | 0 {maplibre-core => maplibre}/src/util/grid.rs | 0 {maplibre-core => maplibre}/src/util/math.rs | 0 {maplibre-core => maplibre}/src/util/mod.rs | 0 {maplibre-core => maplibre}/src/window.rs | 0 {maplibre-core => maplibre}/src/winit.rs | 0 .../style-spec-v8.json | 0 web/Cargo.toml | 6 +- 64 files changed, 243 insertions(+), 258 deletions(-) delete mode 100644 maplibre-core/Cargo.toml delete mode 100644 maplibre-core/src/lib.rs rename {maplibre-core => maplibre}/build.rs (100%) rename {maplibre-core => maplibre}/src/benchmarking.rs (100%) rename {maplibre-core => maplibre}/src/coords.rs (100%) rename {maplibre-core => maplibre}/src/error.rs (100%) rename {maplibre-core => maplibre}/src/input/mod.rs (100%) rename {maplibre-core => maplibre}/src/input/pan_handler.rs (100%) rename {maplibre-core => maplibre}/src/input/pinch_handler.rs (100%) rename {maplibre-core => maplibre}/src/input/query_handler.rs (100%) rename {maplibre-core => maplibre}/src/input/shift_handler.rs (100%) rename {maplibre-core => maplibre}/src/input/tilt_handler.rs (100%) rename {maplibre-core => maplibre}/src/input/zoom_handler.rs (100%) rename {maplibre-core => maplibre}/src/io/geometry_index.rs (100%) rename {maplibre-core => maplibre}/src/io/mod.rs (100%) rename {maplibre-core => maplibre}/src/io/scheduler.rs (100%) rename {maplibre-core => maplibre}/src/io/shared_thread_state.rs (100%) rename {maplibre-core => maplibre}/src/io/source_client.rs (100%) rename {maplibre-core => maplibre}/src/io/static_tile_fetcher.rs (100%) rename {maplibre-core => maplibre}/src/io/tile_cache.rs (100%) rename {maplibre-core => maplibre}/src/io/tile_request_state.rs (100%) rename {maplibre-core => maplibre}/src/map_state.rs (100%) rename {maplibre-core => maplibre}/src/platform/mod.rs (100%) rename {maplibre-core => maplibre}/src/platform/noweb/http_client.rs (100%) rename {maplibre-core => maplibre}/src/platform/noweb/mod.rs (100%) rename {maplibre-core => maplibre}/src/platform/noweb/schedule_method.rs (100%) rename {maplibre-core => maplibre}/src/platform/web/http_client.rs (100%) rename {maplibre-core => maplibre}/src/platform/web/legacy_webworker_fetcher.rs (100%) rename {maplibre-core => maplibre}/src/platform/web/mod.rs (100%) rename {maplibre-core => maplibre}/src/platform/web/pool.rs (100%) rename {maplibre-core => maplibre}/src/platform/web/schedule_method.rs (100%) rename {maplibre-core => maplibre}/src/render/buffer_pool.rs (100%) rename {maplibre-core => maplibre}/src/render/camera.rs (100%) rename {maplibre-core => maplibre}/src/render/mod.rs (100%) rename {maplibre-core => maplibre}/src/render/options.rs (100%) rename {maplibre-core => maplibre}/src/render/piplines.rs (100%) rename {maplibre-core => maplibre}/src/render/render_state.rs (100%) rename {maplibre-core => maplibre}/src/render/shaders/mod.rs (100%) rename {maplibre-core => maplibre}/src/render/shaders/tile.fragment.wgsl (100%) rename {maplibre-core => maplibre}/src/render/shaders/tile.vertex.wgsl (100%) rename {maplibre-core => maplibre}/src/render/shaders/tile_mask.fragment.wgsl (100%) rename {maplibre-core => maplibre}/src/render/shaders/tile_mask.vertex.wgsl (100%) rename {maplibre-core => maplibre}/src/render/texture.rs (100%) rename {maplibre-core => maplibre}/src/render/tile_view_pattern.rs (100%) rename {maplibre-core => maplibre}/src/style/layer.rs (100%) rename {maplibre-core => maplibre}/src/style/mod.rs (100%) rename {maplibre-core => maplibre}/src/style/source.rs (100%) rename {maplibre-core => maplibre}/src/style/style.rs (100%) rename {maplibre-core => maplibre}/src/tessellation/mod.rs (100%) rename {maplibre-core => maplibre}/src/tessellation/zero_tessellator.rs (100%) rename {maplibre-core => maplibre}/src/tilejson/mod.rs (100%) rename {maplibre-core => maplibre}/src/tilejson/tilejson.rs (100%) rename {maplibre-core => maplibre}/src/util/fps_meter.rs (100%) rename {maplibre-core => maplibre}/src/util/grid.rs (100%) rename {maplibre-core => maplibre}/src/util/math.rs (100%) rename {maplibre-core => maplibre}/src/util/mod.rs (100%) rename {maplibre-core => maplibre}/src/window.rs (100%) rename {maplibre-core => maplibre}/src/winit.rs (100%) rename {maplibre-core => maplibre}/style-spec-v8.json (100%) diff --git a/.idea/maplibre-rs.iml b/.idea/maplibre-rs.iml index ec2f058d..761714ba 100644 --- a/.idea/maplibre-rs.iml +++ b/.idea/maplibre-rs.iml @@ -6,10 +6,10 @@ - + diff --git a/Cargo.toml b/Cargo.toml index f4a1279e..cc6952cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,6 @@ resolver = "2" members = [ "maplibre", - "maplibre-core", "maplibre-build-tools", "maplibre-demo", diff --git a/maplibre-core/Cargo.toml b/maplibre-core/Cargo.toml deleted file mode 100644 index b209ceba..00000000 --- a/maplibre-core/Cargo.toml +++ /dev/null @@ -1,85 +0,0 @@ -[package] -name = "maplibre-core" -version = "0.1.0" -authors = ["Maximilian Ammann "] -edition = "2021" -build = "build.rs" -license = "MIT OR Apache-2.0" - -[features] -web-webgl = ["wgpu/webgl"] -# Enable tracing using tracy on desktop/mobile and the chrome profiler on web -enable-tracing = [ "tracing-subscriber", "tracing-tracy", "tracy-client", "tracing-wasm"] -default = [] - -[target.'cfg(target_arch = "wasm32")'.dependencies] -console_error_panic_hook = "0.1" -web-sys = { version = "0.3", features = [ - "Window", - "Headers", - "WorkerGlobalScope", "Request", "RequestInit", "RequestMode", "Response", - "ErrorEvent", "DedicatedWorkerGlobalScope" -] } -js-sys = "0.3" -wasm-bindgen = "0.2" -wasm-bindgen-futures = "0.4" -console_log = { version = "0.2", features = ["color"] } -tracing-wasm = { version = "0.2", optional = true } # FIXME: Low quality dependency -instant = { version = "0.1", features = ["wasm-bindgen"] } # FIXME: Untrusted dependency - -[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "linux", target_os = "android"))'.dependencies] -tokio = { version = "1.17", features = ["macros", "rt", "rt-multi-thread", "sync", "time"] } -env_logger = "0.9" -reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "gzip"] } -reqwest-middleware-cache = "0.1" # FIXME: Untrusted dependency -reqwest-middleware = { version = "0.1" } # FIXME: Untrusted dependency -tracing-tracy = { version = "0.8", optional = true } -tracy-client = { version = "0.12.7", optional = true } - -[target.'cfg(target_os = "android")'.dependencies] -winit = { version = "0.26", default-features = false } -# Use rusttls on android because cross compiling is difficult -reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "gzip"] } - -[target.'cfg(target_os = "linux")'.dependencies] -winit = { version = "0.26", default-features = false, features = ["x11", "wayland"] } - -[dependencies] -winit = { version = "0.26", default-features = false } - -raw-window-handle = "0.4" - -tracing = { version = "0.1" } -tracing-subscriber = { version = "0.3", optional = true } - -cgmath = "0.18" - -geo = { version = "0.19" } -geo-types = { version = "0.7", features = ["use-rstar_0_9"] } -rstar = { version = "0.9" } -prost = "0.9" -geozero = { git = "https://github.com/georust/geozero", rev = "373b731", default-features = false, features = ["with-mvt", "with-geo"]} - -tile-grid = "0.3" - -# Rendering -wgpu = { version = "0.12" } -lyon = { version = "0.17", features = [] } - -# cached = "0.32" - -# Logging -log = "0.4" - -# Utils -bytemuck = "1.2.0" -bytemuck_derive = "1.0" - -include_dir = "0.7.2" - -serde = { version = "1.0", features = ["derive"] } -csscolorparser = { version = "0.5", features = ["serde", "cint"]} -cint = "0.2" - -[build-dependencies] -maplibre-build-tools = { path = "../maplibre-build-tools" } diff --git a/maplibre-core/src/lib.rs b/maplibre-core/src/lib.rs deleted file mode 100644 index e35baaaf..00000000 --- a/maplibre-core/src/lib.rs +++ /dev/null @@ -1,162 +0,0 @@ -use crate::io::scheduler::Scheduler; - -mod input; - -pub(crate) mod coords; -pub(crate) mod error; -pub(crate) mod io; -pub(crate) mod map_state; -pub(crate) mod platform; -pub(crate) mod render; -pub(crate) mod tessellation; -pub(crate) mod util; -pub(crate) mod winit; -pub(crate) mod style; -pub(crate) mod tilejson; - -// Used for benchmarking -pub mod benchmarking; -pub mod window; - -use crate::map_state::{MapState, Runnable}; -use crate::render::render_state::RenderState; -use crate::window::{WindowFactory, WindowSize}; -pub use io::scheduler::ScheduleMethod; -use crate::style::Style; -pub use platform::schedule_method::*; - -pub struct Map { - map_state: MapState, - event_loop: E, -} - -impl Map -where - MapState: Runnable, -{ - pub fn run(self) { - self.run_with_optionally_max_frames(None); - } - - pub fn run_with_max_frames(self, max_frames: u64) { - self.run_with_optionally_max_frames(Some(max_frames)); - } - - pub fn run_with_optionally_max_frames(self, max_frames: Option) { - self.map_state.run(self.event_loop, max_frames); - } -} - -pub struct UninitializedMap { - window: W, - window_size: WindowSize, - event_loop: E, - scheduler: Scheduler, - style: Style, -} - -impl UninitializedMap -where - W: raw_window_handle::HasRawWindowHandle, -{ - pub async fn initialize(self) -> Map { - let render_state = RenderState::initialize(&self.window, self.window_size).await; - Map { - map_state: MapState::new( - self.window, - self.window_size, - render_state, - self.scheduler, - self.style, - ), - event_loop: self.event_loop, - } - } -} - -#[cfg(not(target_arch = "wasm32"))] -impl UninitializedMap -where - W: raw_window_handle::HasRawWindowHandle, - MapState: Runnable, -{ - pub fn run_sync(self) { - self.run_sync_with_optionally_max_frames(None); - } - - pub fn run_sync_with_max_frames(self, max_frames: u64) { - self.run_sync_with_optionally_max_frames(Some(max_frames)) - } - - fn run_sync_with_optionally_max_frames(self, max_frames: Option) { - tokio::runtime::Builder::new_multi_thread() - .worker_threads(4) - .enable_io() - .enable_time() - .on_thread_start(|| { - #[cfg(feature = "enable-tracing")] - tracy_client::set_thread_name("tokio-runtime-worker"); - }) - .build() - .unwrap() - .block_on(async { - self.initialize() - .await - .run_with_optionally_max_frames(max_frames); - }) - } -} - -pub struct MapBuilder { - window_factory: Box>, - schedule_method: Option, - scheduler: Option, - style: Option