Skip to content
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

Add pregenerated files with all units #178

Merged
merged 4 commits into from
Oct 10, 2023
Merged

Add pregenerated files with all units #178

merged 4 commits into from
Oct 10, 2023

Conversation

chiphogg
Copy link
Contributor

@chiphogg chiphogg commented Oct 7, 2023

The motivating example is to be able to use the library on godbolt. For
this use case, we typically care far more about being comprehensive than
we do about compile times.

To enable this, we first add an --all-units flag to the single file
script. This flag will cause the script to act as if the --units flag
had been populated with every unit that is known to the library.

(Under the hood, the script has a safety mechanism to make sure that we
actually use every command line parameter in the script. This new
parameter would run afoul of this mechanism, because it's mutually
exclusive with the --units argument. Therefore, we use --all-units
to populate --units, and then delete --all-units.)

Next, we create build rules that use this new flag to generate
single-file versions with all units, with and without the <iostream>
dependency. Each new rule gets its own unit test.

Finally, we update the installation docs to provide this option. We
provide an appropriate degree of discouragement for general use, and
clarity around suitable use cases. The godbolt link is currently
"broken" (it doesn't compile), but we expect it to get fixed
automatically once this PR lands.

Test plan:

  • Run script with combinations of arguments:
    • Neither --units nor --all-units: builds with no units.
    • Only --units: includes specified units.
    • Only --all-units: includes all units.
    • Both --units and --all-units: exits with error.
  • Add unit tests for both single file generated versions.
  • View rendered docs and follow links

Fixes #174.

This flag will cause the script to act as if the `--units` flag had been
populated with every unit that is known to the library.

Under the hood, the script has a safety mechanism to make sure that we
actually use every command line parameter in the script.  This new
parameter would run afoul of this mechanism, because it's mutually
exclusive with the `--units` argument.  Therefore, we use `--all-units`
to populate `--units`, and then delete `--all-units`.
These include some simple unit tests both to make sure they would build,
and to make sure they have the required extra features.
We provide an appropriate degree of discouragement for general use, and
clarity around suitable use cases.  The godbolt link is currently
"broken" (it doesn't compile), but we expect it to get fixed
automatically once this PR lands.
@chiphogg chiphogg added release notes: 🔨 tooling PR for the Tooling section of release notes release notes: 📝 documentation PR affecting library documentation labels Oct 7, 2023
Copy link
Contributor

@geoffviola geoffviola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this. This PR should make it easier to share code.

@chiphogg chiphogg merged commit 0185918 into main Oct 10, 2023
10 checks passed
@chiphogg chiphogg deleted the all-units branch October 10, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: 📝 documentation PR affecting library documentation release notes: 🔨 tooling PR for the Tooling section of release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make pre-generated "include ALL the units!!" single-file versions
2 participants