@@ -212,7 +212,7 @@ def _map_cmake_info(info, is_windows):
212
212
213
213
GeneratedCmakeFiles = provider (
214
214
fields = {
215
- "files " : "" ,
215
+ "targets " : "" ,
216
216
},
217
217
)
218
218
@@ -221,7 +221,11 @@ def _generate_cmake_impl(ctx):
221
221
inputs = []
222
222
223
223
infos = {}
224
- for dep in ctx .attr .targets :
224
+ targets = list (ctx .attr .targets )
225
+ for include in ctx .attr .includes :
226
+ targets += include [GeneratedCmakeFiles ].targets .to_list ()
227
+
228
+ for dep in targets :
225
229
for info in [dep [CmakeInfo ]] + dep [CmakeInfo ].transitive_deps .to_list ():
226
230
if info .name != None :
227
231
inputs += info .inputs
@@ -233,11 +237,6 @@ def _generate_cmake_impl(ctx):
233
237
commands += _map_cmake_info (info , is_windows )
234
238
commands .append ("" )
235
239
236
- for include in ctx .attr .includes :
237
- for file in include [GeneratedCmakeFiles ].files .to_list ():
238
- inputs .append (file )
239
- commands .append ("include(${BAZEL_EXEC_ROOT}/%s)" % file .path )
240
-
241
240
# we want to use a run or run_shell action to register a bunch of files like inputs, but we cannot write all
242
241
# in a shell command as we would hit the command size limit. So we first write the file and then copy it with
243
242
# the dummy inputs
@@ -248,7 +247,7 @@ def _generate_cmake_impl(ctx):
248
247
249
248
return [
250
249
DefaultInfo (files = depset ([output ])),
251
- GeneratedCmakeFiles (files = depset ([ output ] )),
250
+ GeneratedCmakeFiles (targets = depset (ctx . attr . targets )),
252
251
]
253
252
254
253
generate_cmake = rule (
0 commit comments