diff --git a/.github/workflows/csharp-qltest.yml b/.github/workflows/csharp-qltest.yml index 2075e10a77a6..66326539e6e2 100644 --- a/.github/workflows/csharp-qltest.yml +++ b/.github/workflows/csharp-qltest.yml @@ -65,7 +65,7 @@ jobs: key: csharp-qltest-${{ matrix.slice }} - name: Run QL tests run: | - codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path extractor-pack --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" + codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" env: GITHUB_TOKEN: ${{ github.token }} unit-tests: @@ -101,6 +101,6 @@ jobs: # Update existing stubs in the repo with the freshly generated ones mv "$STUBS_PATH/output/stubs/_frameworks" ql/test/resources/stubs/ git status - codeql test run --threads=0 --search-path extractor-pack --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote + codeql test run --threads=0 --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index 94e4526b35ed..2082629d9c8f 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -49,20 +49,20 @@ jobs: key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }} - name: Release build if: steps.cache-extractor.outputs.cache-hit != 'true' - run: cd ql; ./scripts/create-extractor-pack.sh + run: cd ql; ./scripts/create-extractor-pack.sh env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ github.token }} - name: Cache compilation cache id: query-cache uses: ./.github/actions/cache-query-compilation - with: + with: key: run-ql-for-ql - name: Make database and analyze run: | ./ql/target/release/buramu | tee deprecated.blame # Add a blame file for the extractor to parse. - ${CODEQL} database create -l=ql --search-path ql/extractor-pack ${DB} + ${CODEQL} database create -l=ql ${DB} --search-path "${{ github.workspace }}" ${CODEQL} database analyze -j0 --format=sarif-latest --output=ql-for-ql.sarif ${DB} ql/ql/src/codeql-suites/ql-code-scanning.qls --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" - env: + env: CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} DB: ${{ runner.temp }}/DB LGTM_INDEX_FILTERS: | diff --git a/.github/workflows/ql-for-ql-dataset_measure.yml b/.github/workflows/ql-for-ql-dataset_measure.yml index 4f9887c4edc4..e53cce8ff8ea 100644 --- a/.github/workflows/ql-for-ql-dataset_measure.yml +++ b/.github/workflows/ql-for-ql-dataset_measure.yml @@ -53,8 +53,8 @@ jobs: - name: Create database run: | "${CODEQL}" database create \ - --search-path "ql/extractor-pack" \ - --threads 4 \ + --search-path "${{ github.workspace }}" + --threads 4 \ --language ql --source-root "${{ github.workspace }}/repo" \ "${{ runner.temp }}/database" env: diff --git a/.github/workflows/ql-for-ql-tests.yml b/.github/workflows/ql-for-ql-tests.yml index 578c26c29775..bc247165198a 100644 --- a/.github/workflows/ql-for-ql-tests.yml +++ b/.github/workflows/ql-for-ql-tests.yml @@ -49,15 +49,15 @@ jobs: - name: Cache compilation cache id: query-cache uses: ./.github/actions/cache-query-compilation - with: + with: key: ql-for-ql-tests - name: Run QL tests run: | - "${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" ql/ql/test + "${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}" --consistency-queries ql/ql/consistency-queries --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" ql/ql/test env: CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} - other-os: + other-os: strategy: matrix: os: [macos-latest, windows-latest] @@ -65,7 +65,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Install GNU tar + - name: Install GNU tar if: runner.os == 'macOS' run: | brew install gnu-tar @@ -100,7 +100,7 @@ jobs: - name: Run a single QL tests - Unix if: runner.os != 'Windows' run: | - "${CODEQL}" test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref + "${CODEQL}" test run --check-databases --search-path "${{ github.workspace }}" ql/ql/test/queries/style/DeadCode/DeadCode.qlref env: CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} - name: Run a single QL tests - Windows @@ -108,5 +108,4 @@ jobs: shell: pwsh run: | $Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})" - codeql test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref - \ No newline at end of file + codeql test run --check-databases --search-path "${{ github.workspace }}" ql/ql/test/queries/style/DeadCode/DeadCode.qlref diff --git a/.github/workflows/ruby-dataset-measure.yml b/.github/workflows/ruby-dataset-measure.yml index dd15a0aa63e2..d6e3c9216fcf 100644 --- a/.github/workflows/ruby-dataset-measure.yml +++ b/.github/workflows/ruby-dataset-measure.yml @@ -44,7 +44,7 @@ jobs: - name: Create database run: | codeql database create \ - --search-path "${{ github.workspace }}/ruby/extractor-pack" \ + --search-path "${{ github.workspace }}" \ --threads 4 \ --language ruby --source-root "${{ github.workspace }}/repo" \ "${{ runner.temp }}/database" diff --git a/.github/workflows/ruby-qltest.yml b/.github/workflows/ruby-qltest.yml index 9dc86bbce203..224e1c129b4f 100644 --- a/.github/workflows/ruby-qltest.yml +++ b/.github/workflows/ruby-qltest.yml @@ -64,10 +64,10 @@ jobs: - name: Cache compilation cache id: query-cache uses: ./.github/actions/cache-query-compilation - with: + with: key: ruby-qltest - name: Run QL tests run: | - codeql test run --threads=0 --ram 50000 --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" + codeql test run --threads=0 --ram 50000 --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.gitignore b/.gitignore index 3d2e92e3ca9a..a9a34f6bd4c3 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,6 @@ node_modules/ # Temporary folders for working with generated models .model-temp + +# bazel-built in-tree extractor packs +/*/extractor-pack diff --git a/codeql-workspace.yml b/codeql-workspace.yml index 6e024dae2cfa..bfd3106f97ab 100644 --- a/codeql-workspace.yml +++ b/codeql-workspace.yml @@ -6,19 +6,16 @@ provide: - "*/ql/consistency-queries/qlpack.yml" - "*/ql/automodel/src/qlpack.yml" - "*/ql/automodel/test/qlpack.yml" + - "*/extractor-pack/codeql-extractor.yml" - "python/extractor/qlpack.yml" - "shared/**/qlpack.yml" - "cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml" - "go/ql/config/legacy-support/qlpack.yml" - - "go/build/codeql-extractor-go/codeql-extractor.yml" - "csharp/ql/campaigns/Solorigate/lib/qlpack.yml" - "csharp/ql/campaigns/Solorigate/src/qlpack.yml" - "csharp/ql/campaigns/Solorigate/test/qlpack.yml" - "misc/legacy-support/*/qlpack.yml" - "misc/suite-helpers/qlpack.yml" - - "ruby/extractor-pack/codeql-extractor.yml" - - "swift/extractor-pack/codeql-extractor.yml" - - "ql/extractor-pack/codeql-extractor.yml" - ".github/codeql/extensions/**/codeql-pack.yml" versionPolicies: diff --git a/cpp/downgrades/BUILD.bazel b/cpp/downgrades/BUILD.bazel index da15140b0b4f..fd96656a2ecc 100644 --- a/cpp/downgrades/BUILD.bazel +++ b/cpp/downgrades/BUILD.bazel @@ -6,7 +6,7 @@ pkg_files( ["**"], exclude = ["BUILD.bazel"], ), - prefix = "cpp/downgrades", + prefix = "downgrades", strip_prefix = strip_prefix.from_pkg(), visibility = ["//cpp:__pkg__"], ) diff --git a/cpp/ql/lib/BUILD.bazel b/cpp/ql/lib/BUILD.bazel index b71a607b6ec0..af6e7ece4946 100644 --- a/cpp/ql/lib/BUILD.bazel +++ b/cpp/ql/lib/BUILD.bazel @@ -5,11 +5,9 @@ package(default_visibility = ["//cpp:__pkg__"]) pkg_files( name = "dbscheme", srcs = ["semmlecode.cpp.dbscheme"], - prefix = "cpp", ) pkg_files( name = "dbscheme-stats", srcs = ["semmlecode.cpp.dbscheme.stats"], - prefix = "cpp", ) diff --git a/csharp/BUILD.bazel b/csharp/BUILD.bazel index b8a58c268e40..fbe4213ab9e1 100644 --- a/csharp/BUILD.bazel +++ b/csharp/BUILD.bazel @@ -1,6 +1,5 @@ load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files") -load("@semmle_code//:dist.bzl", "dist") -load("//misc/bazel:pkg.bzl", "codeql_pkg_files_overlay") +load("//misc/bazel:pkg.bzl", "codeql_pack", "codeql_pkg_files_overlay") package(default_visibility = ["//visibility:public"]) @@ -59,22 +58,16 @@ codeql_pkg_files_overlay( ], ) -dist( - name = "extractor-arch", - srcs = [":extractor-arch-overlay"], -) - -dist( - name = "extractor-generic", +codeql_pack( + name = "csharp", srcs = [ ":dbscheme-group", ":extra-files", + ":extractor-arch-overlay", ":extractor-asp", "//csharp/downgrades", "//csharp/tools", ], - prefix = "csharp", - visibility = ["//visibility:public"], ) test_suite( diff --git a/csharp/autobuilder/Semmle.Autobuild.Cpp/BUILD.bazel b/csharp/autobuilder/Semmle.Autobuild.Cpp/BUILD.bazel index 801e7aedbab6..379b8aea91da 100644 --- a/csharp/autobuilder/Semmle.Autobuild.Cpp/BUILD.bazel +++ b/csharp/autobuilder/Semmle.Autobuild.Cpp/BUILD.bazel @@ -9,7 +9,6 @@ codeql_csharp_binary( "*.cs", "Properties/*.cs", ]), - language_prefix = "cpp", visibility = ["//visibility:public"], deps = [ "//csharp/autobuilder/Semmle.Autobuild.Shared", diff --git a/go/BUILD.bazel b/go/BUILD.bazel index 4fb73a51fb69..94ce26f43918 100644 --- a/go/BUILD.bazel +++ b/go/BUILD.bazel @@ -1,7 +1,6 @@ load("@bazel_skylib//rules:native_binary.bzl", "native_binary") -load("@rules_pkg//pkg:install.bzl", "pkg_install") -load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files") -load("//:defs.bzl", "codeql_platform") +load("@rules_pkg//pkg:mappings.bzl", "pkg_files") +load("//misc/bazel:pkg.bzl", "codeql_pack", "codeql_pkg_files") native_binary( name = "gazelle", @@ -44,20 +43,9 @@ pkg_files( ], ) -pkg_filegroup( - name = "extractor-pack-generic", - srcs = [ - ":resources", - "//go/codeql-tools", - "//go/downgrades", - "//go/extractor:tokenizer", - ], - visibility = ["//visibility:public"], -) - -pkg_files( +codeql_pkg_files( name = "extractor-pack-arch", - srcs = [ + exes = [ "//go/extractor/cli/go-autobuilder", "//go/extractor/cli/go-bootstrap", "//go/extractor/cli/go-build-runner", @@ -65,29 +53,16 @@ pkg_files( "//go/extractor/cli/go-gen-dbscheme", "//go/extractor/cli/go-tokenizer", ], - attributes = pkg_attributes(mode = "0755"), - prefix = "tools/" + codeql_platform, - visibility = ["//visibility:public"], + prefix = "tools/{CODEQL_PLATFORM}", ) -pkg_filegroup( - name = "extractor-pack", +codeql_pack( + name = "go", srcs = [ ":extractor-pack-arch", - ":extractor-pack-generic", + ":resources", + "//go/codeql-tools", + "//go/downgrades", + "//go/extractor:tokenizer", ], - visibility = ["//visibility:public"], -) - -pkg_install( - name = "_extractor_pack", - srcs = [":extractor-pack"], -) - -py_binary( - name = "create-extractor-pack", - srcs = ["create_extractor_pack.py"], - env = {"REPO_NAME": repo_name()}, - main = "create_extractor_pack.py", - deps = ["_extractor_pack"], ) diff --git a/go/Makefile b/go/Makefile index 3ebeb69fcaf1..bc4bc25e5da8 100644 --- a/go/Makefile +++ b/go/Makefile @@ -1,6 +1,6 @@ all: gen extractor -EXTRACTOR_PACK_OUT = build/codeql-extractor-go +EXTRACTOR_PACK_OUT = extractor-pack .PHONY: extractor gen clean autoformat check-formatting @@ -28,7 +28,7 @@ qhelp-to-markdown: scripts/qhelp-to-markdown.sh ql/src "$(QHELP_OUT_DIR)" extractor: - bazel run :create-extractor-pack + bazel run :go-installer gen: bazel run :gen @@ -45,9 +45,9 @@ ql/lib/go.dbscheme.stats: ql/lib/go.dbscheme build/stats/src.stamp extractor codeql dataset measure -o $@ build/stats/database/db-go test: all build/testdb/check-upgrade-path - codeql test run -j0 ql/test --search-path build/codeql-extractor-go --consistency-queries ql/test/consistency --compilation-cache=$(cache) + codeql test run -j0 ql/test --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache) # use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported - env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --search-path build/codeql-extractor-go --consistency-queries ql/test/consistency --compilation-cache=$(cache) + env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache) cd extractor; bazel test ... bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1) diff --git a/go/actions/test/action.yml b/go/actions/test/action.yml index 7648d2ea2e87..cc92ede59b9a 100644 --- a/go/actions/test/action.yml +++ b/go/actions/test/action.yml @@ -40,7 +40,7 @@ runs: - name: Build shell: bash run: | - bazel run go:create-extractor-pack + bazel run go:go-installer - name: Check that all Go code is autoformatted if: inputs.run-code-checks == 'true' && !cancelled() diff --git a/go/codeql-tools/BUILD.bazel b/go/codeql-tools/BUILD.bazel index 8c3946b24ad0..fa32d521fabf 100644 --- a/go/codeql-tools/BUILD.bazel +++ b/go/codeql-tools/BUILD.bazel @@ -1,13 +1,7 @@ -load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files") +load("//misc/bazel:pkg.bzl", "codeql_pkg_files") -pkg_files( - name = "sh-files", - srcs = glob(["*.sh"]), - attributes = pkg_attributes(mode = "0755"), -) - -pkg_files( - name = "non-sh-files", +codeql_pkg_files( + name = "codeql-tools", srcs = glob( ["*"], exclude = [ @@ -15,14 +9,7 @@ pkg_files( "BUILD.bazel", ], ), -) - -pkg_filegroup( - name = "codeql-tools", - srcs = [ - ":non-sh-files", - ":sh-files", - ], + exes = glob(["*.sh"]), prefix = "tools", visibility = ["//go:__pkg__"], ) diff --git a/go/create_extractor_pack.py b/go/create_extractor_pack.py deleted file mode 100755 index 427f0c37c36f..000000000000 --- a/go/create_extractor_pack.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -import os -import pathlib -import shutil -import sys -import subprocess - -try: - workspace_dir = pathlib.Path(os.environ['BUILD_WORKSPACE_DIRECTORY']) -except KeyError: - res = subprocess.run(["bazel", "run", ":create-extractor-pack"], cwd=pathlib.Path(__file__).parent) - sys.exit(res.returncode) - -from go._extractor_pack_install_script import main - -build_dir = workspace_dir / 'go' / 'build' - -if not build_dir.exists(): - # we probably are in the internal repo - workspace_dir /= 'ql' - build_dir = workspace_dir / 'go' / 'build' - -dest_dir = build_dir / 'codeql-extractor-pack' -shutil.rmtree(dest_dir, ignore_errors=True) -os.environ['DESTDIR'] = str(dest_dir) -main(sys.argv) diff --git a/go/extractor-smoke-test/test.sh b/go/extractor-smoke-test/test.sh index 46a7f8a59564..bd22da4d906e 100755 --- a/go/extractor-smoke-test/test.sh +++ b/go/extractor-smoke-test/test.sh @@ -7,7 +7,7 @@ cd $DIR rm -rf testdb -codeql database create --language=go testdb --search-path ../build/codeql-extractor-go +codeql database create --language=go testdb --search-path ../.. codeql dataset check testdb/db-go codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=notracing-out.bqrs --search-path .. codeql bqrs decode notracing-out.bqrs --format=csv --output=notracing-out.csv @@ -19,7 +19,7 @@ export CODEQL_EXTRACTOR_GO_BUILD_TRACING=on rm -rf testdb -codeql database create --language=go testdb --search-path ../build/codeql-extractor-go +codeql database create --language=go testdb --search-path ../.. codeql dataset check testdb/db-go codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=tracing-out.bqrs --search-path .. codeql bqrs decode tracing-out.bqrs --format=csv --output=tracing-out.csv diff --git a/misc/bazel/csharp.bzl b/misc/bazel/csharp.bzl index 299febf53084..0ae4f39d6d78 100644 --- a/misc/bazel/csharp.bzl +++ b/misc/bazel/csharp.bzl @@ -1,7 +1,6 @@ load("@rules_dotnet//dotnet:defs.bzl", "csharp_binary", "csharp_library", "csharp_test", "publish_binary") load("@rules_pkg//pkg:mappings.bzl", "strip_prefix") -load("@semmle_code//:dist.bzl", "pack_zip") -load("//:defs.bzl", "codeql_platform") +load("//misc/bazel:pkg.bzl", "codeql_pkg_files") TARGET_FRAMEWORK = "net8.0" @@ -33,7 +32,7 @@ def codeql_xunit_test(name, **kwargs): **kwargs ) -def codeql_csharp_binary(name, language_prefix = "csharp", **kwargs): +def codeql_csharp_binary(name, **kwargs): kwargs.setdefault("nullable", "enable") kwargs.setdefault("target_frameworks", [TARGET_FRAMEWORK]) @@ -60,10 +59,10 @@ def codeql_csharp_binary(name, language_prefix = "csharp", **kwargs): ), ) - pack_zip( + codeql_pkg_files( name = name, - srcs = [publish_binary_target], - prefix = language_prefix + "/tools/" + codeql_platform, + exes = [publish_binary_target], + prefix = "tools/{CODEQL_PLATFORM}", strip_prefix = strip_prefix.files_only(), visibility = visibility, ) diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 481dbbd0dd8e..d47bf4cd135a 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -1,6 +1,5 @@ load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files") -load("@semmle_code//:dist.bzl", "dist", "pack_zip") -load("//:defs.bzl", "codeql_platform") +load("//misc/bazel:pkg.bzl", "codeql_pack", "codeql_pkg_files") package(default_visibility = ["//visibility:public"]) @@ -37,25 +36,22 @@ pkg_files( strip_prefix = None, ) -dist( - name = "extractor-generic", +codeql_pkg_files( + name = "extractor-arch", + exes = [ + "//python/extractor/tsg-python", + ], + prefix = "tools/{CODEQL_PLATFORM}", +) + +codeql_pack( + name = "python", srcs = [ ":codeql-extractor-yml", ":dbscheme-group", + ":extractor-arch", "//python/downgrades", "//python/extractor", "//python/tools", ], - prefix = "python", - visibility = ["//visibility:public"], -) - -pack_zip( - name = "extractor-arch", - srcs = [ - "//python/extractor/tsg-python", - ], - package_file_name = "extractor-" + codeql_platform + ".zip", - prefix = "python/tools/" + codeql_platform, - visibility = ["//visibility:public"], ) diff --git a/python/extractor/BUILD.bazel b/python/extractor/BUILD.bazel index 697bf8d49a48..eabaee519ea5 100644 --- a/python/extractor/BUILD.bazel +++ b/python/extractor/BUILD.bazel @@ -1,4 +1,4 @@ -load("@semmle_code//:dist.bzl", "pack_zip") +load("//misc/bazel:pkg.bzl", "codeql_pkg_files", "strip_prefix") py_binary( name = "make-zips-py", @@ -31,7 +31,7 @@ genrule( tools = [":make-zips-py"], ) -pack_zip( +codeql_pkg_files( name = "extractor", srcs = [ "LICENSE-PSF.md", # because we distribute imp.py @@ -44,5 +44,6 @@ pack_zip( ":python3src", ] + glob(["data/**"]), prefix = "tools", - visibility = ["//visibility:public"], + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//python:__pkg__"], ) diff --git a/python/tools/BUILD.bazel b/python/tools/BUILD.bazel index 81762c150fb4..487e46e34f5c 100644 --- a/python/tools/BUILD.bazel +++ b/python/tools/BUILD.bazel @@ -1,11 +1,14 @@ -load("@semmle_code//:dist.bzl", "pack_zip") +load("//misc/bazel:pkg.bzl", "codeql_pkg_files") -pack_zip( +codeql_pkg_files( name = "tools", - srcs = glob(["**/*"]), - excludes = [ - "BUILD.bazel", - ] + glob(["recorded-call-graph-metrics/**"]), + exes = glob( + ["**/*"], + exclude = [ + "BUILD.bazel", + "recorded-call-graph-metrics/**", + ], + ), prefix = "tools", - visibility = ["//visibility:public"], + visibility = ["//python:__pkg__"], ) diff --git a/ruby/BUILD.bazel b/ruby/BUILD.bazel index 28cb046e3a66..d8b2989e3590 100644 --- a/ruby/BUILD.bazel +++ b/ruby/BUILD.bazel @@ -1,6 +1,5 @@ -load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files") -load("@semmle_code//:dist.bzl", "dist", "pack_zip") -load("//:defs.bzl", "codeql_platform") +load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup") +load("//misc/bazel:pkg.bzl", "codeql_pack", "codeql_pkg_files") package(default_visibility = ["//visibility:public"]) @@ -14,7 +13,7 @@ alias( actual = "//ruby/ql/lib:dbscheme-stats", ) -pkg_files( +codeql_pkg_files( name = "dbscheme-group", srcs = [ ":dbscheme", @@ -31,30 +30,27 @@ pkg_filegroup( ], ) -pkg_files( +codeql_pkg_files( name = "codeql-extractor-yml", srcs = ["codeql-extractor.yml"], strip_prefix = None, ) -dist( - name = "extractor-generic", +codeql_pkg_files( + name = "extractor-arch", + exes = [ + "//ruby/extractor", + ], + prefix = "tools/{CODEQL_PLATFORM}", +) + +codeql_pack( + name = "ruby", srcs = [ ":codeql-extractor-yml", ":dbscheme-group", + ":extractor-arch", "//ruby/downgrades", "//ruby/tools", ], - prefix = "ruby", - visibility = ["//visibility:public"], -) - -pack_zip( - name = "extractor-arch", - srcs = [ - "//ruby/extractor", - ], - package_file_name = "extractor-" + codeql_platform + ".zip", - prefix = "ruby/tools/" + codeql_platform, - visibility = ["//visibility:public"], ) diff --git a/ruby/Makefile b/ruby/Makefile index 5759d4fd64b9..d40bc33698b4 100644 --- a/ruby/Makefile +++ b/ruby/Makefile @@ -65,4 +65,4 @@ extractor: $(FILES) $(BIN_FILES) cp extractor/target/release/codeql-extractor-ruby$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/extractor$(EXE) test: extractor dbscheme - codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path extractor-pack --consistency-queries ql/consistency-queries ql/test + codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path .. --consistency-queries ql/consistency-queries ql/test diff --git a/ruby/tools/BUILD.bazel b/ruby/tools/BUILD.bazel index 4ec50830a436..b1e257d1a6d1 100644 --- a/ruby/tools/BUILD.bazel +++ b/ruby/tools/BUILD.bazel @@ -1,11 +1,11 @@ -load("@semmle_code//:dist.bzl", "pack_zip") +load("//misc/bazel:pkg.bzl", "codeql_pkg_files") -pack_zip( +codeql_pkg_files( name = "tools", - srcs = glob(["**/*"]), excludes = [ "BUILD.bazel", ], + exes = glob(["**/*"]), prefix = "tools", - visibility = ["//visibility:public"], + visibility = ["//ruby:__pkg__"], ) diff --git a/swift/.gitignore b/swift/.gitignore index 445d287f34a7..c4a93d763d34 100644 --- a/swift/.gitignore +++ b/swift/.gitignore @@ -1,6 +1,3 @@ -# directory created by bazel run //swift:create-extractor-pack -/extractor-pack - # output files created by running tests *.o diff --git a/swift/actions/run-ql-tests/action.yml b/swift/actions/run-ql-tests/action.yml index da10997df448..23d1b8f5da6d 100644 --- a/swift/actions/run-ql-tests/action.yml +++ b/swift/actions/run-ql-tests/action.yml @@ -20,7 +20,7 @@ runs: codeql test run \ --threads=0 \ --ram 50000 \ - --search-path "${{ github.workspace }}/swift/extractor-pack" \ + --search-path "$GITHUB_WORKSPACE" \ --check-databases \ --check-unused-labels \ --check-repeated-labels \ @@ -32,3 +32,4 @@ runs: swift/ql/test env: GITHUB_TOKEN: ${{ github.token }} + GITHUB_WORKSPACE: ${{ github.workspace }}