瀏覽代碼

spl: Feature gate modules and only enable token, mint, and associated token by default (#973)

Paul 3 年之前
父節點
當前提交
54f24e5596
共有 2 個文件被更改,包括 20 次插入4 次删除
  1. 7 2
      spl/Cargo.toml
  2. 13 2
      spl/src/lib.rs

+ 7 - 2
spl/Cargo.toml

@@ -7,12 +7,17 @@ license = "Apache-2.0"
 description = "CPI clients for SPL programs"
 
 [features]
+default = ["mint", "token", "associated_token"]
+mint = []
+token = []
+associated_token = []
+governance = []
+shmem = []
 devnet = []
 
 [dependencies]
 anchor-lang = { path = "../lang", version = "0.18.0", features = ["derive"] }
-lazy_static = "1.4.0"
-serum_dex = { git = "https://github.com/project-serum/serum-dex", rev = "1be91f2", version = "0.4.0", features = ["no-entrypoint"] }
+serum_dex = { git = "https://github.com/project-serum/serum-dex", rev = "1be91f2", version = "0.4.0", features = ["no-entrypoint"], optional = true}
 solana-program = "1.8.0"
 spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
 spl-associated-token-account = { version = "1.0.3", features = ["no-entrypoint"] }

+ 13 - 2
spl/src/lib.rs

@@ -1,6 +1,17 @@
+#[cfg(feature = "associated_token")]
 pub mod associated_token;
+
+#[cfg(feature = "mint")]
+pub mod mint;
+
+#[cfg(feature = "token")]
+pub mod token;
+
+#[cfg(feature = "serum_dex")]
 pub mod dex;
+
+#[cfg(feature = "governance")]
 pub mod governance;
-pub mod mint;
+
+#[cfg(feature = "shmem")]
 pub mod shmem;
-pub mod token;