DemesneGH commented on code in PR #296:
URL: 
https://github.com/apache/teaclave-trustzone-sdk/pull/296#discussion_r3166364744


##########
examples/supp_plugin-rs/plugin/build.rs:
##########
@@ -15,32 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use anyhow::{anyhow, Result};
-use std::env;
-use std::fs::File;
-use std::io::Write;
-use std::path::PathBuf;
-use uuid::Uuid;
-
-fn main() -> Result<()> {
-    let out = &PathBuf::from(env::var_os("OUT_DIR").ok_or_else(|| 
anyhow!("OUT_DIR not set"))?);
-    let mut buffer = File::create(out.join("plugin_static.rs"))?;
-    buffer.write_all(include_bytes!("plugin_static.rs"))?;
-
-    let plugin_uuid = Uuid::parse_str(proto::PLUGIN_UUID)?;
-    let (time_low, time_mid, time_hi_and_version, clock_seq_and_node) = 
plugin_uuid.as_fields();
-
-    writeln!(buffer)?;
-    write!(
-        buffer,
-        "const PLUGIN_UUID_STRUCT: optee_teec::raw::TEEC_UUID = 
optee_teec::raw::TEEC_UUID {{
-    timeLow: {:#x},
-    timeMid: {:#x},
-    timeHiAndVersion: {:#x},
-    clockSeqAndNode: {:#x?},
-}};",
-        time_low, time_mid, time_hi_and_version, clock_seq_and_node
-    )?;
+fn main() -> anyhow::Result<()> {
+    let config = optee_teec_plugin_bindgen::Config::new(
+        "syslog",
+        uuid::Uuid::parse_str(proto::PLUGIN_UUID)?,
+        "init",
+        "invoke",

Review Comment:
   Thanks for your insightful proposals! The both approaches make sense to me 
technically. 
   
   However, considering consistency with the existing TA development flow, how 
about:
   
   1. Use attribute macros (like `#[plugin_init]` and `#[plugin_invoke]`) from 
approach 1: This mirrors the `#[ta_create]` pattern that developers are already 
familiar with. Also keep the macro name in similar pattern if possible.
   
   2. Introduce `optee-teec-build `and `PluginConfig`: This provides a 
symmetric API to `TaConfig`. It hides the complexity of UUID parsing and code 
generation (e.g., `optee_teec_build::build_plugin(plugin_config)`).
   
   This alignment makes our API design more intuitive, if users know how to 
write a TA, they already know how to write a Plugin.
   
   Edit: since we already have Config related implementation in 
`optee-teec-plugin-bindgen`, how about directly naming this to a module of 
`optee-teec-build`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to