Initial implementaiton for version 3.0
This commit is contained in:
parent
bc9c0d3265
commit
674b712364
|
@ -1,75 +1,366 @@
|
|||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.7.5"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cargo-lipo"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"clap 2.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.2.6"
|
||||
name = "atty"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
name = "autocfg"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.1.43"
|
||||
name = "backtrace"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.6"
|
||||
name = "backtrace-sys"
|
||||
version = "0.1.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cargo-lipo"
|
||||
version = "3.0.0"
|
||||
dependencies = [
|
||||
"cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo_metadata"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "error-chain"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "failure"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "redox_termios"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.49 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "0.7.15"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "0.7.4"
|
||||
name = "serde_derive"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.4.1"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termion"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.49 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -78,20 +369,114 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.6.0"
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "wincolor"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum ansi_term 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "30275ad0ad84ec1c06dde3b3f7d23c6006b7d76d61a85e7060b426b747eff70d"
|
||||
"checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23"
|
||||
"checksum clap 2.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ae14fd6c0dfcaab81ac4413928edb79dd7fd04634f7bfffe1af64946eec3b4d2"
|
||||
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
|
||||
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
|
||||
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
|
||||
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
|
||||
"checksum serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0e0732aa8ec4267f61815a396a942ba3525062e3bd5520aa8419927cfc0a92"
|
||||
"checksum serde_json 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b22e8a0554f31cb0f501e027de07b253553b308124f61c57598b9678dba35c0b"
|
||||
"checksum strsim 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d5f575d5ced6634a5c4cb842163dab907dc7e9148b28dc482d81b8855cbe985"
|
||||
"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||
"checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727"
|
||||
"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5"
|
||||
"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6"
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe"
|
||||
"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749"
|
||||
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
|
||||
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
||||
"checksum failure 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e945b93ec214c6e97b520ec6c5d80267fc97af327658ee5b9f35984626e51fbf"
|
||||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||
"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
|
||||
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
|
||||
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
|
||||
"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74"
|
||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||
"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9"
|
||||
"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
|
||||
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
|
||||
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
|
||||
"checksum redox_syscall 0.1.49 (registry+https://github.com/rust-lang/crates.io-index)" = "f22c50afdcf3f0a31ebb6b47697f6a7c5e5a24967e842858118bce0615f0afad"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"
|
||||
"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1"
|
||||
"checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7"
|
||||
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)" = "157e12af46859e968da75dea9845530e13d03bcab2009a41b9b7bb3cf4eb3ec2"
|
||||
"checksum serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)" = "9469829702497daf2daf3c190e130c3fa72f719920f73c86160d43e8f8d76951"
|
||||
"checksum serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "bdf540260cfee6da923831f4776ddc495ada940c30117977c70f1313a6130545"
|
||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||
"checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3"
|
||||
"checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04"
|
||||
"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc"
|
||||
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
|
||||
"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"
|
||||
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
||||
"checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
|
||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"
|
||||
|
|
11
Cargo.toml
11
Cargo.toml
|
@ -1,8 +1,9 @@
|
|||
[package]
|
||||
name = "cargo-lipo"
|
||||
version = "2.0.0"
|
||||
version = "3.0.0"
|
||||
authors = ["Tim Neumann <mail@timnn.me>"]
|
||||
description = "cargo lipo subcommand to automatically create universal libraries for iOS"
|
||||
edition = "2018"
|
||||
|
||||
homepage = "https://github.com/TimNN/cargo-lipo"
|
||||
repository = "https://github.com/TimNN/cargo-lipo"
|
||||
|
@ -14,5 +15,9 @@ keywords = ["cargo", "iOS"]
|
|||
license = "MIT/Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
clap = "~2.2.3"
|
||||
serde_json = "0.7.0"
|
||||
cargo_metadata = "0.6"
|
||||
clap = "2.32"
|
||||
env_logger = "0.6"
|
||||
failure = { version = "0.1", default-features = false, features = ["std"] }
|
||||
log = "0.4"
|
||||
structopt = "0.2"
|
||||
|
|
|
@ -27,10 +27,6 @@ rustup target add i386-apple-ios
|
|||
rustup target add x86_64-apple-ios
|
||||
```
|
||||
|
||||
**Note:** This should work on stable starting with the 1.8 release.
|
||||
|
||||
Alternatively you can build a rust compiler with iOS support yourself.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Cargo fails with ``error: can't find crate for `std` ``: Your rust compiler most likely does not support cross-compiling to iOS.
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
edition = "2018"
|
||||
newline_style = "Unix"
|
||||
# I prefer crate -> self -> super
|
||||
reorder_imports = false
|
||||
use_small_heuristics = "Max"
|
||||
|
||||
# Unstable options that can't be used on stable.
|
||||
#enum_discrim_align_threshold = 20
|
||||
#error_on_line_overflow = true
|
||||
#error_on_unformatted = true
|
||||
#format_macro_matchers = true
|
||||
#format_strings = true
|
||||
#wrap_comments = true
|
|
@ -0,0 +1,92 @@
|
|||
use crate::{Invocation, Result};
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::process::Command;
|
||||
|
||||
pub(crate) struct Cargo<'a> {
|
||||
cargo: OsString,
|
||||
invocation: &'a Invocation,
|
||||
}
|
||||
|
||||
impl<'a> Cargo<'a> {
|
||||
pub(crate) fn new(invocation: &'a Invocation) -> Cargo {
|
||||
Cargo { cargo: env::var_os("CARGO").unwrap_or_else(|| "cargo".into()), invocation }
|
||||
}
|
||||
|
||||
pub(crate) fn build_lib(&self, name: &str, target: &str) -> Result<()> {
|
||||
crate::exec::run(self.prepare_build_lib(name, target))
|
||||
}
|
||||
|
||||
pub(crate) fn clean(&self, name: &str, target: &str) -> Result<()> {
|
||||
crate::exec::run(self.prepare_build_lib(name, target))
|
||||
}
|
||||
|
||||
pub(crate) fn profile(&self) -> &str {
|
||||
if self.invocation.release {
|
||||
"release"
|
||||
} else {
|
||||
"debug"
|
||||
}
|
||||
}
|
||||
|
||||
fn prepare(&self) -> Command {
|
||||
let mut cmd = Command::new(&self.cargo);
|
||||
|
||||
cmd.arg("--color").arg(self.invocation.color.value());
|
||||
|
||||
if self.invocation.verbose > 1 {
|
||||
cmd.arg(format!("-{}", "v".repeat(self.invocation.verbose as usize)));
|
||||
}
|
||||
|
||||
if self.invocation.locked {
|
||||
cmd.arg("--locked");
|
||||
}
|
||||
|
||||
if self.invocation.frozen {
|
||||
cmd.arg("--frozen");
|
||||
}
|
||||
|
||||
cmd
|
||||
}
|
||||
|
||||
fn prepare_target(&self, sub_command: &str, name: &str, target: &str) -> Command {
|
||||
let mut cmd = self.prepare();
|
||||
cmd.arg(sub_command);
|
||||
|
||||
if let Some(ref path) = self.invocation.manifest_path {
|
||||
cmd.arg("--manifest-path").arg(path);
|
||||
}
|
||||
|
||||
cmd.arg("-p").arg(name).arg("--target").arg(target);
|
||||
|
||||
if self.invocation.release {
|
||||
cmd.arg("--release");
|
||||
}
|
||||
|
||||
cmd
|
||||
}
|
||||
|
||||
fn prepare_build_lib(&self, name: &str, target: &str) -> Command {
|
||||
let mut cmd = self.prepare_target("build", name, target);
|
||||
|
||||
cmd.arg("--lib");
|
||||
|
||||
if self.invocation.all_features {
|
||||
cmd.arg("--all-features");
|
||||
}
|
||||
|
||||
if self.invocation.no_default_features {
|
||||
cmd.arg("--no-default-features");
|
||||
}
|
||||
|
||||
if let Some(ref features) = self.invocation.features {
|
||||
cmd.arg("--features").arg(features);
|
||||
}
|
||||
|
||||
if let Some(jobs) = self.invocation.jobs {
|
||||
cmd.arg("--jobs").arg(jobs.to_string());
|
||||
}
|
||||
|
||||
cmd
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
use crate::Result;
|
||||
use failure::{bail, ResultExt};
|
||||
use log::debug;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn run(mut cmd: Command) -> Result<()> {
|
||||
debug!("Running: {:?}", cmd);
|
||||
|
||||
let status = cmd.status().with_context(|e| format!("Executing {:?} failed: {}", cmd, e))?;
|
||||
|
||||
if !status.success() {
|
||||
bail!("Executing {:?} finished with error status: {}", cmd, status);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
/// Retrieve a value of type `serde_json::Value::$Var` from the given `$value: serde_json::Value`
|
||||
/// located at `$path$.
|
||||
///
|
||||
/// Returns `Result<_, &str>`.
|
||||
macro_rules! json_get {($Var:ident, $value:ident $(.$path:ident)+) => (
|
||||
$value.find_path(&[$(stringify!($path)),*])
|
||||
.ok_or(concat!("no such value: ", stringify!($value), $(".", stringify!($path)),*))
|
||||
.and_then(|val| match val {
|
||||
&::json::Value::$Var(ref var) => ::std::result::Result::Ok(var),
|
||||
_ => Err(concat!("incorrect value type, expected: ", stringify!($Var))),
|
||||
});
|
||||
)}
|
|
@ -0,0 +1,50 @@
|
|||
use crate::Result;
|
||||
use crate::cargo::Cargo;
|
||||
use crate::meta::Meta;
|
||||
use failure::ResultExt;
|
||||
use log::info;
|
||||
use std::fs;
|
||||
use std::process::Command;
|
||||
|
||||
pub(crate) fn build(cargo: &Cargo, meta: &Meta, targets: &[impl AsRef<str>]) -> Result<()> {
|
||||
for package in meta.packages() {
|
||||
let lib_name = format!("lib{}.a", package.lib_name());
|
||||
let mut inputs = vec![];
|
||||
|
||||
for target in targets {
|
||||
let target = target.as_ref();
|
||||
info!("Building {:?} for {:?}", package.name(), target);
|
||||
|
||||
cargo.build_lib(package.name(), target).with_context(|e| {
|
||||
format!("Failed to build {:?} for {:?}: {}", package.name(), target, e)
|
||||
})?;
|
||||
|
||||
let mut input = meta.target_dir().to_owned();
|
||||
input.push(target);
|
||||
input.push(cargo.profile());
|
||||
input.push(&lib_name);
|
||||
|
||||
inputs.push(input);
|
||||
}
|
||||
|
||||
let mut output = meta.target_dir().to_owned();
|
||||
output.push("universal");
|
||||
output.push(cargo.profile());
|
||||
|
||||
fs::create_dir_all(&output).with_context(|e| {
|
||||
format!("Creating output directory \"{}\" failed: {}", output.display(), e)
|
||||
})?;
|
||||
|
||||
output.push(&lib_name);
|
||||
|
||||
let mut cmd = Command::new("lipo");
|
||||
cmd.arg("-create").arg("-output").arg(output);
|
||||
cmd.args(inputs);
|
||||
|
||||
info!("Creating universal library for {}", package.name());
|
||||
|
||||
crate::exec::run(cmd)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
341
src/main.rs
341
src/main.rs
|
@ -1,221 +1,166 @@
|
|||
extern crate clap;
|
||||
extern crate serde_json as json;
|
||||
#![allow(clippy::needless_pass_by_value, clippy::new_ret_no_self)]
|
||||
#![deny(unused_must_use)]
|
||||
|
||||
use clap::{App, SubCommand};
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{self, Command, ExitStatus};
|
||||
use std::result::Result as StdResult;
|
||||
use log::{error, trace};
|
||||
use std::cmp;
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use msg_error::{Error, Result};
|
||||
mod cargo;
|
||||
mod exec;
|
||||
mod lipo;
|
||||
mod meta;
|
||||
|
||||
#[macro_use] mod json_macros;
|
||||
#[macro_use] mod msg_error;
|
||||
type Result<T> = std::result::Result<T, failure::Error>;
|
||||
|
||||
static IOS_TRIPLES: &'static [&'static str] = &[
|
||||
"aarch64-apple-ios",
|
||||
"armv7-apple-ios",
|
||||
"i386-apple-ios",
|
||||
"x86_64-apple-ios",
|
||||
];
|
||||
/// Automatically create universal libraries.
|
||||
#[derive(StructOpt, Debug)]
|
||||
#[structopt(name = "cargo-lipo", bin_name = "cargo")]
|
||||
#[structopt(author = "")]
|
||||
#[structopt(raw(setting = "clap::AppSettings::SubcommandRequiredElseHelp"))]
|
||||
struct CargoInvocation {
|
||||
#[structopt(subcommand)]
|
||||
cmd: Command,
|
||||
}
|
||||
|
||||
#[derive(StructOpt, Debug)]
|
||||
enum Command {
|
||||
/// Automatically create universal libraries.
|
||||
#[structopt(name = "lipo")]
|
||||
#[structopt(author = "")]
|
||||
Invocation(Invocation),
|
||||
}
|
||||
|
||||
#[derive(StructOpt, Debug)]
|
||||
struct Invocation {
|
||||
/// Coloring: auto, always, never
|
||||
#[structopt(long, default_value = "auto", value_name = "WHEN")]
|
||||
color: Coloring,
|
||||
|
||||
/// Use verbose output (-vv very verbose output)
|
||||
#[structopt(long, short)]
|
||||
#[structopt(parse(from_occurrences))]
|
||||
verbose: u32,
|
||||
|
||||
/// Build artifacts in release mode, with optimizations
|
||||
#[structopt(long)]
|
||||
release: bool,
|
||||
|
||||
/// Require Cargo.lock and cache are up to date
|
||||
#[structopt(long)]
|
||||
frozen: bool,
|
||||
|
||||
/// Require Cargo.lock is up to date
|
||||
#[structopt(long)]
|
||||
locked: bool,
|
||||
|
||||
/// Number of parallel jobs to be used by Cargo, defaults to # of CPUs
|
||||
#[structopt(long, short, value_name = "N")]
|
||||
jobs: Option<u32>,
|
||||
|
||||
/// Build all packages in the workspace (that have a `staticlib` target)
|
||||
#[structopt(long)]
|
||||
all: bool,
|
||||
|
||||
/// Package(s) to build (must have a `staticlib` target)
|
||||
#[structopt(short, long = "package", value_name = "NAME")]
|
||||
#[structopt(conflicts_with = "all")]
|
||||
packages: Vec<String>,
|
||||
|
||||
/// Activate all available features
|
||||
#[structopt(long = "all-features")]
|
||||
all_features: bool,
|
||||
|
||||
/// Path to Cargo.toml
|
||||
#[structopt(long = "no-default-features")]
|
||||
no_default_features: bool,
|
||||
|
||||
/// Space-separated list of features to activate
|
||||
#[structopt(long, value_name = "FEATURES")]
|
||||
#[structopt(parse(from_os_str))]
|
||||
features: Option<OsString>,
|
||||
|
||||
/// Path to Cargo.toml
|
||||
#[structopt(long = "manifest-path", value_name = "PATH")]
|
||||
#[structopt(parse(from_os_str))]
|
||||
manifest_path: Option<PathBuf>,
|
||||
|
||||
/// Build for the target triples
|
||||
#[structopt(long, value_name = "TARGET1,TARGET2")]
|
||||
#[structopt(value_delimiter = ",")]
|
||||
#[structopt(default_value = "aarch64-apple-ios,x86_64-apple-ios")]
|
||||
targets: Vec<String>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
#[cfg(not(any(test, target = "i686-apple-darwin", target = "x86_64-apple-darwin")))]
|
||||
println!("Due to a known rustc issue, cargo-lipo can only be run on macOS. \
|
||||
See https://github.com/rust-lang/rust/issues/36156#issuecomment-373201676 \
|
||||
for more info.");
|
||||
let cargo = CargoInvocation::from_args();
|
||||
let Command::Invocation(invocation) = cargo.cmd;
|
||||
|
||||
if let Err(err) = real_main() {
|
||||
println!("{}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn real_main() -> Result<()> {
|
||||
let matches = build_app().get_matches();
|
||||
let matches = trm!("Invalid invocation"; matches.subcommand_matches("lipo").ok_or("subcommand required"));
|
||||
|
||||
let release = matches.is_present("release");
|
||||
let verbose = matches.is_present("verbose");
|
||||
|
||||
let lib_name = try!(find_lib_name(verbose));
|
||||
|
||||
let triples: Vec<&str> = match matches.values_of("targets") {
|
||||
Some(values) => values.collect(),
|
||||
None => IOS_TRIPLES.to_vec(),
|
||||
};
|
||||
|
||||
let features = matches.value_of("features").unwrap_or("");
|
||||
let no_default_features = matches.is_present("no-default-features");
|
||||
|
||||
let color = matches.value_of("color").unwrap_or("auto");
|
||||
|
||||
for triple in &triples {
|
||||
try!(build_triple(BuildOptions {
|
||||
triple,
|
||||
release,
|
||||
verbose,
|
||||
features,
|
||||
color,
|
||||
no_default_features,
|
||||
}));
|
||||
}
|
||||
|
||||
let target_path = try!(find_target_path(verbose));
|
||||
let target_subdir = if release { "release" } else { "debug" };
|
||||
|
||||
let out_dir = target_path.join("universal").join(&target_subdir);
|
||||
let out = out_dir.join(&lib_name);
|
||||
|
||||
trm!("Failed to create output directory"; fs::create_dir_all(&out_dir));
|
||||
|
||||
let mut cmd = Command::new("lipo");
|
||||
cmd.args(&["-create", "-output"]);
|
||||
cmd.arg(out.as_os_str());
|
||||
|
||||
for triple in &triples {
|
||||
cmd.arg(target_path.join(triple).join(target_subdir).join(&lib_name).as_os_str());
|
||||
}
|
||||
|
||||
let status = trm!("Failed to execute lipo"; cmd.status());
|
||||
|
||||
trm!("lipo exited unsuccessfully"; exit_to_result(status));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn build_app<'a, 'b>() -> App<'a, 'b> {
|
||||
App::new("cargo-lipo")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author("Tim Neumann <mail@timnn.me>")
|
||||
.about("This binary should only be executed as a custom cargo subcommand (ie. `cargo lipo`)")
|
||||
.bin_name("cargo")
|
||||
.subcommand(SubCommand::with_name("lipo")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author("Tim Neumann <mail@timnn.me>")
|
||||
.about("Automatically create universal libraries")
|
||||
.args_from_usage("--release 'Compiles in release mode'
|
||||
--targets=[TRIPLE1,TRIPLE2] 'Build for the target triples'
|
||||
--features=[FEATURES] 'Space-separated list of features to also build'
|
||||
--no-default-features 'Do not activate the `default` feature'
|
||||
--color=[WHEN] 'Coloring: auto, always, never'
|
||||
-v --verbose 'Print additional information'")
|
||||
env_logger::Builder::from_default_env()
|
||||
.default_format_timestamp(false)
|
||||
.write_style(invocation.color.log_style())
|
||||
.filter_module(
|
||||
"cargo_lipo",
|
||||
[log::LevelFilter::Info, log::LevelFilter::Debug, log::LevelFilter::Trace]
|
||||
[cmp::min(invocation.verbose, 2) as usize],
|
||||
)
|
||||
.init();
|
||||
|
||||
trace!("Invocation: {:#?}", invocation);
|
||||
|
||||
if let Err(e) = run(invocation) {
|
||||
error!("{}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// Struct containing arguments for `build_triple`.
|
||||
#[derive(Debug, Clone)]
|
||||
struct BuildOptions<'a> {
|
||||
pub triple: &'a str,
|
||||
pub release: bool,
|
||||
pub verbose: bool,
|
||||
pub features: &'a str,
|
||||
pub color: &'a str,
|
||||
pub no_default_features: bool,
|
||||
fn run(invocation: Invocation) -> Result<()> {
|
||||
let meta = cargo_metadata::metadata(invocation.manifest_path.as_ref().map(|p| p.as_ref()))
|
||||
.map_err(failure::SyncFailure::new)?;
|
||||
|
||||
trace!("Metadata: {:#?}", meta);
|
||||
|
||||
let meta = meta::Meta::new(&invocation, &meta)?;
|
||||
let cargo = cargo::Cargo::new(&invocation);
|
||||
|
||||
lipo::build(&cargo, &meta, &invocation.targets)
|
||||
}
|
||||
|
||||
/// Invoke `cargo build` for the given triple.
|
||||
fn build_triple(build: BuildOptions) -> Result<()> {
|
||||
let mut cmd = Command::new("cargo");
|
||||
cmd.args(&[
|
||||
"build",
|
||||
"--target", build.triple,
|
||||
"--lib",
|
||||
"--features", build.features,
|
||||
"--color", build.color]);
|
||||
|
||||
if build.release { cmd.arg("--release"); }
|
||||
if build.verbose { cmd.arg("--verbose"); }
|
||||
if build.no_default_features { cmd.arg("--no-default-features"); }
|
||||
|
||||
log_command(&cmd, build.verbose);
|
||||
|
||||
let status = trm!("Failed to build library for {}", build.triple; cmd.status());
|
||||
trm!("Cargo exited unsuccessfully"; exit_to_result(status));
|
||||
|
||||
Ok(())
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
enum Coloring {
|
||||
Auto,
|
||||
Always,
|
||||
Never,
|
||||
}
|
||||
|
||||
/// Find the name of the staticlibrary to build as defined in the project's `Cargo.toml`.
|
||||
fn find_lib_name(verbose: bool) -> Result<String> {
|
||||
static ERR: &'static str = "Failed to parse `cargo read-manifest` output";
|
||||
|
||||
let value = trm!(ERR; cargo_json_value("read-manifest", verbose));
|
||||
|
||||
let targets = trm!(ERR; json_get!(Array, value.targets));
|
||||
|
||||
let mut lib_name = None;
|
||||
|
||||
for target in targets {
|
||||
let kinds = trm!(ERR; json_get!(Array, target.kind));
|
||||
|
||||
for kind in kinds {
|
||||
let kind = trm!(ERR; kind.as_string().ok_or("kind is not a string"));
|
||||
|
||||
if kind == "staticlib" {
|
||||
if let Some(_) = lib_name {
|
||||
return Err(Error::new(ERR, "Multiple targets with kind `staticlib` found"));
|
||||
}
|
||||
|
||||
lib_name = Some(trm!(ERR; json_get!(String, target.name)));
|
||||
}
|
||||
impl Coloring {
|
||||
pub fn value(self) -> &'static str {
|
||||
match self {
|
||||
Coloring::Auto => "auto",
|
||||
Coloring::Always => "always",
|
||||
Coloring::Never => "never",
|
||||
}
|
||||
}
|
||||
|
||||
match lib_name {
|
||||
Some(name) => Ok(String::from("lib") + &name.replace("-", "_") + ".a"),
|
||||
None => Err(Error::new(ERR, "No target with kind `staticlib` found")),
|
||||
pub fn log_style(self) -> env_logger::WriteStyle {
|
||||
match self {
|
||||
Coloring::Auto => env_logger::WriteStyle::Auto,
|
||||
Coloring::Always => env_logger::WriteStyle::Always,
|
||||
Coloring::Never => env_logger::WriteStyle::Never,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Find the path to the project's `target` directory.
|
||||
fn find_target_path(verbose: bool) -> Result<PathBuf> {
|
||||
static ERR: &'static str = "Failed to parse `cargo metadata`";
|
||||
static ERR2: &'static str = "Failed to verify target directory";
|
||||
impl std::str::FromStr for Coloring {
|
||||
type Err = String;
|
||||
|
||||
let value = trm!(ERR; cargo_json_value("metadata", verbose));
|
||||
|
||||
let target_directory = trm!(ERR; json_get!(String, value.target_directory));
|
||||
let target: &Path = target_directory.as_ref();
|
||||
|
||||
let meta = trm!(ERR2; fs::metadata(&target));
|
||||
|
||||
if !meta.is_dir() {
|
||||
Err(Error::new(ERR2, "not a directory"))
|
||||
} else {
|
||||
Ok(target.to_path_buf())
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a `serde_json::Value` from the output of the given cargo subcomand.
|
||||
fn cargo_json_value(subcommand: &str, verbose: bool) -> Result<json::Value> {
|
||||
let mut cmd = Command::new("cargo");
|
||||
cmd.arg(subcommand);
|
||||
|
||||
log_command(&cmd, verbose);
|
||||
|
||||
let output = trm!("Failed to execute cargo"; cmd.output());
|
||||
|
||||
trm!("Cargo exited unsuccessfully"; exit_to_result(output.status));
|
||||
|
||||
let json = trm!("Invalid json"; String::from_utf8(output.stdout));
|
||||
let value = trm!("Invalid json"; json::from_str(&json));
|
||||
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
/// Convert an `ExitStatus` into a `Result`.
|
||||
fn exit_to_result(exit: ExitStatus) -> StdResult<(), String> {
|
||||
if exit.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(exit.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// Log the given command to stdout if running in verbose mode.
|
||||
fn log_command(cmd: &Command, verbose: bool) {
|
||||
if verbose {
|
||||
println!("Executing: {:?}", cmd);
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
match s {
|
||||
"auto" => Ok(Coloring::Auto),
|
||||
"always" => Ok(Coloring::Always),
|
||||
"never" => Ok(Coloring::Never),
|
||||
_ => Err(format!("Invalid coloring: '{}'", s)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
use crate::{Invocation, Result};
|
||||
use failure::bail;
|
||||
use log::{info, debug};
|
||||
use std::path::Path;
|
||||
|
||||
pub(crate) struct Meta<'a> {
|
||||
packages: Vec<Package<'a>>,
|
||||
target_dir: &'a Path,
|
||||
}
|
||||
|
||||
pub(crate) struct Package<'a> {
|
||||
name: &'a str,
|
||||
lib_name: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> Meta<'a> {
|
||||
#[allow(clippy::useless_let_if_seq)] // multiple variables are initialized
|
||||
pub(crate) fn new(
|
||||
invocation: &'a Invocation,
|
||||
meta: &'a cargo_metadata::Metadata,
|
||||
) -> Result<Meta<'a>> {
|
||||
let package_names: Vec<_>;
|
||||
let staticlib_required;
|
||||
|
||||
if !invocation.packages.is_empty() {
|
||||
package_names = invocation.packages.iter().map(|p| p.as_str()).collect();
|
||||
staticlib_required = true;
|
||||
} else {
|
||||
package_names = meta.workspace_members.iter().map(|m| m.name()).collect();
|
||||
// Require a staticlib for single-member workspaces unless `--all` was specified.
|
||||
staticlib_required = meta.workspace_members.len() == 1 && !invocation.all;
|
||||
}
|
||||
|
||||
debug!(
|
||||
"Considering package(s) {:?}, `staticlib` target {}",
|
||||
package_names,
|
||||
if staticlib_required { "required" } else { "not required" }
|
||||
);
|
||||
|
||||
let mut packages = vec![];
|
||||
|
||||
for &name in &package_names {
|
||||
let package = match meta.packages.iter().find(|p| p.name == name) {
|
||||
Some(p) => p,
|
||||
None => bail!("No package metadata found for {:?}", name),
|
||||
};
|
||||
|
||||
let lib_targets: Vec<_> = package
|
||||
.targets
|
||||
.iter()
|
||||
.filter(|t| t.kind.iter().any(|k| k == "staticlib"))
|
||||
.collect();
|
||||
|
||||
match lib_targets.as_slice() {
|
||||
[] => {
|
||||
if !staticlib_required {
|
||||
debug!("Ignoring {:?} because it does not have a `staticlib` target", name);
|
||||
continue;
|
||||
}
|
||||
bail!("No library target found for {:?}", name);
|
||||
}
|
||||
[target] => {
|
||||
if target.crate_types.iter().any(|ct| ct == "staticlib") {
|
||||
packages.push((package, target.name.as_str()));
|
||||
} else {
|
||||
if !staticlib_required {
|
||||
debug!(
|
||||
"Ignoring {:?} because it does not have a `staticlib` crate type",
|
||||
name
|
||||
);
|
||||
continue;
|
||||
}
|
||||
bail!("No staticlib crate type found for {:?}", name);
|
||||
}
|
||||
}
|
||||
_ => bail!("Found multiple lib targets for {:?}", name),
|
||||
}
|
||||
}
|
||||
|
||||
let packages = packages
|
||||
.iter()
|
||||
.map(|(p, lib_name)| Package { name: p.name.as_str(), lib_name })
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let package_names = packages.iter().map(|p| p.name).collect::<Vec<_>>();
|
||||
|
||||
if packages.is_empty() {
|
||||
bail!(
|
||||
"Did not find any packages with a `staticlib` target, considered {:?}",
|
||||
package_names
|
||||
);
|
||||
}
|
||||
|
||||
info!("Will build universal library for {:?}", package_names);
|
||||
|
||||
Ok(Meta { packages, target_dir: Path::new(&meta.target_directory) })
|
||||
}
|
||||
|
||||
pub(crate) fn packages(&self) -> &[Package<'a>] {
|
||||
&self.packages
|
||||
}
|
||||
|
||||
pub(crate) fn target_dir(&self) -> &'a Path {
|
||||
self.target_dir
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Package<'a> {
|
||||
pub(crate) fn name(&self) -> &'a str {
|
||||
self.name
|
||||
}
|
||||
|
||||
pub(crate) fn lib_name(&self) -> &'a str {
|
||||
self.lib_name
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
use std::fmt;
|
||||
use std::result;
|
||||
|
||||
/// A Result who's error type is `msg_error::Error`.
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
/// An error consiting of a message.
|
||||
#[derive(Debug)]
|
||||
pub struct Error {
|
||||
msg: String,
|
||||
}
|
||||
|
||||
impl Error {
|
||||
/// Create a new error with format `"$msg: $err"`.
|
||||
pub fn new<E: fmt::Display>(msg: &str, err: E) -> Error {
|
||||
Error {
|
||||
msg: format!("{}: {}", msg, err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/// Like `try!` but also takes a `format!` like message as the first argument and always returns
|
||||
/// a `msg_error::Result`.
|
||||
macro_rules! trm {
|
||||
($msg:tt; $expr:expr) => (trm!("{}", $msg; $expr));
|
||||
($($msg:expr),+ ; $expr:expr) => (match $expr {
|
||||
::std::result::Result::Ok(val) => val,
|
||||
::std::result::Result::Err(err) => {
|
||||
let msg = format!($($msg),*);
|
||||
let err = ::msg_error::Error::new(&msg, err);
|
||||
return ::std::result::Result::Err(err);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue