-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[build] Move Mono API headers under src/native/public #64569
Conversation
db5d7c3
to
432bf4b
Compare
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
/cc @jkotas |
src/mono/CMakeLists.txt
Outdated
@@ -848,6 +848,9 @@ endif() | |||
### End of OS specific checks | |||
|
|||
include_directories("${CLR_SRC_NATIVE_DIR}") | |||
|
|||
add_subdirectory("${CLR_SRC_NATIVE_DIR}/include/mono-2.0" mono-2.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the version number in the path? What does the version number mean?
We version the whole runtime together. I think trying to support multiple versions in the same repo would be very complex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to match the layout that the existing runtime pack uses for the headers.
The mono API is always going to be "2.0" as long as its API/ABI compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to match the layout that the existing runtime pack uses for the headers.
Where is the existing runtime pack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://nuget.info/packages/Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64/6.0.1
The headers are in runtimes/[RID]/native/include/mono-2.0/...
The code that places them there is:
runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props
Lines 69 to 73 in 69b9000
<RuntimeFiles Condition="'$(TargetsMobile)' == 'true'" | |
Include="@(MonoIncludeFiles)" | |
ExcludeFromDataFiles="true"> | |
<TargetPath>runtimes/$(RuntimeIdentifier)/native/include/%(RecursiveDir)</TargetPath> | |
</RuntimeFiles> |
(this is also matching the layout that the old mono/mono packages use - include/mono-2.0/mono/{utils,metadata,jit}/...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to just name them include/metadata etc. and add the extra dirs in the runtime pack creation code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps there are still too many mono names. Runtime pack includes Mono in name, then you have monoapi and mono under it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how much flexibility I have with the names.
In the runtime, we typically have includes like #include <mono/metadata/object.h>
so at least one level of mono/
has to be in the repo. In embedding code, the mono-2.0/mono/metadata/object.h
directory layout is pretty well established and embedders also typically write #include <mono/metadata/object.h>
.
So if I move these headers, in the repo, they need to go some place like src/native/XYZ
and beneath that it seems like we must have mono/metadata/object.h
.
We could do something likesrc/native/include/mono/metadata/object.h
but I don't think that conveys the idea that these headers are not an internal implementation detail of the runtime, but are part of the public API.
What about src/native/public/mono/metadata/object.h
? or even src/public/mono/metadata/object.h
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have number of other public headers. For example, nethost.h and hostfxr.h (https://docs.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting).
If the idea is that all public headers that are designed to be included from outside the repo should live in a central place separate from their implementation, we should think about the directory structure for all of these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the idea is that all public headers that are designed to be included from outside the repo should live in a central place separate from their implementation, we should think about the directory structure for all of these.
Yea an implementation-independent home for nethost.h and hostfxr.h would be great. (And would make it a bit easier for the mobile hosts to implement the same APIs)
I'm not sure what kind of directory layout would be best. src/native
seems more natural than a new toplevel folder under src/
since these are native APIs. But on the other hand src/native
is getting crowded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I like src/native/public
(e.g. src/native/public/mono/metadata/object.h) that you have proposed above.
@joncham Are you going to be able to build on this for what you are trying to do in Unity-Technologies#4 or do you think you will end up with a separate set? |
One of the goals of this is to make it easier to refactor the public headers into the I was thinking that e.g. |
I think the overall goals of #64456 make sense and would aid my efforts. The changes mentioned there and openness to supporting late bound (dlopen/dlsym) style clients would be helpful. |
eec7a5c
to
90eddd3
Compare
7d7249d
to
d437227
Compare
@marek-safar FYI |
src/mono/mono/mini/CMakeLists.txt
Outdated
install(FILES ${mini_public_headers} | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mono-2.0/mono/jit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we still need to install JIT public headers from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's dead code. Removed it. Thanks!
Moved things around one more time. Made a public APIs directory in |
Contributes to #64456