@@ -3,7 +3,7 @@ other Mojo targets."""
33
44load ("@bazel_skylib//rules:common_settings.bzl" , "BuildSettingInfo" )
55load ("//mojo:providers.bzl" , "MojoInfo" )
6- load ("//mojo/private:utils.bzl" , "MOJO_EXTENSIONS" , "collect_mojoinfo" , "is_exec_config" )
6+ load ("//mojo/private:utils.bzl" , "MOJO_EXTENSIONS" , "collect_mojoinfo" , "format_import" , " is_exec_config" )
77
88def _format_include (arg ):
99 return ["-I" , arg .dirname ]
@@ -42,7 +42,7 @@ def _mojo_library_implementation(ctx):
4242 output_group_kwargs ["mojo_fixits" ] = depset ([fixits_file ])
4343 args .add ("--experimental-export-fixit" , fixits_file )
4444
45- file_args .add_all (transitive_mojodeps , map_each = _format_include )
45+ file_args .add_all (import_paths , map_each = format_import )
4646 file_args .add (root_directory )
4747 ctx .actions .run (
4848 executable = mojo_toolchain .mojo ,
@@ -68,15 +68,17 @@ def _mojo_library_implementation(ctx):
6868 for target in ctx .attr .data :
6969 transitive_runfiles .append (target [DefaultInfo ].default_runfiles )
7070
71- import_path = mojo_precmp_file .dirname + "/" + ctx .attr .import_path
72-
7371 return [
7472 DefaultInfo (
7573 files = depset ([mojo_precmp_file ]),
7674 runfiles = ctx .runfiles (ctx .files .data ).merge_all (transitive_runfiles ),
7775 ),
7876 MojoInfo (
79- import_paths = depset ([import_path ], transitive = [import_paths ]),
77+ # Passed through as a File + string combo so that it can be path mapped later.
78+ import_paths = depset (
79+ [struct (package = mojo_precmp_file , import_path = ctx .attr .import_path )],
80+ transitive = [import_paths ],
81+ ),
8082 mojodeps = depset ([mojo_precmp_file ], transitive = [transitive_mojodeps ]),
8183 ),
8284 OutputGroupInfo (** output_group_kwargs ),
0 commit comments