# package manager: write deps in a flat format, eliminating the FQN concept · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/94529ffb621fa633437ac48d8f90003e26e8ce5b)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 94529ffb621fa633437ac48d8f90003e26e8ce5b

Requested commit: 94529ffb621fa633437ac48d8f90003e26e8ce5b

Commit: 94529ffb621fa633437ac48d8f90003e26e8ce5b

Tree: 9454170d72caac01866caef3c25a0affa1dcb6de

Author: mlugg

Committer: Andrew Kelley

## Message

````
package manager: write deps in a flat format, eliminating the FQN concept

The new `@depedencies` module contains generated code like the
following (where strings like "abc123" represent hashes):

```zig
pub const root_deps = [_]struct { []const u8, []const u8 }{
    .{ "foo", "abc123" },
};

pub const packages = struct {
    pub const abc123 = struct {
        pub const build_root = "/home/mlugg/.cache/zig/blah/abc123";
        pub const build_zig = @import("abc123");
        pub const deps = [_]struct { []const u8, []const u8 }{
            .{ "bar", "abc123" },
            .{ "name", "ghi789" },
        };
    };
};
```

Each package contains a build root string, the build.zig import, and a
mapping from dependency names to package hashes. There is also such a
mapping for the root package dependencies.

In theory, we could now remove the `dep_prefix` field from `std.Build`,
since its main purpose is now handled differently. I believe this is a
desirable goal, as it doesn't really make sense to assign a single FQN
to any package (because it may appear in many different places in the
package hierarchy). This commit does not remove that field, as it's used
non-trivially in a few places in the build runner and compiler tests:
this will be a future enhancement.

Resolves: #16354
Resolves: #17135

````

## Parents

- [1a0e6bcdb140c844384d62b78a7f4247753f9ffd](https://git.cafe/gitcafe/zig/commit/1a0e6bcdb140c844384d62b78a7f4247753f9ffd?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/94529ffb621fa633437ac48d8f90003e26e8ce5b?format=markdown)
