aboutsummaryrefslogtreecommitdiff
path: root/config/types.lua
blob: 8f80369831c2ded57d0cf4093b3e5f2e98aba830 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---@class (exact) Dirs
---@field prefix string
---@field bin string
---@field include string
---@field lib string
---@field src string

---@class (exact) Recipe
---@field setup (fun(bldit_setup: fun()): number)?
---@field build fun(bldit_build: fun()): number
---@field install fun(bldit_install: fun()): number
---@field remove fun(bldit_remove: fun()): number
---@field on_update (fun(bldit_on_update: fun()): number)?

---@type Recipe
---@alias GetSourcesFn fun(url: string, version: string, target_dir: string): number
---@alias GetVersionFn fun(url: string, target_dir: string): string

---@class (exact) Fetcher
---@field get_sources GetSourcesFn
---@field get_version GetVersionFn

---@class (exact) Package
---@field url string
---@field version string?
---@field fetcher Fetcher | nil
---@field dependencies { [string]: Package } | "bldit" | nil
---@field opts table?
---@field recipe Recipe | fun(final_dir: string): Recipe | "bldit" | nil

---@class (exact) Config
---@field dirs Dirs
---@field fetchers { [string]: Fetcher }
---@field recipes { [string]: Recipe }
---@field pkgs { [string]: Package }