Closed NOhs closed 4 years ago
Something we need to change in the target class imho is to keep the separation between target and dependency options, currently we merge everything which is not nice for browsing the project. I think internally we can merge, but need to keep two separate public variables that display what is coming from this target, and what is coming from dependencies.
Isn't this somewhat duplicate to #87 (or a subset)?
I agree that a target's own flags etc. and those of it's dependencies should be separated.
If I understand you correctly, you want to have a proper API, which would enable users to create projects, which others could not use as subprojects because clang-build
would not know how to use the user-defined scripts?
I would like to avoid this situation, if we can (see also my comment on #87)
No, it is more that I would like clang-build to be easily integratable for example into software like vscode. For this we need to have an API that can be used to display a list of discovered targets, show their properties, select one and compile it etc.
Kind of like front-end and back-end, and the CLI is just one front-end.
OK, I would also really like to see this kind of features. Is there any way to automatically generate a CLI from a given set of functions?
Does the following describe the kind of tooling API you wish to create?
The Python API would provide the ability to
but not
The latter parts would then be a separate build-config API, related to what is described in issue #87.
The latter parts would require new features, whereas the former ones only require refactoring, I think (mostly). So yes, for a first step I am not considering the latter parts. Though it might not hurt to keep them in mind when refactoring. I actually already started in the new branch: api_first_try
.
I believe we can add a first tooling API on PR #110 with little extra effort.
clang_build.project.Project.from_directory
IMO compilation should probably be done via the project, not via directly calling target functions.
Note that we currently have the clang_build.target.TargetDescription
class, which should have the necessary information about a given target for the tooling API. I believe the tooling API will not need to use the clang_build.target.Target
class.
As suggested by @NOhs and demonstrated on the feature-child-process
branch on the vscode-clang-build extension (requires the feature-py-api
of clang-build corresponding to PR #110), a python -i
child process can be used instead of requiring a CLI.
This allows us to use the Python API for tooling, meaning all the aforementioned points are covered by PR #110. While the API is certainly not yet ideal, we can create corresponding follow-up issues.
So as discussed previously, I think it would make sense to not only have clang-build as a script/app that you can run, but something, you can also integrate into your project/workflow. The clang-build script itself should then use that API to provide the current functionality. I think we should play around with a simple first version, something like that:
Project discovery
Project creation
Project inspection
Should this be read/write? Then we could potentially have a gui to set toml files.
Target compilation
CLI interface
would print
with the names from the toml files etc, as usual.
and for all API functions this could automatically get wrapped (though we have to make sure that the documentation is still good).
So it is obvious that we have most of the stuff anyways in some form in our project, but I think cleaning it up to such a clean interface might help in the long run. Please feel free to edit as needed (I might have forgotten some things).