-
Notifications
You must be signed in to change notification settings - Fork 848
Unify include paths for headers between core, internal plugins, and external plugins. #3724
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
Unify include paths for headers between core, internal plugins, and external plugins. #3724
Conversation
zwoop
left a comment
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.
Also, bigger question: How does this fit in with the existing (public) C++ APIs? It feels like we ought to have one set of includes / directory for all C++ level include files.
| @@ -0,0 +1,17 @@ | |||
| # Licensed to the Apache Software Foundation (ASF) under one | |||
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 don' like the top-level directory name "src" here. To me, when I see that, it implies that all source code goes in src/. Seeing that all under src/ is API, maybe shuffle things up?
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.
Same here: When I see /src I initially expect non-header source files there (implementations). I see this proposes subtrees under /src expressly for different categories of header files.
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 look forward to a future where the source files are moved under this location. E.g. "It provides scope for, over the lifetime of 8.0, restructuring more of the source code in to less insane places". When we don't do that, we get stuck. I was hoping to plan ahead for once and not forbid anything that's not immediately useful.
| @@ -0,0 +1,17 @@ | |||
| # Licensed to the Apache Software Foundation (ASF) under one | |||
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 we should continue the pattern of using includes for new Makefile (and keep working on fixing the existing ones). As an example, see how it's done in the plugins/ tree. This still preserves the Makefile modularity (one Makefile per "level"), but allows for much better parallelism.
|
I disagree about having all of the C++ headers in a single directory. Bryan and I touched on this in our IRC discussion and I've become more convinced that splitting is the correctly approach. Among many other reasons, one issue is "I've included header leif.h. Do I need to link to a library too?". In the proposed scheme, if the header is in |
|
This doesn't fall with the standard way of laying out source code. Normally external headers go into an include directory at the top level (e.g. include/ts & include/tscpp). Also, I agree with @zwoop about having all the C++ headers in one directory. Users shouldn't have to figure out what directory the header is in and what lib to link with. There should only be one include directory and one library. |
|
The standard way to layout headers is to have you stuff under a directory so you have to say #include "dir/header" #include "api/tscpp/header.h" and all you have in our build for include path is ./src the dev package/ install move headers under a include directory with the same source layout |
|
What I would propose would be: lib/cppapi/include/atscppap moves to include/tscpp and would be installed at /usr/local/include/tscpp Rename lib/ts to lib/ats so it doesn't conflict with the external api directory. There would be one library for cpp APIs (e.g. TextView & Url) would change to: And this is how you would include headers: |
|
So the current release (which @bryancall makes a great point on as we are about to release) I am good with @bryancall proposal. I still believe that it will be better long term to move code under src/ |
|
@dragon512 I agree long term moving most of the code under src/ is a good idea. It makes me nervous when I wanted to branch last week and people are wanting to get stuff in last minute. We need to have a better plan and discuss it appropriately. Either we do a big push on moving things around before 9.0.0 or do it gradually after 8.0.0 is branched. I would be in favor or one big push on moving things around right before 9.0.0 to make it easier on LTS maintainers. |
|
The goal of the way this PR was set up was precisely to provide for gradual movement during the 8.0 lifetime. The net effect of this PR is to create some directories and move 3-4 header files. That is as minimally disruptive as possible, IMHO, to achieve the stated goal. "There would be one library for cpp APIs (e.g. TextView & Url)" That is not possible without some major restructuring. At minimum almost everything would have to link with I am fine with using a top level include as suggested. |
|
I think we should change |
d294772 to
3c329fa
Compare
1eda495 to
9983f66
Compare
a43db8c to
4f11b57
Compare
|
I updated the main comment. As noted I had two people push for putting the dual use headers in a separate library. I named that "libtsutil" because it's the utility library. The former "libtsutil" was moved to "libtscore" and put in "lib/core". Plugins don't need to link with "libtsutil" as that is pulled in by the |
4f11b57 to
7507514
Compare
61cc2bb to
1a49560
Compare
|
I still think it is a bad idea to split up the C++ API into to directories. I am -0 on this. |
1a49560 to
7b0be75
Compare
7b0be75 to
a366114
Compare
a366114 to
d1fe5e1
Compare
zwoop
left a comment
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.
Ship it.
|
@SolidWallOfCode This doesn't cleanly cherry pick to 8.0.x. If you want it in 8.0.0 you will need to make a PR off the 8.0.x branch. |
Cherry-pick from 079a402
(cherry picked from commit 1026969)
Revmoval of TESTS line on apache#3724 was incomplete.
Removal of TESTS line on apache#3724 was incomplete.
Removal of TESTS line on #3724 was incomplete.
* asf/8.0.x: (22 commits) Updated Changelog Follow up for apache#3724 - fix out of tree builds. Runroot: Fix a issue caused by restructured headers Corrects path in multiple documents header_rewrite: Removes deprecated %{CLIENT-IP} condition Updated Changelog Clarifies code comment for DL_Emergency heap use after free Adds redirect actions settings, returns by default Updated Changelog Fix link error on macOS Fixed error getting h2 HEADERS frame after stream is closed Disable the HttpSM half open logic if the underlying transport is TLS Fix inconsistent links in docs. Corrects IPv4 multicast ip address check PR apache#3724: Backport to ATS 8. Cherry-pick from 079a402 Updated Changelog Remove unneeded aio header file Updated Changelog Update to changelog generation tool to not require milestone to be closed ...
Updated based on feedback
lib/tsis moved tolib/tscorewhich builds thelibtscorelibrary. A new directory, "lib/tsutil", is created for "dual use" utility C++ headers which buildslibtsutil. These are headers used in the TS core and intended to be available to plugins. The goal of this restructuring is to unify include paths for core, internal plugins, and external plugins. That in turn enables exporting the dual use utility headers such asTextView.h. With the include paths the same, secondary includes will work as expected.This only moves the installed version of
TextView.htoinclude/tsutilas a demonstration and to validate the feasibility of making the move. This current structure is the result of many discussions on this PR, the mailing list, and the IRC channel.UPDATE
All references to "atscppapi" have been changed to "tscpp". This includes the library name and the internal library namespace. The "README` file in this PR has been updated to reflect the re-arrangement.
ts/...: C API functions.tscpp/...: C++ API functions.tsutil/...: Internally used utilities not dependent on TS specifically.tscore/...: Internal use only libraries.These paths become the same for core and plugins so that internal plugins have less of a privileged position over external plugins and serve as better examples for plugin developers.
lib/tswas split intolibtscoreandlibtsutilso that the dual use headers were in a separate library than the purely core headers. This was recommended by both @bryancall and @dragon512.Key issues to handle for exporting dual use C++ headers -
TextView.h) must be the same between the core and a plugin because of headers including other headers.assertat all).-Iinclude options on the compiler line. Relatedly, having include paths that have semantic meaning would help ease the pain of them being longer.