Skip to content

Different source orders can affect output #103

Description

@Ahajha

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions