The following targets give different output (aside from file name):
load("//mojo:mojo_library.bzl", "mojo_library")
mojo_library(
name = "lib1",
srcs = [
"__init__.mojo",
"foo/__init__.mojo",
],
)
mojo_library(
name = "lib2",
srcs = [
# do not sort
"foo/__init__.mojo",
"__init__.mojo",
],
)
We seem to be relying on the fact that srcs[0] is in the root directory, so if the first source is not in the root directory then we only compile a subset of the files.
We could look for the root-most __init__.mojo but I would need to be certain that we can rely on that assumption.
In any case, generally we don't run into this since __init__.mojo always gets sorted to the first item by glob and by buildifier (if specified manually).
The following targets give different output (aside from file name):
We seem to be relying on the fact that
srcs[0]is in the root directory, so if the first source is not in the root directory then we only compile a subset of the files.We could look for the root-most
__init__.mojobut I would need to be certain that we can rely on that assumption.In any case, generally we don't run into this since
__init__.mojoalways gets sorted to the first item bygloband by buildifier (if specified manually).