File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,6 @@ http_archive(
2727 ],
2828)
2929
30- load ("@ql//:defs .bzl" , "ql_utils " )
30+ load ("@ql//misc/bazel:workspace .bzl" , "ql_workspace " )
3131
32- ql_utils ( name = "utils" )
32+ ql_workspace ( )
Original file line number Diff line number Diff line change @@ -3,17 +3,3 @@ codeql_platform = select({
33 "@platforms//os:macos" : "osx64" ,
44 "@platforms//os:windows" : "win64" ,
55})
6-
7- _paths_bzl = """
8- def source_dir():
9- return '%s/' + native.package_name()
10- """
11-
12- def _ql_utils_impl (repository_ctx ):
13- root = repository_ctx .path (Label ("@ql//:WORKSPACE.bazel" )).realpath .dirname
14- repository_ctx .file ("BUILD.bazel" )
15- repository_ctx .file ("paths.bzl" , content = _paths_bzl % root )
16-
17- ql_utils = repository_rule (
18- implementation = _ql_utils_impl ,
19- )
Original file line number Diff line number Diff line change 1+ def root_source_dir():
2+ """ get absolute path to the root source directory
3+
4+ This can break hermeticity if used in a build step"""
5+ return '{ root} '
6+
7+ def current_source_dir():
8+ """ get absolute path to the source directory of this bazel package
9+
10+ This can break hermeticity if used in a build step"""
11+ return root_source_dir() + '/' + native.package_name()
Original file line number Diff line number Diff line change 1+ def _ql_utils_impl (repository_ctx ):
2+ root = repository_ctx .path (Label ("//:WORKSPACE.bazel" )).realpath .dirname
3+ repository_ctx .file ("BUILD.bazel" )
4+ repository_ctx .template (
5+ "source_dir.bzl" ,
6+ Label ("@ql//misc/bazel:source_dir.bzl.tpl" ),
7+ substitutions = {"{root}" : str (root )},
8+ )
9+
10+ _ql_utils = repository_rule (
11+ implementation = _ql_utils_impl ,
12+ )
13+
14+ def ql_workspace ():
15+ _ql_utils (name = "utils" )
Original file line number Diff line number Diff line change 1- load ("@utils//:paths .bzl" , "source_dir " )
1+ load ("@utils//:source_dir .bzl" , "current_source_dir " )
22load ("@rules_pkg//:install.bzl" , "pkg_install" )
33
44pkg_install (
55 name = "install" ,
66 srcs = ["//swift:extractor-pack" ],
77 args = [
88 "--destdir" ,
9- source_dir () + "/../extractor_pack" ,
9+ current_source_dir () + "/../extractor_pack" ,
1010 ],
1111)
You can’t perform that action at this time.
0 commit comments