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

Generate ginkgo.hpp via CMake #1782

Merged
merged 4 commits into from
Feb 18, 2025
Merged

Generate ginkgo.hpp via CMake #1782

merged 4 commits into from
Feb 18, 2025

Conversation

upsj
Copy link
Member

@upsj upsj commented Feb 16, 2025

Otherwise we always need to commit the header when adding new files. Additionally, it was being picked up by pre-commit, and the output of the script isn't properly formatted, so everything broke when adding a new header in #802

Closes #1781

@ginkgo-bot ginkgo-bot added reg:build This is related to the build system. reg:ci-cd This is related to the continuous integration system. reg:documentation This is related to documentation. mod:core This is related to the core module. labels Feb 16, 2025
@upsj upsj requested a review from a team February 16, 2025 20:14
@upsj upsj added the 1:ST:ready-for-review This PR is ready for review label Feb 16, 2025
@upsj upsj self-assigned this Feb 16, 2025
Copy link
Member

@yhmtsai yhmtsai left a comment

Choose a reason for hiding this comment

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

I like you did it in cmake!
I think we should add ginkgo.hpp into .gitignore in our repo.
However, it raises two concerns which I need to confirm

  1. when user pulls the change, will their old ginkgo.hpp they be stayed?
  2. If the file stays, will our include_header logics use source one or build one first?

Also, add a fatal error to detect whether user has the file in source

@@ -30,10 +30,3 @@ repos:
examples/external-lib-interfacing/external-lib-interfacing.cpp|
core/base/workspace_aliases.hpp
)$
- id: update-ginkgo-header
Copy link
Member

Choose a reason for hiding this comment

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

if we only aim for avoid pre-commit issue, we can move this to early stage such that they are checked after generation

Copy link
Member Author

@upsj upsj Feb 17, 2025

Choose a reason for hiding this comment

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

That would mean that the file gets changed twice, forcing all examples and other files that include ginkgo.hpp to be rebuilt

Copy link
Member Author

Choose a reason for hiding this comment

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

To extend: I think as a general rule, different pre-commit steps shouldn't undo each other's changes.

Copy link
Member

Choose a reason for hiding this comment

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

no, it will not. unless pre-commit -> build -> pre-commit -> build.
It will not undo anything if ginkgo.hpp.in is updated there too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just checked, it's even worse than that: Regardless of order, if one hook undoes the change by another hook, both of them are marked as failed and prevent the changes from being committed

update ginkgo header.....................................................Failed
- hook id: update-ginkgo-header
- files were modified by this hook
reuse-annotate...........................................................Failed
- hook id: reuse-annotate
- files were modified by this hook

Successfully changed header of include/ginkgo/ginkgo.hpp
Successfully changed header of include/ginkgo/core/test.hpp

@upsj
Copy link
Member Author

upsj commented Feb 17, 2025

If users pull this change, their ginkgo.hpp will be deleted, so there is no danger of conflicting files (unless they changed ginkgo.hpp, then it's a merge conflict at rebase).

@upsj upsj requested a review from yhmtsai February 17, 2025 09:54
@@ -30,10 +30,3 @@ repos:
examples/external-lib-interfacing/external-lib-interfacing.cpp|
core/base/workspace_aliases.hpp
)$
- id: update-ginkgo-header
Copy link
Member

Choose a reason for hiding this comment

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

no, it will not. unless pre-commit -> build -> pre-commit -> build.
It will not undo anything if ginkgo.hpp.in is updated there too.

@upsj upsj added 1:ST:ready-to-merge This PR is ready to merge. and removed 1:ST:ready-for-review This PR is ready for review labels Feb 17, 2025
@upsj upsj merged commit ea737c9 into develop Feb 18, 2025
6 of 9 checks passed
@ginkgo-bot
Copy link
Member

Error: PR already merged!

@upsj upsj deleted the fix_ginkgo_hpp branch February 18, 2025 08:31
@ginkgo-bot
Copy link
Member

Error: PR already merged!

@upsj upsj added the 1:ST:no-changelog-entry Skip the wiki check for changelog update label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:no-changelog-entry Skip the wiki check for changelog update 1:ST:ready-to-merge This PR is ready to merge. mod:core This is related to the core module. reg:build This is related to the build system. reg:ci-cd This is related to the continuous integration system. reg:documentation This is related to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create ginkgo.hpp dynamically
4 participants