Skip to content

Conversation

hmac
Copy link
Contributor

@hmac hmac commented Mar 13, 2023

This is the first step in making the extractor into a reusable library.

We merge the four crates extractor, generator, autobuilder, node-types into one crate: extractor.

If you review commit-by-commit, it's easy to see that most files are not modified, just renamed.

@github-actions github-actions bot added the Ruby label Mar 13, 2023
@hmac hmac force-pushed the merge-ruby-extractor branch from 040dc66 to 999b12f Compare March 14, 2023 05:12
@hmac hmac marked this pull request as ready for review March 14, 2023 05:32
@hmac hmac requested a review from a team as a code owner March 14, 2023 05:32
@hmac hmac added the no-change-note-required This PR does not need a change note label Mar 14, 2023
@hmac hmac requested a review from aibaars March 14, 2023 05:33
aibaars
aibaars previously approved these changes Mar 14, 2023
Copy link
Contributor

@aibaars aibaars left a comment

Choose a reason for hiding this comment

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

Looks good to me. I have some questions .

codeql pack create ql/lib --output target/packs
codeql pack create -j0 ql/src --output target/packs --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
rm -rf query-packs
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason for using the target folder is to avoid interference with any folder that may be present in the repository. We don't have a query-packs folder, so it is fine for now, but we create one in the future,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, that's a good point. Do you have a better suggestion? The target directory no longer exists here, since it has moved to extractor/target. Could we use a subdirectory of /tmp instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Using ${{ runner.temp }} is probably best. That is like /tmp but for Actions, and also works on Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tackled in eefc486. I'm going to try to re-run the CI job without cache to test that part of the code.

cargo build --release
cd ..

extractor\target\release\generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for replacing cargo run with an explicit path?

@@ -13,14 +13,14 @@ else
exit 1
fi

"$CARGO" build --release
(cd extractor && "$CARGO" build --release)
extractor/target/release/generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for replacing cargo run with an explicit path? This used to run cross run ... in case $CARGO=cross, not sure if it matters, but I wondered why it was changed.

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 changed this because it stopped working after my changes. I was seeing "No such file or directory" errors in CI. My guess as to why is because cross runs commands in a Docker container, and so when we moved the extractor to be inside ./extractor, the QL files in the parent directory were no longer accessible from the container.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, makes sense. I don't really mind, but I was curious ;-)

This ensures we don't clobber any existing directories in the repo.
This is primarily to bust the actions cache, to test a change in the
ruby-build workflow.
@hmac
Copy link
Contributor Author

hmac commented Mar 14, 2023

@aibaars this is ready for another look when you have a chance

Co-authored-by: Arthur Baars <aibaars@github.com>
Copy link
Contributor

@aibaars aibaars left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@hmac hmac merged commit 604d5f0 into github:main Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Ruby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants