File tree 6 files changed +30
-18
lines changed
6 files changed +30
-18
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,6 @@ http_archive(
27
27
],
28
28
)
29
29
30
- load ("@ql//:defs .bzl" , "ql_utils " )
30
+ load ("@ql//misc/bazel:workspace .bzl" , "ql_workspace " )
31
31
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({
3
3
"@platforms//os:macos" : "osx64" ,
4
4
"@platforms//os:windows" : "win64" ,
5
5
})
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 " )
2
2
load ("@rules_pkg//:install.bzl" , "pkg_install" )
3
3
4
4
pkg_install (
5
5
name = "install" ,
6
6
srcs = ["//swift:extractor-pack" ],
7
7
args = [
8
8
"--destdir" ,
9
- source_dir () + "/../extractor_pack" ,
9
+ current_source_dir () + "/../extractor_pack" ,
10
10
],
11
11
)
You can’t perform that action at this time.
0 commit comments