Compare commits
3 Commits
d6cef19507
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 61a317fa79 | |||
| 1825b9a90b | |||
| 9d4c3e911e |
@@ -1 +1,2 @@
|
|||||||
go.sum
|
go.sum
|
||||||
|
examples/**/target
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "flag"
|
||||||
|
|
||||||
|
type arguments struct {
|
||||||
|
buildDeps bool
|
||||||
|
library bool
|
||||||
|
output string
|
||||||
|
depsPath string
|
||||||
|
test bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
initArgs()
|
||||||
|
}
|
||||||
|
func initArgs() *arguments {
|
||||||
|
b := flag.Bool("b", false, "Enables building dependencies from source, instead of searching for already compiled binaries in the library path.")
|
||||||
|
l := flag.Bool("l", false, "Determines if the output should be placed in the standard dependency crate path.")
|
||||||
|
o := flag.String("o", "build", "Output path for this compilation. Should only be used for binaries.")
|
||||||
|
p := flag.String("p", "/usr/lib/feynman", "Library path root.")
|
||||||
|
t := flag.Bool("t", false, "Enables tests. Does not run Cargo benchmarks or examples.")
|
||||||
|
|
||||||
|
flag.Parse()
|
||||||
|
return &arguments{
|
||||||
|
buildDeps: *b,
|
||||||
|
library: *l,
|
||||||
|
output: *o,
|
||||||
|
depsPath: *p,
|
||||||
|
test: *t,
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.22.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "base64_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
base64 = "0.22.1"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, {}!", base64::encode("world"));
|
||||||
|
}
|
||||||
Generated
+39
@@ -0,0 +1,39 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"r-efi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.186"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "r-efi"
|
||||||
|
version = "6.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "getrandom_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
getrandom = "0.4.3"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, {}!", getrandom::u64().unwrap());
|
||||||
|
}
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "helloworld"
|
||||||
|
version = "0.1.0"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[package]
|
||||||
|
name = "helloworld"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
Generated
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.186"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "libc_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
libc = "0.2.186"
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
extern crate libc;
|
||||||
|
|
||||||
|
use std::ffi::CStr;
|
||||||
|
fn main() {
|
||||||
|
unsafe {
|
||||||
|
let buf: *mut libc::utsname = libc::malloc(size_of::<libc::utsname>()) as *mut libc::utsname;
|
||||||
|
if buf.is_null() {
|
||||||
|
panic!("failed to allocate buf");
|
||||||
|
}
|
||||||
|
libc::uname(buf);
|
||||||
|
let sysname: &CStr = CStr::from_ptr((*buf).sysname.as_ptr());
|
||||||
|
println!("Hello, {}!", sysname.to_str().unwrap());
|
||||||
|
libc::free(buf as *mut core::ffi::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+107
@@ -0,0 +1,107 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.8.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.106"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.46"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_core"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.150"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"memchr",
|
||||||
|
"serde",
|
||||||
|
"serde_core",
|
||||||
|
"zmij",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.118"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.24"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zmij"
|
||||||
|
version = "1.0.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bd2f034a4bebf216c9e4b7083603e024cf930873fd67830cfb083c9fa33129d9"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "serde_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde_json = "1.0.150"
|
||||||
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct HelloWorld {
|
||||||
|
who: String,
|
||||||
|
}
|
||||||
|
fn main() {
|
||||||
|
let json = r#"{
|
||||||
|
"who": "serde"
|
||||||
|
}"#;
|
||||||
|
let hw: HelloWorld = serde_json::from_str(json).unwrap();
|
||||||
|
println!("Hello, {}!", hw.who);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cargo
|
||||||
|
|
||||||
|
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"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package cargo
|
||||||
|
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user