diff --git a/api-server-rest/build.rs b/api-server-rest/build.rs index 781cbc9a4..7d9b6afee 100644 --- a/api-server-rest/build.rs +++ b/api-server-rest/build.rs @@ -88,23 +88,6 @@ fn main() -> std::io::Result<()> { ]; let protobuf_customized = ProtobufCustomize::default().gen_mod_rs(false); - use std::fs::File; - use std::io::{Read, Write}; - - fn replace_text_in_file(file_name: &str, from: &str, to: &str) -> Result<(), std::io::Error> { - let mut src = File::open(file_name)?; - let mut contents = String::new(); - src.read_to_string(&mut contents).unwrap(); - drop(src); - - let new_contents = contents.replace(from, to); - - let mut dst = File::create(file_name)?; - dst.write_all(new_contents.as_bytes())?; - - Ok(()) - } - Codegen::new() .out_dir("src/ttrpc_proto") .inputs(&protos) @@ -118,17 +101,6 @@ fn main() -> std::io::Result<()> { .run() .expect("Generate ttrpc protocol code failed."); - // Fix clippy warnings of code generated from ttrpc_codegen - replace_text_in_file( - "src/ttrpc_proto/attestation_agent_ttrpc.rs", - "#![allow(box_pointers)]\n", - "", - )?; - replace_text_in_file( - "src/ttrpc_proto/confidential_data_hub_ttrpc.rs", - "#![allow(box_pointers)]\n", - "", - )?; generate_openapi_document().expect("Generate restful OpenAPI yaml failed."); Ok(()) diff --git a/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent.rs b/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent.rs index 69634d962..4b6cfcac1 100644 --- a/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent.rs +++ b/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.5.0. Do not edit +// This file is generated by rust-protobuf 3.5.1. Do not edit // .proto file is parsed by pure // @generated @@ -9,7 +9,6 @@ #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] -#![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] @@ -23,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_5_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_5_1; // @@protoc_insertion_point(message:attestation_agent.GetEvidenceRequest) #[derive(PartialEq,Clone,Default,Debug)] diff --git a/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent_ttrpc.rs b/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent_ttrpc.rs index baa18f5b7..50e1b0929 100644 --- a/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent_ttrpc.rs +++ b/attestation-agent/attestation-agent/src/bin/ttrpc-aa/ttrpc_protocol/attestation_agent_ttrpc.rs @@ -1,10 +1,9 @@ -// This file is generated by ttrpc-compiler 0.6.2. Do not edit +// This file is generated by ttrpc-compiler 0.6.3. Do not edit // @generated #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unknown_lints)] #![allow(clipto_camel_casepy)] -#![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] @@ -64,7 +63,7 @@ impl AttestationAgentServiceClient { } struct GetEvidenceMethod { - service: Arc>, + service: Arc, } #[async_trait] @@ -75,7 +74,7 @@ impl ::ttrpc::r#async::MethodHandler for GetEvidenceMethod { } struct GetTokenMethod { - service: Arc>, + service: Arc, } #[async_trait] @@ -86,7 +85,7 @@ impl ::ttrpc::r#async::MethodHandler for GetTokenMethod { } struct ExtendRuntimeMeasurementMethod { - service: Arc>, + service: Arc, } #[async_trait] @@ -97,7 +96,7 @@ impl ::ttrpc::r#async::MethodHandler for ExtendRuntimeMeasurementMethod { } struct CheckInitDataMethod { - service: Arc>, + service: Arc, } #[async_trait] @@ -108,7 +107,7 @@ impl ::ttrpc::r#async::MethodHandler for CheckInitDataMethod { } struct UpdateConfigurationMethod { - service: Arc>, + service: Arc, } #[async_trait] @@ -119,7 +118,7 @@ impl ::ttrpc::r#async::MethodHandler for UpdateConfigurationMethod { } struct GetTeeTypeMethod { - service: Arc>, + service: Arc, } #[async_trait] @@ -151,7 +150,7 @@ pub trait AttestationAgentService: Sync { } } -pub fn create_attestation_agent_service(service: Arc>) -> HashMap { +pub fn create_attestation_agent_service(service: Arc) -> HashMap { let mut ret = HashMap::new(); let mut methods = HashMap::new(); let streams = HashMap::new(); diff --git a/attestation-agent/kbs_protocol/build.rs b/attestation-agent/kbs_protocol/build.rs index 704457c90..5bb896da4 100644 --- a/attestation-agent/kbs_protocol/build.rs +++ b/attestation-agent/kbs_protocol/build.rs @@ -46,11 +46,6 @@ fn main() -> Result<(), Box> { "client: client", "client", )?; - replace_text_in_file( - "src/token_provider/aa/attestation_agent_ttrpc.rs", - "#![allow(box_pointers)]\n", - "", - )?; } Ok(()) diff --git a/confidential-data-hub/hub/build.rs b/confidential-data-hub/hub/build.rs index 7d930f81c..a87a5612a 100644 --- a/confidential-data-hub/hub/build.rs +++ b/confidential-data-hub/hub/build.rs @@ -51,16 +51,6 @@ fn main() { // Fix clippy warnings of code generated from ttrpc_codegen replace_text_in_file("src/bin/protos/api_ttrpc.rs", "client: client", "client"); - replace_text_in_file( - "src/bin/protos/api_ttrpc.rs", - "#![allow(box_pointers)]\n", - "", - ); - replace_text_in_file( - "src/bin/protos/keyprovider_ttrpc.rs", - "#![allow(box_pointers)]\n", - "", - ); } #[cfg(feature = "bin")] diff --git a/image-rs/build.rs b/image-rs/build.rs index e07ba4dd0..1399e2c96 100644 --- a/image-rs/build.rs +++ b/image-rs/build.rs @@ -3,53 +3,21 @@ // SPDX-License-Identifier: Apache-2.0 // -fn main() -> Result<(), Box> { +fn main() { #[cfg(feature = "tonic-build")] tonic_build::compile_protos("./protos/getresource.proto").expect("tonic build"); #[cfg(feature = "ttrpc-codegen")] - { - use std::fs::File; - use std::io::{Read, Write}; - - fn replace_text_in_file( - file_name: &str, - from: &str, - to: &str, - ) -> Result<(), std::io::Error> { - let mut src = File::open(file_name)?; - let mut contents = String::new(); - src.read_to_string(&mut contents).unwrap(); - drop(src); - - let new_contents = contents.replace(from, to); - - let mut dst = File::create(file_name)?; - dst.write_all(new_contents.as_bytes())?; - - Ok(()) - } - - ttrpc_codegen::Codegen::new() - .out_dir("./src/resource/kbs/ttrpc_proto") - .input("./protos/getresource.proto") - .include("./protos") - .rust_protobuf() - .customize(ttrpc_codegen::Customize { - async_all: true, - ..Default::default() - }) - .rust_protobuf_customize(ttrpc_codegen::ProtobufCustomize::default().gen_mod_rs(false)) - .run() - .expect("ttrpc build"); - - // Fix clippy warnings of code generated from ttrpc_codegen - replace_text_in_file( - "src/resource/kbs/ttrpc_proto/getresource_ttrpc.rs", - "#![allow(box_pointers)]\n", - "", - )?; - } - - Ok(()) + ttrpc_codegen::Codegen::new() + .out_dir("./src/resource/kbs/ttrpc_proto") + .input("./protos/getresource.proto") + .include("./protos") + .rust_protobuf() + .customize(ttrpc_codegen::Customize { + async_all: true, + ..Default::default() + }) + .rust_protobuf_customize(ttrpc_codegen::ProtobufCustomize::default().gen_mod_rs(false)) + .run() + .expect("ttrpc build"); } diff --git a/ocicrypt-rs/build.rs b/ocicrypt-rs/build.rs index 70d102daf..fb12e2557 100644 --- a/ocicrypt-rs/build.rs +++ b/ocicrypt-rs/build.rs @@ -50,11 +50,6 @@ fn main() -> Result<(), Box> { "client: client", "client", )?; - replace_text_in_file( - "src/utils/ttrpc/keyprovider_ttrpc.rs", - "#![allow(box_pointers)]\n", - "", - )?; } Ok(())