Building a project at runtime

Hi, so I am working an a simple game engine project that requires me to build a project at runtime, is there any way to do this?

To me it is totally unclear what you mean. Can you elaborate on what you mean, what your use-case is?

So for example unity game engine, you have an option to click on “build” in the editor, I am making the editor so how do I interface with gradle while my editor program is running

That’s what the tooling API is for: Gradle & Third-party Tools