repository icon indicating copy to clipboard operation
repository copied to clipboard

Encode dependencies in the repo data

Open ikskuh opened this issue 1 year ago • 0 comments

I'm using a private repository similar to this for my own "package manager" (it's just a way to quickly add submodules). The current format allows these two configurations:

"parser-toolkit": {
  "git": "https://github.com/MasterQ32/parser-toolkit",
  "pkg_file": "src/main.zig"
},
"sdl": {
  "git": "https://github.com/MasterQ32/SDL.zig",
  "sdk_file": "Sdk.zig"
}

The pkg_file item can be set for repositories that export a single zig package (like zig-args), the sdk_file can be used for packages that use a build time package (like SDL.zig).

What's currently not covered is repos that export more than one package (like SDL.zig). What we could do for those is either using a sdk_file or this:

"sdl": {
  "git": "https://github.com/MasterQ32/SDL.zig",
  "sdk_file": "Sdk.zig",
  "packages": {
    "native": "src/binding/sdl.zig",
    "wrapper": "src/wrapper/sdl.zig"
  }
}

This does not cover any dependencies yet, so what i'm experimenting around with is this structure:

"ziglyph": {
  "git": "https://github.com/jecolon/ziglyph",
  "pkg_file": "src/ziglyph.zig"
},
"zigstr": {
  "git": "https://github.com/jecolon/zigstr",
  "pkg_file": "src/Zigstr.zig",
  "dependencies": [
    "ziglyph"
  ]
}

This does not properly encode multi-package-repos yet, neither as a dependency nor as source package. The dependencies field could use a string-formatted variant like "sdl/native" or similar, while multi-package repos could use a { "file": "", "dependencies": [ … ] } structure for the packages items.

Any thoughts?

@mattnite and @nektro already have designed a similar system, so i'd appreciate some input on these thoughts. Am i missing some important data or could this actually be enough to model a zig package structure (excluding any kind of versions)

ikskuh avatar Sep 27 '22 09:09 ikskuh