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

fix(common): add proper configure output for hextobin #12440

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

ermshiperete
Copy link
Contributor

This change fixes a dependency problem when building Core. Previously this failed on a clean source tree because hextobin was missing dependencies but didn't run its configure action if the top-level node_modules folder did already exist.

@keymanapp-test-bot skip

This change fixes a dependency problem when building Core. Previously
this failed on a clean source tree because hextobin was missing
dependencies but didn't run its `configure` action if the top-level
`node_modules` folder did already exist.
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Sep 18, 2024

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S11 milestone Sep 18, 2024
Copy link
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

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

lgtm

@ermshiperete ermshiperete merged commit 664f7ab into master Sep 19, 2024
10 checks passed
@ermshiperete ermshiperete deleted the fix/common/dependency branch September 19, 2024 06:53
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.115-alpha

@@ -11,7 +11,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"

builder_describe "Build hextobin" clean configure build
builder_describe_outputs \
configure /node_modules \
configure /common/tools/hextobin/node_modules/commander \
Copy link
Member

Choose a reason for hiding this comment

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

This is possibly fragile with hoisting of commander to top-level that could happen if we update commander versions. It could mean that it never seems configured.

Also not sure how this improves things, because:

Previously this failed on a clean source tree because hextobin was missing dependencies but didn't run its configure action if the top-level node_modules folder did already exist.

The /node_modules folder would not exist on a clean source tree; it should only exist if npm ci or npm i has already been run, at which point common/tools/hextobin/node_modules/... would also have been populated.

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 should say "half-clean" then. 😄 I often run a git clean on the subdirectory I'm working on in order to save some build time.

Yes, I realize that this is possibly fragile if we move files around and we can adjust then. Just checking for the existence of /node_modules is too broad IMO.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I realize that this is possibly fragile if we move files around and we can adjust then.

The problem is that node_modules files can move around without us being very aware of it happening, because the choice of location is quite dependent on npm and whether or not we've hoisted packages (and if packages are shared across projects). It is very likely we'd simply miss the change and then we'd end up having the configure step running on every build until we notice the build slowdown.

Just checking for the existence of /node_modules is too broad IMO.

I guess so -- but it's what we are doing for all the other node/web projects, so this is a broader issue across many projects. We could consider having a separate '.configured' flag file created on each project as a more robust alternative that doesn't depend on vagaries of npm (and then we need to touch that file in build.sh of course):

Suggested change
configure /common/tools/hextobin/node_modules/commander \
configure /common/tools/hextobin/.configured \

</bikeshed>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good discussion! See #12481 for a solution that picks up your idea.

ermshiperete added a commit that referenced this pull request Sep 27, 2024
This improves #12440. The previous change was a bit fragile if we updated
commander versions. This change now implements a better solution that
doesn't rely on dependencies and their locations for detecting if we need
to run the `configure` action for hextobin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants