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

build-sys: Switch to committing cxx.rs generated code #3864

Merged
merged 1 commit into from
Jul 29, 2022

Conversation

cgwalters
Copy link
Member

Closes: #3252

This avoids creating a magical, manual error prone step in the
release process, at the cost of dealing with generated code in git.

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

I think this makes a lot of sense.

Having generated code in-tree is fine, but it then runs the risk of going out of sync. So IMO the convention should be that you also have CI that checks and fails if it wasn't regenerated.

Let's add a new GitHub Action workflow for that?

.gitattributes Show resolved Hide resolved
ci/install-dev-deps.sh Outdated Show resolved Hide resolved
@cgwalters
Copy link
Member Author

OK did a lot more cleanups here, and also added the requested CI check!

@cgwalters
Copy link
Member Author

OK, for some reason the header ordering with clang-format and these files is unstable. Digging 🕳️

@cgwalters
Copy link
Member Author

OK, for some reason the header ordering with clang-format and these files is unstable.

Did some searching and turned up
eranif/codelite#1586
which led me to try out clang-format --assume-filename=$@. Which didn't work. And some more hair-pulling later, I noticed in the docs it says "when reading from stdin" - the option is ignored when operating on a file. Argh.

Anyways, switching to piping with --assume-filename=$@ seems to work and is more elegant.

set -xeuo pipefail
CXX_VER=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "cxx").version')
mkdir -p target
time cargo install --root=target/cxxbridge cxxbridge-cmd --version "${CXX_VER}"
Copy link
Member

Choose a reason for hiding this comment

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

This currently duplicates ci/installdeps.sh.

Thinking more on this, I think it makes sense to have ci/installdeps.sh be a superset which includes installing cxx tooling, but maybe let's just have it execute this script like we do in ci/verify-cxx.sh to avoid duplication? (Also the comment there needs an update.)

Copy link
Member Author

Choose a reason for hiding this comment

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

The way I think of it, ci/installdeps.sh is basically "stuff we need to build a source archive" (including vendor) to replicate more precisely the Koji-style offline build model.

So it shouldn't install cxx.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, WFM!

docs/HACKING.md Show resolved Hide resolved
docs/HACKING.md Show resolved Hide resolved
Closes: coreos#3252

This avoids creating a magical, manual error prone step in the
release process, at the cost of dealing with generated code in git.
set -xeuo pipefail
CXX_VER=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "cxx").version')
mkdir -p target
time cargo install --root=target/cxxbridge cxxbridge-cmd --version "${CXX_VER}"
Copy link
Member

Choose a reason for hiding this comment

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

Sure, WFM!

@jlebon jlebon enabled auto-merge July 29, 2022 20:11
@jlebon jlebon merged commit c2f2e31 into coreos:main Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

switch to committing cxx-rs generated code?
2 participants