You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by di...@apache.org on 2021/02/09 05:05:21 UTC

[incubator-teaclave-sgx-sdk] branch stable-support created (now 3684607)

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

dingyu pushed a change to branch stable-support
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git.


      at 3684607  support stable and beta

This branch includes the following new commits:

     new 3684607  support stable and beta

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-teaclave-sgx-sdk] 01/01: support stable and beta

Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dingyu pushed a commit to branch stable-support
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git

commit 3684607027ed04688f997b19b77ba9ebfb2cddea
Author: Yu Ding <di...@gmail.com>
AuthorDate: Mon Feb 8 21:05:01 2021 -0800

    support stable and beta
---
 rust-toolchain    |  5 ++++-
 sgx_tstd/build.rs | 47 +++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/rust-toolchain b/rust-toolchain
index 148ed93..3fa5fa3 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1 +1,4 @@
-nightly-2020-10-25
+[toolchain]
+channel = "nightly-2020-10-25"
+#channel = "beta-2020-11-18"
+#channel = "stable-2020-12-31"
diff --git a/sgx_tstd/build.rs b/sgx_tstd/build.rs
index e0fd1d9..9f7ae83 100644
--- a/sgx_tstd/build.rs
+++ b/sgx_tstd/build.rs
@@ -42,8 +42,23 @@ fn main() {
     // since nightly-2020-11-26 (rustc 2020-11-25), auto_traits replaced
     // optin_builtin_traits
     // see https://github.com/rust-lang/rust/commit/810324d1f31eb8d75e8f0044df720652986ef133
-    if let Some(true) = is_min_date("2020-11-25") {
-        println!("cargo:rustc-cfg=enable_auto_traits");
+    match get_channel() {
+        Some(Kind::Nightly) => {
+            if let Some(true) = is_min_date("2020-11-25") {
+                println!("cargo:rustc-cfg=enable_auto_traits");
+            }
+        },
+        Some(Kind::Beta) => {
+            if let Some(true) = is_min_date("2021-01-06") {
+                println!("cargo:rustc-cfg=enable_auto_traits"); // 2020-11-25 + 6 weeks
+            }
+        },
+        Some(Kind::Stable) => {
+            if let Some(true) = is_min_date("2021-02-27") { // 2020-11-25 + 12 weeks
+                println!("cargo:rustc-cfg=enable_auto_traits");
+            }
+        },
+        _ => {},
     }
 }
 
@@ -97,3 +112,31 @@ fn is_min_date(min_date: &str) -> Option<bool> {
         _ => None
     }
 }
+
+#[derive(Debug, PartialEq, Eq, Copy, Clone)]
+enum Kind {
+    Dev,
+    Nightly,
+    Beta,
+    Stable,
+}
+
+fn get_channel() -> Option<Kind> {
+    get_version_and_date()
+        .and_then(|(version, _)| version)
+        .and_then(|version| parse_channel(&version))
+}
+
+fn parse_channel(version: &str) -> Option<Kind> {
+    if version.contains("-dev") {
+        Some(Kind::Dev)
+    } else if version.contains("-nightly") {
+        Some(Kind::Nightly)
+    } else if version.contains("-beta") {
+        Some(Kind::Beta)
+    } else if !version.contains("-") {
+        Some(Kind::Stable)
+    } else {
+        None
+    }
+}


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