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

Refactor InstallPaths API and comments a little. #4341

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

jonmeow
Copy link
Contributor

@jonmeow jonmeow commented Sep 25, 2024

Stemming from #4331, trying to break apart InstallPaths class comments into three parts:

  • Construction semantics, staying in the class comment
    • Trying to refer to methods with more detailed documentation.
  • Install prefix contents, now on prefix_
  • Install structure, consolidating on install_dirs

For code refactoring, driver() and prefix() were only used by the install paths test. Rather than having a comment not to use prefix(), this instead extracts it out to a TestPeer model (which we have elsewhere with TypedNodesTestPeer, thus my choice in approaches).

@jonmeow jonmeow requested a review from chandlerc September 25, 2024 23:17
@github-actions github-actions bot requested a review from josh11b September 25, 2024 23:17
@jonmeow jonmeow force-pushed the install-path-doc branch 2 times, most recently from 015d0a1 to a2629f5 Compare September 25, 2024 23:20
//
// When run from bazel (for example, in unit tests or development binaries)
// this will look like:
// `bazel-bin/some/bazel/target.runfiles/_main/toolchain/install/prefix_root`
Copy link
Contributor

Choose a reason for hiding this comment

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

The prefix_root at the end looks a little suspicious to me. Is that right?

Copy link
Contributor

Choose a reason for hiding this comment

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

We use an explicit prefix_root for all the things installed in the package to keep them distinct from the code and other things in the install package for managing an installation.

Copy link
Contributor

@chandlerc chandlerc left a comment

Choose a reason for hiding this comment

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

LG, nice cleanup!

@@ -16,6 +16,14 @@
#include "tools/cpp/runfiles/runfiles.h"

namespace Carbon {

class InstallPathsTestPeer {
Copy link
Contributor

Choose a reason for hiding this comment

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

(not for this PR, maybe for a follow-up)

Is "test peer" a well established term? I couldn't find it when searching, and it was new to me. And the term "peer" is specific enough that I somewhat expect it to have a fairly specific meaning.

If its not that established, I'm still perfectly happy with the pattern itself to allow testing -- but maybe ...TestHelper as a name to be a little more generic? But as I said, not this PR, a follow-up to maybe rename both if folks like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Peer specifically comes from https://abseil.io/tips/135

Copy link
Contributor Author

@jonmeow jonmeow Sep 26, 2024

Choose a reason for hiding this comment

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

Note, left to my own devices, I'd just make InstallPathsTest itself the friend... (I would mainly expect peers/helpers for something we use in multiple places, not just once)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I'm merging, expecting we'll come up with some unified solution for InstallPathsTestPeer, TypedNodesTestPeer, and InstTestHelper)

@jonmeow jonmeow added this pull request to the merge queue Sep 26, 2024
Merged via the queue into carbon-language:trunk with commit 98e0d22 Sep 26, 2024
8 checks passed
@jonmeow jonmeow deleted the install-path-doc branch September 26, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants