@@ -34,7 +34,7 @@ def kebab_case_keys(data):
34
34
}
35
35
36
36
def compile_splicing_manifest (splicing_config , manifests , cargo_config_path , packages ):
37
- """Produce a manifest containing required components for splciing a new Cargo workspace
37
+ """Produce a manifest containing required components for splicing a new Cargo workspace
38
38
39
39
[cargo_config]: https://doc.rust-lang.org/cargo/reference/config.html
40
40
[cargo_toml]: https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -56,14 +56,14 @@ def compile_splicing_manifest(splicing_config, manifests, cargo_config_path, pac
56
56
for (pkg , data ) in packages .items ()
57
57
}
58
58
59
- # Auto-generated splicier manifest values
59
+ # Auto-generated splicer manifest values
60
60
splicing_manifest_content = {
61
61
"cargo_config" : cargo_config_path ,
62
62
"direct_packages" : direct_packages_info ,
63
63
"manifests" : manifests ,
64
64
}
65
65
66
- return dict ( splicing_config . items () + splicing_manifest_content . items ())
66
+ return splicing_config | splicing_manifest_content
67
67
68
68
def _no_at_label (label ):
69
69
"""Strips leading '@'s for stringified labels in the main repository for backwards-comaptibility reasons."""
@@ -75,7 +75,7 @@ def _no_at_label(label):
75
75
return s
76
76
77
77
def create_splicing_manifest (repository_ctx ):
78
- """Produce a manifest containing required components for splciing a new Cargo workspace
78
+ """Produce a manifest containing required components for splicing a new Cargo workspace
79
79
80
80
Args:
81
81
repository_ctx (repository_ctx): The rule's context object.
@@ -94,9 +94,7 @@ def create_splicing_manifest(repository_ctx):
94
94
# Load user configurable splicing settings
95
95
config = json .decode (repository_ctx .attr .splicing_config or splicing_config ())
96
96
97
- repo_dir = repository_ctx .path ("." )
98
-
99
- splicing_manifest = repository_ctx .path ("{}/splicing_manifest.json" .format (repo_dir ))
97
+ splicing_manifest = repository_ctx .path ("splicing_manifest.json" )
100
98
101
99
data = compile_splicing_manifest (
102
100
splicing_config = config ,
@@ -132,7 +130,6 @@ def splice_workspace_manifest(repository_ctx, generator, cargo_lockfile, splicin
132
130
path: The path to a Cargo metadata json file found in the spliced workspace root.
133
131
"""
134
132
repository_ctx .report_progress ("Splicing Cargo workspace." )
135
- repo_dir = repository_ctx .path ("." )
136
133
137
134
splicing_output_dir = repository_ctx .path ("splicing-output" )
138
135
@@ -159,7 +156,7 @@ def splice_workspace_manifest(repository_ctx, generator, cargo_lockfile, splicin
159
156
if CARGO_BAZEL_DEBUG in repository_ctx .os .environ :
160
157
arguments .extend ([
161
158
"--workspace-dir" ,
162
- repository_ctx .path ("{}/ splicing-workspace" . format ( repo_dir ) ),
159
+ repository_ctx .path ("splicing-workspace" ),
163
160
])
164
161
165
162
env = {
@@ -170,10 +167,10 @@ def splice_workspace_manifest(repository_ctx, generator, cargo_lockfile, splicin
170
167
171
168
# Ensure the short hand repin variable is set to the full name.
172
169
if REPIN in repository_ctx .os .environ and CARGO_BAZEL_REPIN not in repository_ctx .os .environ :
173
- env . update ({ CARGO_BAZEL_REPIN : repository_ctx .os .environ [REPIN ]})
170
+ env [ " CARGO_BAZEL_REPIN" ] = repository_ctx .os .environ [REPIN ]
174
171
175
172
# Add any Cargo environment variables to the `cargo-bazel` execution
176
- env . update ( cargo_environ (repository_ctx ) )
173
+ env |= cargo_environ (repository_ctx )
177
174
178
175
execute (
179
176
repository_ctx = repository_ctx ,
@@ -182,11 +179,11 @@ def splice_workspace_manifest(repository_ctx, generator, cargo_lockfile, splicin
182
179
)
183
180
184
181
# This file must have been produced by the execution above.
185
- spliced_lockfile = repository_ctx .path ("{}/ Cargo.lock". format ( splicing_output_dir ))
182
+ spliced_lockfile = repository_ctx .path (splicing_output_dir . get_child ( " Cargo.lock" ))
186
183
if not spliced_lockfile .exists :
187
- fail ("Lockfile file does not exist: {}" . format (spliced_lockfile ))
188
- spliced_metadata = repository_ctx .path ("{}/ metadata.json". format ( splicing_output_dir ))
184
+ fail ("Lockfile file does not exist: " + str (spliced_lockfile ))
185
+ spliced_metadata = repository_ctx .path (splicing_output_dir . get_child ( " metadata.json" ))
189
186
if not spliced_metadata .exists :
190
- fail ("Metadata file does not exist: {}" . format (spliced_metadata ))
187
+ fail ("Metadata file does not exist: " + str (spliced_metadata ))
191
188
192
189
return spliced_metadata
0 commit comments