diff --git a/lockfile.go b/lockfile.go new file mode 100644 index 0000000..6d28666 --- /dev/null +++ b/lockfile.go @@ -0,0 +1,13 @@ +package feynman + +type CargoLock struct { + Packages []LockPackage `toml:"package"` +} + +type LockPackage struct { + Name string `toml:"name"` + Version string `toml:"version"` + Dependencies []string `toml:"dependencies"` + Source string `toml:"source"` + Checksum string `toml:"checksum"` +} diff --git a/manifest.go b/manifest.go new file mode 100644 index 0000000..bb59c42 --- /dev/null +++ b/manifest.go @@ -0,0 +1,51 @@ +package feynman + +type CargoManifest struct { + Package `toml:"package"` + Library Target `toml:"lib"` + Binaries []Target `toml:"bin"` + Tests []Target `toml:"test"` + Dependencies map[string]Dependency `toml:"dependencies"` + BuildDependencies map[string]Dependency `toml:"build-dependencies"` + DevDependencies map[string]Dependency `toml:"dev-dependencies"` + Target TargetTable `toml:"target"` +} +type Package struct { + Name string `toml:"name"` + Version string `toml:"version"` + Edition string `toml:"edition"` + RustVersion string `toml:"rust-version"` + Workspace string `toml:"workspace"` + Build string `toml:"build"` + Links string `toml:"links"` + Autolib bool `toml:"autolib"` + Autobins bool `toml:"autobins"` + Autotests bool `toml:"autotests"` + Resolver string `toml:"resolver"` +} + +type Target struct { + Name string `toml:"name"` + Path string `toml:"path"` + Test bool `toml:"test"` + ProcMacro bool `toml:"proc-macro"` + Harness bool `toml:"harness"` + CrateType []string `toml:"crate-type"` + RequiredFeatures []string `toml:"required-features"` +} + +// n.b. only crates.io and local dependencies are supported. +type Dependency struct { + Version string `toml:"version"` + Path string `toml:"path"` + DefaultFeatures bool `toml:"default-features"` + Features []string `toml:"features"` + Optional bool `toml:"optional"` + Package string `toml:"package"` + Workspace string `toml:"workspace"` +} + +type DependenciesTable struct { + Dependencies map[string]Dependency `toml:"dependencies"` +} +type TargetTable map[string]DependenciesTable