This is an automated email from the ASF dual-hosted git repository.
mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
The following commit(s) were added to refs/heads/master by this push:
new 64fdb4d Don't use offline to build the proto when not within
Teaclave's build system (#467)
64fdb4d is described below
commit 64fdb4dbd5f060e2da5470c9042e8b1be29ef116
Author: Mingshen Sun <[email protected]>
AuthorDate: Thu Jan 21 17:20:04 2021 -0800
Don't use offline to build the proto when not within Teaclave's build
system (#467)
---
services/proto/build.rs | 47 +++++++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/services/proto/build.rs b/services/proto/build.rs
index 31ac30f..e3b92b1 100644
--- a/services/proto/build.rs
+++ b/services/proto/build.rs
@@ -53,30 +53,33 @@ fn main() {
Err(_) => Path::new("../../").into(),
};
- let c = Command::new("cargo")
- .current_dir(¤t_dir)
- .args(&[
- "run",
- "--target-dir",
- &target_dir.to_string_lossy(),
- "--manifest-path",
- "services/proto/proto_gen/Cargo.toml",
- "--offline",
- "--",
- "-i",
- "services/proto/src/proto",
- "-d",
- &out_dir,
- "-p",
- ])
- .args(&proto_files)
- .output()
- .expect("Generate proto failed");
- if !c.status.success() {
+ // Use the offline flag when building within Teaclave's build system.
+ let offline = if env::var("MT_SGXAPP_TOML_DIR").is_ok() {
+ true
+ } else {
+ false
+ };
+
+ let mut c = Command::new("cargo");
+ c.current_dir(¤t_dir);
+ c.args(&[
+ "run",
+ "--target-dir",
+ &target_dir.to_string_lossy(),
+ "--manifest-path",
+ "services/proto/proto_gen/Cargo.toml",
+ ]);
+ if offline {
+ c.arg("--offline");
+ }
+ c.args(&["--", "-i", "services/proto/src/proto", "-d", &out_dir, "-p"])
+ .args(&proto_files);
+ let output = c.output().expect("Generate proto failed");
+ if !output.status.success() {
panic!(
"stdout: {:?}, stderr: {:?}",
- str::from_utf8(&c.stderr).unwrap(),
- str::from_utf8(&c.stderr).unwrap()
+ str::from_utf8(&output.stderr).unwrap(),
+ str::from_utf8(&output.stderr).unwrap()
);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]