@@ -37,13 +37,18 @@ The locker binary to run.
3737
3838def _impl (ctx ):
3939 args = ctx .actions .args ()
40+
41+ # TODO @aignas 2025-03-02: create an executable file here that is using a
42+ # python and uv toolchains.
4043 if ctx .files .src_outs :
4144 args .add_all ([
4245 "--src-out" ,
4346 ctx .files .src_outs [0 ].path ,
4447 ])
4548 args .add ("--output-file" , ctx .outputs .out )
4649 args .add_all (ctx .attr .args )
50+
51+ # TODO @aignas 2025-03-02: add the following deps to _RunLockInfo
4752 srcs = ctx .files .srcs + ctx .files .src_outs
4853 args .add_all (ctx .files .srcs )
4954
@@ -105,13 +110,15 @@ def lock(*, name, srcs, out, args = [], **kwargs):
105110
106111 user_args = args
107112
108- existing_outputs = native .glob ([out ], allow_empty = True )
109- existing_outputs = [
110- path
111- for path in existing_outputs
112- if path == out
113- ]
113+ existing_outputs = []
114+ for path in native .glob ([out ], allow_empty = True ):
115+ if path == out :
116+ existing_outputs = [out ]
117+ break
118+
119+ # TODO @aignas 2025-03-02: move the following args to a template expansion action
114120 args = [
121+ # FIXME @aignas 2025-03-02: this acts differently in native_binary and the rule
115122 "--custom-compile-command='bazel run //{}:{}'" .format (pkg , update_target ),
116123 "--generate-hashes" ,
117124 "--emit-index-url" ,
@@ -142,21 +149,32 @@ def lock(*, name, srcs, out, args = [], **kwargs):
142149 if existing_outputs :
143150 # This means that the output file already exists and it should be used
144151 # to create a new file. This will be taken care by the locker tool.
152+ #
153+ # TODO @aignas 2025-03-02: similarly to sphinx rule, expand the output to short_path
145154 run_args += ["--output-file" , "$(location {})" .format (existing_outputs [0 ])]
146155 else :
156+ # TODO @aignas 2025-03-02: pass the output as a string
147157 run_out = "{}/{}" .format (pkg , out )
148158 run_args += ["--output-file" , run_out ]
159+
160+ # args just get passed as is
149161 run_args += args + [
162+ # TODO @aignas 2025-03-02: get the full source location for these
150163 "$(location {})" .format (s )
151164 for s in srcs
152165 ]
153- run_data = srcs + existing_outputs
154166
155167 native_binary (
168+ # this is expand_template using the stuff from the provider from the _lock rule
156169 name = name + ".run" ,
157- args = run_args ,
158- data = run_data ,
170+ args = run_args , # the main difference is the expansion of args here
171+ data = srcs + existing_outputs , # This only depends on inputs to the _lock
159172 src = "//python/uv/private:pip_compile" ,
173+ tags = [
174+ "local" ,
175+ "manual" ,
176+ "no-cache" ,
177+ ],
160178 )
161179
162180 # Write a script that can be used for updating the in-tree version of the
0 commit comments