You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/03/28 06:45:59 UTC

[incubator-teaclave] 01/02: [config] Introduce the build_config feature to disable build config

This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git

commit 8cfbe6c53944b1f0191249c8a963f11a60767299
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Fri Mar 27 22:53:16 2020 -0700

    [config] Introduce the build_config feature to disable build config
---
 attestation/Cargo.toml                     |  2 +-
 config/Cargo.toml                          |  1 +
 config/build.rs                            | 14 +++++++++-----
 config/src/lib.rs                          |  2 ++
 services/access_control/enclave/Cargo.toml |  1 +
 services/execution/enclave/Cargo.toml      |  1 +
 services/frontend/enclave/Cargo.toml       |  1 +
 services/management/enclave/Cargo.toml     |  1 +
 services/scheduler/enclave/Cargo.toml      |  1 +
 tests/functional/enclave/Cargo.toml        |  1 +
 10 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/attestation/Cargo.toml b/attestation/Cargo.toml
index db741e2..251fd86 100644
--- a/attestation/Cargo.toml
+++ b/attestation/Cargo.toml
@@ -38,7 +38,7 @@ url              = { version = "2.1.1" }
 yasna            = { version = "0.3.0", features = ["bit-vec", "num-bigint", "chrono"] }
 
 teaclave_types  = { path = "../types" }
-teaclave_config = { path = "../config" }
+teaclave_config = { path = "../config", features = ["build_config"] }
 teaclave_test_utils = { path = "../tests/utils" }
 
 sgx_rand    = { version = "1.1.0", optional = true }
diff --git a/config/Cargo.toml b/config/Cargo.toml
index f3825e3..b5600bd 100644
--- a/config/Cargo.toml
+++ b/config/Cargo.toml
@@ -9,6 +9,7 @@ edition = "2018"
 [features]
 default = []
 mesalock_sgx = ["sgx_tstd"]
+build_config = []
 
 [dependencies]
 anyhow = { version = "1.0.26" }
diff --git a/config/build.rs b/config/build.rs
index 31ed439..a7a3ae4 100644
--- a/config/build.rs
+++ b/config/build.rs
@@ -15,12 +15,13 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::env;
-use std::path::Path;
-use std::process::Command;
-use std::str;
-
+#[cfg(feature = "build_config")]
 fn main() {
+    use std::env;
+    use std::path::Path;
+    use std::process::Command;
+    use std::str;
+
     let is_sim = env::var("SGX_MODE").unwrap_or_else(|_| "HW".to_string());
     match is_sim.as_ref() {
         "HW" => {}
@@ -58,3 +59,6 @@ fn main() {
         );
     }
 }
+
+#[cfg(not(feature = "build_config"))]
+fn main() {}
diff --git a/config/src/lib.rs b/config/src/lib.rs
index 1ca24e2..6b075df 100644
--- a/config/src/lib.rs
+++ b/config/src/lib.rs
@@ -29,8 +29,10 @@ pub(crate) enum ConfigSource {
     Path(PathBuf),
 }
 
+#[cfg(feature = "build_config")]
 mod build;
 mod runtime;
 
+#[cfg(feature = "build_config")]
 pub use build::BUILD_CONFIG;
 pub use runtime::RuntimeConfig;
diff --git a/services/access_control/enclave/Cargo.toml b/services/access_control/enclave/Cargo.toml
index 5c34b48..a30680e 100644
--- a/services/access_control/enclave/Cargo.toml
+++ b/services/access_control/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/services/execution/enclave/Cargo.toml b/services/execution/enclave/Cargo.toml
index 296b052..cb14b5e 100644
--- a/services/execution/enclave/Cargo.toml
+++ b/services/execution/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
   "teaclave_worker/mesalock_sgx",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
diff --git a/services/frontend/enclave/Cargo.toml b/services/frontend/enclave/Cargo.toml
index 028899a..c3f73a3 100644
--- a/services/frontend/enclave/Cargo.toml
+++ b/services/frontend/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/services/management/enclave/Cargo.toml b/services/management/enclave/Cargo.toml
index 3a6ef96..bbd07ce 100644
--- a/services/management/enclave/Cargo.toml
+++ b/services/management/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/services/scheduler/enclave/Cargo.toml b/services/scheduler/enclave/Cargo.toml
index 90fcd43..7c2a7da 100644
--- a/services/scheduler/enclave/Cargo.toml
+++ b/services/scheduler/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/tests/functional/enclave/Cargo.toml b/tests/functional/enclave/Cargo.toml
index 4ffec03..7c90813 100644
--- a/tests/functional/enclave/Cargo.toml
+++ b/tests/functional/enclave/Cargo.toml
@@ -19,6 +19,7 @@ mesalock_sgx = [
   "teaclave_binder/mesalock_sgx",
   "teaclave_rpc/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_test_utils/mesalock_sgx",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org