@@ -12,15 +12,15 @@ def _mojo_library_implementation(ctx):
1212 mojo_toolchain = ctx .toolchains ["//:toolchain_type" ].mojo_toolchain_info
1313 build_env = getattr (ctx .toolchains ["//:toolchain_type" ], "build_env" , {})
1414
15- mojo_package = ctx .actions .declare_file (ctx .label .name + ".mojopkg " )
15+ mojo_precmp_file = ctx .actions .declare_file (ctx .label .name + ".mojoc " )
1616 args = ctx .actions .args ()
17- args .add ("package " )
17+ args .add ("precompile " )
1818 args .add ("-strip-file-prefix=." )
19- args .add ("-o" , mojo_package )
19+ args .add ("-o" , mojo_precmp_file )
2020
21- args .add_all (mojo_toolchain .package_copts )
21+ args .add_all (mojo_toolchain .precompile_copts )
2222 if not is_exec_config (ctx ):
23- args .add_all (ctx .attr ._mojo_package_copts [BuildSettingInfo ].value )
23+ args .add_all (ctx .attr ._mojo_precompile_copts [BuildSettingInfo ].value )
2424 args .add_all ([
2525 ctx .expand_location (copt , targets = ctx .attr .additional_compiler_inputs )
2626 for copt in ctx .attr .copts
@@ -35,10 +35,10 @@ def _mojo_library_implementation(ctx):
3535 args .add_all ([file ], map_each = _format_include )
3636
3737 output_group_kwargs = {}
38- package_outputs = [mojo_package ]
38+ precompile_outputs = [mojo_precmp_file ]
3939 if ctx .attr ._export_fixits [BuildSettingInfo ].value :
4040 fixits_file = ctx .actions .declare_file (ctx .label .name + ".mojo_fixits.yaml" )
41- package_outputs .append (fixits_file )
41+ precompile_outputs .append (fixits_file )
4242 output_group_kwargs ["mojo_fixits" ] = depset ([fixits_file ])
4343 args .add ("--experimental-export-fixit" , fixits_file )
4444
@@ -48,10 +48,10 @@ def _mojo_library_implementation(ctx):
4848 executable = mojo_toolchain .mojo ,
4949 inputs = depset (ctx .files .srcs + ctx .files .additional_compiler_inputs , transitive = [transitive_mojodeps ]),
5050 tools = mojo_toolchain .all_tools ,
51- outputs = package_outputs ,
51+ outputs = precompile_outputs ,
5252 arguments = [args , file_args ],
53- mnemonic = "MojoPackage " ,
54- progress_message = "%{label} building mojo package " ,
53+ mnemonic = "MojoPrecompile " ,
54+ progress_message = "%{label} precompiling mojo file " ,
5555 env = {
5656 "MODULAR_CRASH_REPORTING_ENABLED" : "false" ,
5757 "PATH" : "/dev/null" , # Avoid using the host's PATH
@@ -70,12 +70,12 @@ def _mojo_library_implementation(ctx):
7070
7171 return [
7272 DefaultInfo (
73- files = depset ([mojo_package ]),
73+ files = depset ([mojo_precmp_file ]),
7474 runfiles = ctx .runfiles (ctx .files .data ).merge_all (transitive_runfiles ),
7575 ),
7676 MojoInfo (
77- import_paths = depset ([mojo_package .dirname ], transitive = [import_paths ]),
78- mojodeps = depset ([mojo_package ], transitive = [transitive_mojodeps ]),
77+ import_paths = depset ([mojo_precmp_file .dirname ], transitive = [import_paths ]),
78+ mojodeps = depset ([mojo_precmp_file ], transitive = [transitive_mojodeps ]),
7979 ),
8080 OutputGroupInfo (** output_group_kwargs ),
8181 ]
@@ -95,13 +95,13 @@ then be used in copts with the $(location) function.
9595 Additional compiler options to pass to the Mojo compiler.
9696
9797Order of options:
98- 1. copts from mojo_toolchain.package_copts
99- 2. copts from //:mojo_package_copt (if not building in exec config)
98+ 1. copts from mojo_toolchain.precompile_copts
99+ 2. copts from //:mojo_precompile_copt (if not building in exec config)
1001003. copts from this attribute, with $(location) expanded for files in
101101 additional_compiler_inputs.
102102
103103NOTE: copts from --mojocopt and mojo_toolchain.copts are not passed to 'mojo
104- package ' since it does not accept many flags.
104+ precompile ' since it does not accept many flags.
105105""" ,
106106 ),
107107 "srcs" : attr .label_list (
@@ -112,8 +112,8 @@ package' since it does not accept many flags.
112112 providers = [MojoInfo ],
113113 ),
114114 "data" : attr .label_list (),
115- "_mojo_package_copts " : attr .label (
116- default = Label ("//:mojo_package_copt " ),
115+ "_mojo_precompile_copts " : attr .label (
116+ default = Label ("//:mojo_precompile_copt " ),
117117 ),
118118 "_export_fixits" : attr .label (
119119 default = Label ("@rules_mojo//:experimental_export_fixits" ),
0 commit comments