Different source orders can affect output
Nobody has claimed this yet.
- Dominant language
- Starlark
- Stars
- 22
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
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).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mojo_library rule loaded from //mojo:mojo_library.bzl and reproduce the issue using the two source orders shown. Trace how srcs[0] determines compilation, then verify that both orders produce the same output and compile all listed files.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100