Pass information to the crate at compile time?

hi, I am writing a plugin for a software.
It uses the messages described in the .json file to call the corresponding .dll shared library.
I want to write a sdk to achieve other functions, and automatically generate a .json description file at compile time (build.rs?). In order to achieve this function, I thought of two ways.

A: plugin project, B: sdk crate. The project depends on SDK.

  1. sdk crate parses the project code at compile time, determines which APIs are used by the project and generates .json.

  2. The project proactively informed the sdk crate of the information. (Similar to features that can pass custom content?).

Yes, I know these features can be difficult to implement. If not, I plan to write a command line tool to generate the .json file.
Is there a library that can parse the rust code?
For example, determine whether the project uses:
use sdk_crate::api::send_log;

--Translation from Google.

Plugins can have build.rs that uses your SDK's crate as a build-dependency and ask it to generate information it needs.

Look how phf crate works. It generates code for perfect hash tables at compile time. You can generate other data in a similar way.