Browse Source

app: use cargo features to enable switching between schema layouts

jkds 7 months ago
parent
commit
8028ea9b10
2 changed files with 13 additions and 0 deletions
  1. 6 0
      bin/app/Cargo.toml
  2. 7 0
      bin/app/src/app/mod.rs

+ 6 - 0
bin/app/Cargo.toml

@@ -71,12 +71,18 @@ indoc = "2.0.7"
 opt-level = 3
 
 [features]
+default = ["enable-plugins", "schema-app"]
 emulate-android = []
 enable-plugins = []
 enable-filelog = []
 # Network debugging. Should be disabled in release.
 enable-netdebug = []
 
+# Main app schema layout
+schema-app = []
+# Dev schema for testing
+schema-test = []
+
 [patch.crates-io]
 # We can remove these patches. But unfortunately harfbuzz-sys is still linking
 # the old freetype libs so we need to fix that first.

+ 7 - 0
bin/app/src/app/mod.rs

@@ -141,8 +141,15 @@ impl App {
         self.sg_root.link(window.clone());
         self.sg_root.link(setting_root.clone());
 
+        #[cfg(feature = "schema-app")]
         schema::make(&self, window.clone(), &i18n_fish).await;
 
+        #[cfg(feature = "schema-test")]
+        schema::test::make(&self, window.clone(), &i18n_fish).await;
+
+        #[cfg(all(feature = "schema-app", feature = "schema-test"))]
+        compile_error!("Only one schema can be selected");
+
         //settings::make(&self, window, self.ex.clone()).await;
 
         d!("Schema loaded");