5
5
"""Helper macros to configure the LLVM overlay project."""
6
6
7
7
load ("@bazel_tools//tools/build_defs/repo:utils.bzl" , "maybe" )
8
- load ("@bazel_skylib//lib:paths.bzl" , "paths" )
9
8
load (":zlib.bzl" , "llvm_zlib_disable" , "llvm_zlib_system" )
10
9
load (":terminfo.bzl" , "llvm_terminfo_disable" , "llvm_terminfo_system" )
11
10
@@ -33,23 +32,11 @@ DEFAULT_TARGETS = [
33
32
]
34
33
35
34
def _overlay_directories (repository_ctx ):
36
- src_workspace_path = str (repository_ctx .path (
37
- repository_ctx .attr .src_workspace ,
38
- ).dirname )
39
-
40
- src_path = paths .join (src_workspace_path , repository_ctx .attr .src_path )
41
-
42
- overlay_workspace_path = str (repository_ctx .path (
43
- repository_ctx .attr .overlay_workspace ,
44
- ).dirname )
45
- overlay_path = paths .join (
46
- overlay_workspace_path ,
47
- repository_ctx .attr .overlay_path ,
48
- )
35
+ src_path = repository_ctx .path (Label ("//:WORKSPACE" )).dirname
36
+ bazel_path = src_path .get_child ("utils" ).get_child ("bazel" )
37
+ overlay_path = bazel_path .get_child ("llvm-project-overlay" )
38
+ script_path = bazel_path .get_child ("overlay_directories.py" )
49
39
50
- overlay_script = repository_ctx .path (
51
- repository_ctx .attr ._overlay_script ,
52
- )
53
40
python_bin = repository_ctx .which ("python3" )
54
41
if not python_bin :
55
42
# Windows typically just defines "python" as python3. The script itself
@@ -61,7 +48,7 @@ def _overlay_directories(repository_ctx):
61
48
62
49
cmd = [
63
50
python_bin ,
64
- overlay_script ,
51
+ script_path ,
65
52
"--src" ,
66
53
src_path ,
67
54
"--overlay" ,
@@ -98,14 +85,6 @@ llvm_configure = repository_rule(
98
85
local = True ,
99
86
configure = True ,
100
87
attrs = {
101
- "_overlay_script" : attr .label (
102
- default = Label ("//:overlay_directories.py" ),
103
- allow_single_file = True ,
104
- ),
105
- "overlay_workspace" : attr .label (default = Label ("//:WORKSPACE" )),
106
- "overlay_path" : attr .string (default = DEFAULT_OVERLAY_PATH ),
107
- "src_workspace" : attr .label (default = Label ("//:WORKSPACE" )),
108
- "src_path" : attr .string (mandatory = True ),
109
88
"targets" : attr .string_list (default = DEFAULT_TARGETS ),
110
89
},
111
90
)
0 commit comments