diff --git a/.gitignore b/.gitignore index d5ef446..b0bdb25 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ build dist *.egg-info .vscode -python/secretflowapis \ No newline at end of file +python/secretflowapis +Cargo.lock \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a53b475 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "sdc_apis" +version = "0.2.1-dev20240222" +edition = "2021" +description = "SecretFlow Data Capsule apis proto generated Rust" +readme = "README.md" +repository = "https://github.com/secretflow/secure-data-capsule-apis.git" +license-file = "LICENSE" +include = ["secretflowapis", "lib.rs", "build.rs"] + + +[lib] +name = "sdc_apis" +path = "lib.rs" + +[dependencies] +tonic = "0.9.2" +prost = "0.11" +prost-types = "0.11.1" +serde = { version = "1.0", features = ["derive"] } +prost-wkt = "0.4" +prost-wkt-types = "0.4" + +[build-dependencies] +tonic-build = "0.9.2" +prost-wkt-build = "0.4" + diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..35c1640 --- /dev/null +++ b/build.rs @@ -0,0 +1,27 @@ +// Copyright 2023 Ant Group Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +fn main() -> Result<(), Box> { + // compile protobuf + tonic_build::configure() + .type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]") + .field_attribute("protected_header", "#[serde(rename=\"protected\")]") + .field_attribute(".secretflowapis.v2.sdc", "#[serde(default)]") + .extern_path(".google.protobuf.Any", "::prost_wkt_types::Any") + .compile( + &["secretflowapis/v2/sdc/capsule_manager/capsule_manager.proto"], + &["."], // specify the root location to search proto dependencies + )?; + Ok(()) +} diff --git a/lib.rs b/lib.rs new file mode 100644 index 0000000..482da24 --- /dev/null +++ b/lib.rs @@ -0,0 +1,25 @@ +// Copyright 2023 Ant Group Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub mod secretflowapis { + pub mod v2 { + tonic::include_proto!("secretflowapis.v2"); + pub mod sdc { + tonic::include_proto!("secretflowapis.v2.sdc"); + pub mod capsule_manager { + tonic::include_proto!("secretflowapis.v2.sdc.capsule_manager"); + } + } + } +} diff --git a/python/setup.py b/python/setup.py index 1bb2d33..111be9f 100644 --- a/python/setup.py +++ b/python/setup.py @@ -24,5 +24,8 @@ def read(fname): "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], + options={ + "bdist_wheel": {"plat_name": "manylinux2014_x86_64"}, + }, include_package_data=True, )