-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Enable rapid testing and development on Compiler Explorer #3456
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
Conversation
|
Wow. I haven't tried this, but it sounds awesome. |
7793bbb to
6b104b1
Compare
|
Wow, I really like this idea! Haven't tried it myself, but there goes my "I'm not using MSVC so I cannot try it"-excuse ;-) |
|
(And I think your screenshot should go into the README) |
6b104b1 to
369eefd
Compare
scripts/serve_header/README.md
Outdated
| ## Usage | ||
|
|
||
| `serve_header.py` has a builtin default configuration that will serve the header from the project folder it is homed in. | ||
| It expects to find the certificate `localhost.pem` and the private key `localhost-key.pem` in the projects root directory. |
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.
project's root or project root
from the project folder it is homed in.
I'm having trouble understanding this. By project folder and project root, do you mean the directory containing the scripts/serve_header directory, the directory that is checked out from GitHub? I assumed that's what you meant, but the multiple work tree example confused me about that.
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.
"Project" refers to the JSON library or the git checkout, yes.
I'll fix the typo and see if I can come up with clearer wording.
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.
Is the phrase "top level or project root directory" (used consistently) clearer to you?
Edit: I'm also using "web server root directory" when speaking about the root configuration option.
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.
Looks good, thanks for the clarifications.
cb3fa6f to
ec3b655
Compare
ec3b655 to
b273c69
Compare
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.
Should we move the scripts folder to the test folder to keep the root a bit cleaner?
b273c69 to
3ccb30a
Compare
|
Please update to the latest develop branch (we renamed some folders in #3462). |
3ccb30a to
ce8040d
Compare
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.
Looks good to me.
|
Thanks!!! |
This PR adds a script for serving the amalgamated header on a local HTTPS server. When the header file is requested, the header is automatically amalgamated if any of the source files have been modified.
The header can then be included on Compiler Explorer like this:
Note that the
#include <url>is resolved client-side, making it possible to host the header locally. HTTPS is nevertheless required, as it is hard-coded in the Compiler Explorer regex.serve_header.py
Serves the
single_include/nlohmann/json.hppheader file over HTTP(S).The header file is automatically amalgamated on demand.
Prerequisites
Make sure these Python packages are installed.
(see
scripts/serve_header/requirements.txt)To serve the header over HTTPS (which is required by Compiler Explorer at this time), a certificate is needed.
The recommended method for creating a locally-trusted certificate is to use
mkcert.mkcertcertificate authority into your trust store(s):localhost:localhost.pemandlocalhost-key.pem, in the current working directory. It is recommended to create them in the top level or project root directory.Usage
serve_header.pyhas a built-in default configuration that will serve thesingle_include/nlohmann/json.hppheader file relative to the top level or project directory it is homed in.The built-in configuration expects the certificate
localhost.pemand the private keylocalhost-key.pemto be located in the top level or project root directory.To start serving the
json.hppheader file athttps://localhost:8443/json.hpp, run this command from the top level or project root directory:Open Compiler Explorer and try it out:
Configuration
serve_header.pywill try to read a configuration fileserve_header.ymlin the top level or project root directory, and will fall back on built-in defaults if the file cannot be read.An annotated example configuration can be found in
scripts/serve_header/serve_header.yml.example.Serving
json.hppfrom multiple project directory instances or working treesserve_header.pywas designed with the goal of supporting multiple project roots or working trees at the same time.The recommended directory structure is shown below but
serve_header.pycan work with other structures as well, including a nested hierarchy.To serve the header of each working tree at
https://localhost:8443/<worktree>/json.hpp, a configuration file is needed.Create the file
serve_header.ymlin the top level or project root directory of any working tree:By shifting the web server root directory up one level, the
single_include/nlohmann/json.hppheader files relative to each sibling directory or working tree will be served.Start
serve_header.pyby running this command from the same top level or project root directory the configuration file is located in:serve_header.pywill automatically detect the addition or removal of working trees anywhere within the configured web server root directory.