From cd9927cf66d99dce0e33bf5f8590c8541bd0dccc Mon Sep 17 00:00:00 2001 From: Harry Maclean Date: Tue, 14 Mar 2023 12:23:09 +1300 Subject: [PATCH] Ruby: Update create-extractor-pack --- ruby/actions/create-extractor-pack/action.yml | 4 ++-- ruby/scripts/create-extractor-pack.ps1 | 8 +++++--- ruby/scripts/create-extractor-pack.sh | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ruby/actions/create-extractor-pack/action.yml b/ruby/actions/create-extractor-pack/action.yml index 59aad56ced7..4396b7f79cc 100644 --- a/ruby/actions/create-extractor-pack/action.yml +++ b/ruby/actions/create-extractor-pack/action.yml @@ -10,7 +10,7 @@ runs: uses: actions/cache@v3 with: path: ruby/extractor-pack - key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/scripts/create-extractor-pack.sh', 'ruby/**/Cargo.lock', 'ruby/actions/create-extractor-pack/action.yml') }}-${{ hashFiles('ruby/**/*.rs') }}-${{ hashFiles('ruby/codeql-extractor.yml', 'ruby/downgrades', 'ruby/tools', 'ruby/ql/lib/ruby.dbscheme', 'ruby/ql/lib/ruby.dbscheme.stats') }} + key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/scripts/create-extractor-pack.sh', 'ruby/extractor/**/Cargo.lock', 'ruby/actions/create-extractor-pack/action.yml') }}-${{ hashFiles('ruby/extractor/**/*.rs') }}-${{ hashFiles('ruby/codeql-extractor.yml', 'ruby/downgrades', 'ruby/tools', 'ruby/ql/lib/ruby.dbscheme', 'ruby/ql/lib/ruby.dbscheme.stats') }} - name: Cache cargo uses: actions/cache@v3 if: steps.cache-extractor.outputs.cache-hit != 'true' @@ -19,7 +19,7 @@ runs: ~/.cargo/registry ~/.cargo/git ruby/target - key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-qltest-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/scripts/create-extractor-pack.sh', 'ruby/**/Cargo.lock') }} + key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-qltest-cargo-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/scripts/create-extractor-pack.sh', 'ruby/extractor/**/Cargo.lock') }} - name: Build Extractor if: steps.cache-extractor.outputs.cache-hit != 'true' shell: bash diff --git a/ruby/scripts/create-extractor-pack.ps1 b/ruby/scripts/create-extractor-pack.ps1 index 9f78ceb5197..05fa9f733f7 100644 --- a/ruby/scripts/create-extractor-pack.ps1 +++ b/ruby/scripts/create-extractor-pack.ps1 @@ -1,6 +1,8 @@ +cd extractor cargo build --release +cargo run --release --bin generator -- --dbscheme ../ql/lib/ruby.dbscheme --library ../ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +cd .. -cargo run --release -p ruby-generator -- --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll codeql query format -i ql\lib\codeql/ruby\ast\internal\TreeSitter.qll rm -Recurse -Force extractor-pack @@ -9,5 +11,5 @@ cp codeql-extractor.yml, ql\lib\ruby.dbscheme, ql\lib\ruby.dbscheme.stats extrac cp -Recurse tools extractor-pack cp -Recurse downgrades extractor-pack mkdir extractor-pack\tools\win64 | Out-Null -cp target\release\ruby-extractor.exe extractor-pack\tools\win64\extractor.exe -cp target\release\ruby-autobuilder.exe extractor-pack\tools\win64\autobuilder.exe +cp extractor\target\release\ruby-extractor.exe extractor-pack\tools\win64\extractor.exe +cp extractor\target\release\ruby-autobuilder.exe extractor-pack\tools\win64\autobuilder.exe diff --git a/ruby/scripts/create-extractor-pack.sh b/ruby/scripts/create-extractor-pack.sh index c5f5192994c..2074367ff7a 100755 --- a/ruby/scripts/create-extractor-pack.sh +++ b/ruby/scripts/create-extractor-pack.sh @@ -13,14 +13,16 @@ else exit 1 fi +pushd extractor "$CARGO" build --release +"$CARGO" run --release --bin generator -- --dbscheme ../ql/lib/ruby.dbscheme --library ../ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +popd -"$CARGO" run --release -p ruby-generator -- --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll codeql query format -i ql/lib/codeql/ruby/ast/internal/TreeSitter.qll rm -rf extractor-pack mkdir -p extractor-pack cp -r codeql-extractor.yml downgrades tools ql/lib/ruby.dbscheme ql/lib/ruby.dbscheme.stats extractor-pack/ mkdir -p extractor-pack/tools/${platform} -cp target/release/ruby-extractor extractor-pack/tools/${platform}/extractor -cp target/release/ruby-autobuilder extractor-pack/tools/${platform}/autobuilder +cp extractor/target/release/ruby-extractor extractor-pack/tools/${platform}/extractor +cp extractor/target/release/ruby-autobuilder extractor-pack/tools/${platform}/autobuilder