RFC: feat: CABIN_TARGET_DIR env var and build.target-dir config support#1266
Open
zjwilliams wants to merge 4 commits intocabinpkg:mainfrom
Open
RFC: feat: CABIN_TARGET_DIR env var and build.target-dir config support#1266zjwilliams wants to merge 4 commits intocabinpkg:mainfrom
CABIN_TARGET_DIR env var and build.target-dir config support#1266zjwilliams wants to merge 4 commits intocabinpkg:mainfrom
Conversation
Added partial support for modifying the target directory in a cargo-like way. This allows the target directory to be set with either the `CABIN_TARGET_DIR` environment variable or with the `build.target-dir` configuration value in cabin.toml - with the configuration file taking priority. I plan to also support the `--target-dir` cli option, but that is not included in this commit.
9b7841e to
6299d12
Compare
This adds the '--target-dir' option to 'build', 'run', and 'test'. The effect is the same as setting 'CABIN_TARGET_DIR' or 'build.target-dir'; although the cli option will take precedence over the other two.
This addresses the errors generated by "lint" and "tidy", primarily removed the std::move() calls on const variables and converting Manifest::fromTargetDir() to use a braced initializer.
6299d12 to
596304a
Compare
This added tests for build, run, and test using --target-dir. This revealed a bug with test that is also fixed in this commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Target Directory Overriding
I am basing the usage on the way cargo does it.
So far I updated Manifest to read from the
CABIN_TARGET_DIRECTORYenvironment variable and thebuild.target-dirconfiguration, falling back on the default ofcabin-outif neither value has been set. Project was updated to read the value from Manifest instead of using the hard-coded value.I do plan to add support for the--target-dircli option as well, but as-of-yet that is not done.The
--target-dircli option has been added torun,buildandtest. Since Manifest is const, I addedManifest::withTargetDir()to create a copy with the new value. This also means when Manifest needs to be modified after creation (in Build.cc/Run.cc/Test.cc) they do so in a lamda so that the variable can stay const.I did change DepGraph to receive a Manifest directly rather than a path that is then resolved. This was done because I needed the updated Manifest to get propagated through the graph. It seemed like a safe change, but I don't know why it was designed this was originally so I could well be missing something.
Thoughts?
Checklist