diff --git a/.npmignore b/.npmignore index 36ad2b169..4da28d013 100644 --- a/.npmignore +++ b/.npmignore @@ -1,10 +1,7 @@ test -bindings docs -lib node_modules spec -ui .git .github .idea diff --git a/bindings/rust/.gitignore b/bindings/rust/.gitignore deleted file mode 100644 index ace562d6e..000000000 --- a/bindings/rust/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -target/ -**/*.rs.bk -Cargo.lock -.idea diff --git a/bindings/rust/Cargo.lock b/bindings/rust/Cargo.lock new file mode 100644 index 000000000..7a56610c0 --- /dev/null +++ b/bindings/rust/Cargo.lock @@ -0,0 +1,127 @@ +[[package]] +name = "bitflags" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "boxfnonce" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cc" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +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 = "proton-sys" +version = "1.0.0" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proton-ui" +version = "1.0.0" +dependencies = [ + "boxfnonce 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proton-sys 1.0.0", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "urlencoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.15.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (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 = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "urlencoding" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum boxfnonce 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5988cb1d626264ac94100be357308f29ff7cbdd3b36bda27f450a4ee3f713426" +"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" +"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" +"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" +"checksum syn 0.15.40 (registry+https://github.com/rust-lang/crates.io-index)" = "bc945221ccf4a7e8c31222b9d1fc77aefdd6638eb901a6ce457a3dc29d4c31e8" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum urlencoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3df3561629a8bb4c57e5a2e4c43348d9e29c7c29d9b1c4c1f47166deca8f37ed" diff --git a/bindings/rust/Cargo.toml b/bindings/rust/Cargo.toml index 93d6250f0..1764ca46b 100644 --- a/bindings/rust/Cargo.toml +++ b/bindings/rust/Cargo.toml @@ -1,17 +1,18 @@ [package] name = "proton-ui" -version = "0.1.0" -authors = ["Boscop", "rstoenescu", "nothingismagick", "lucasfernog"] +version = "1.0.0" +authors = ["Lucas Fernandes Gonçalves Nogueira ", "Daniel Thompson-Yvetot "] readme = "README.md" license = "MIT" repository = "https://github.com/quasarframework/proton" description = "Rust bindings for proton, a toolchain for building more secure native apps that have tiny binaries and are very fast." keywords = ["quasar", "web", "gui", "desktop", "webkit"] categories = ["quasar", "gui", "web-programming", "api-bindings", "rendering", "visualization"] +edition = "2018" [dependencies] urlencoding = "1.0" -proton-sys = { path = "proton-sys", version = "0.1.0" } +proton-sys = { path = "proton-sys", version = "1.0.0" } boxfnonce = "0.1" [features] @@ -21,4 +22,4 @@ V1_30 = [] [dev-dependencies] serde = "1.0" serde_derive = "1.0" -serde_json = "1.0" \ No newline at end of file +serde_json = "1.0" diff --git a/bindings/rust/proton-sys/Cargo.lock b/bindings/rust/proton-sys/Cargo.lock new file mode 100644 index 000000000..bd0a709f4 --- /dev/null +++ b/bindings/rust/proton-sys/Cargo.lock @@ -0,0 +1,28 @@ +[[package]] +name = "bitflags" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cc" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proton-sys" +version = "1.0.0" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" diff --git a/bindings/rust/proton-sys/Cargo.toml b/bindings/rust/proton-sys/Cargo.toml index f63a7fb7e..80e9e420c 100644 --- a/bindings/rust/proton-sys/Cargo.toml +++ b/bindings/rust/proton-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "proton-sys" -version = "0.1.0" -authors = ["Boscop", "rstoenescu", "nothingismagick", "lucasfernog"] +version = "1.0.0" +authors = ["Boscop", "Lucas Fernandes Gonçalves Nogueira ", "Daniel Thompson-Yvetot "] license = "MIT" repository = "https://github.com/quasarframework/proton" description = "Rust native ffi bindings for proton UI" @@ -9,6 +9,7 @@ keywords = ["quasar", "web", "gui", "desktop", "webkit"] categories = ["quasar", "gui", "web-programming", "api-bindings", "rendering", "visualization"] build = "build.rs" links = "proton" +edition = "2018" [lib] name = "proton_sys" @@ -19,4 +20,4 @@ bitflags = "1.0" [build-dependencies] cc = "1" -pkg-config = "0.3" \ No newline at end of file +pkg-config = "0.3" diff --git a/bindings/rust/src/dialog.rs b/bindings/rust/src/dialog.rs index 2a6b8e9ed..cb23fb9ce 100644 --- a/bindings/rust/src/dialog.rs +++ b/bindings/rust/src/dialog.rs @@ -1,6 +1,6 @@ -use ffi::{self, DialogFlags, DialogType}; +use crate::ffi::{self, DialogFlags, DialogType}; use std::{ffi::CString, path::PathBuf}; -use {read_str, WVResult, WebView}; +use super::{read_str, WVResult, WebView}; const STR_BUF_SIZE: usize = 4096; diff --git a/bindings/rust/src/lib.rs b/bindings/rust/src/lib.rs index d0b146948..bdeb9aa60 100644 --- a/bindings/rust/src/lib.rs +++ b/bindings/rust/src/lib.rs @@ -6,13 +6,13 @@ mod color; mod dialog; mod error; mod escape; -pub use color::Color; -pub use dialog::DialogBuilder; -pub use error::{CustomError, Error, WVResult}; -pub use escape::escape; +pub use crate::color::Color; +pub use crate::dialog::DialogBuilder; +pub use crate::error::{CustomError, Error, WVResult}; +pub use crate::escape::escape; use boxfnonce::SendBoxFnOnce; -use ffi::*; +use crate::ffi::*; use std::{ ffi::{CStr, CString}, marker::PhantomData, diff --git a/lib/rust/Cargo.toml b/lib/rust/Cargo.toml index b819a01f7..96d323fb5 100644 --- a/lib/rust/Cargo.toml +++ b/lib/rust/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "proton" -version = "0.1.0" -authors = ["Lucas Fernandes Gonçalves Nogueira "] +version = "1.0.0" +authors = ["Lucas Fernandes Gonçalves Nogueira ", "Daniel Thompson-Yvetot "] +license = "MIT" edition = "2018" [dependencies] @@ -24,4 +25,4 @@ either = "1.5.0" tar = "0.4" flate2 = "1" hyper-old-types = "0.11.0" -sysinfo = "0.9" \ No newline at end of file +sysinfo = "0.9" diff --git a/templates/rust/Cargo.toml b/templates/rust/Cargo.toml index 78f8b2f21..7ebd9e98c 100755 --- a/templates/rust/Cargo.toml +++ b/templates/rust/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "app" version = "0.1.0" -description = "A Quasar app" -authors = ["Lucas Fernandes Nogueira "] -edition = "2018" +description = "A Quasar Proton App" +author = [] +license = "" +repository = "" build = "build.rs" include = ["data"] diff --git a/templates/rust/src/main.rs b/templates/rust/src/main.rs index 41c5f4fa5..71296fa73 100755 --- a/templates/rust/src/main.rs +++ b/templates/rust/src/main.rs @@ -5,6 +5,11 @@ extern crate proton; extern crate proton_ui; extern crate serde_json; +#[cfg(not(feature = "dev"))] +extern crate includedir; +#[cfg(not(feature = "dev"))] +extern crate phf; + #[cfg(not(feature = "dev"))] extern crate tiny_http; @@ -22,7 +27,7 @@ mod server; fn main() { let debug; let content; - let _matches: clap::ArgMatches; + #[cfg(not(feature = "dev"))] { @@ -52,8 +57,8 @@ fn main() { .takes_value(true), ); - _matches = app.get_matches(); - content = proton_ui::Content::Url(_matches.value_of("url").unwrap()); + let matches = app.get_matches(); + content = proton_ui::Content::Url(matches.value_of("url").unwrap().to_owned()); debug = true; } #[cfg(not(feature = "dev"))] diff --git a/tools/rust/cargo-proton-bundle/.gitignore b/tools/rust/cargo-proton-bundle/.gitignore new file mode 100644 index 000000000..c3fa805e8 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/.gitignore @@ -0,0 +1,4 @@ +target +.DS_Store +*.rs.bk +*~ diff --git a/tools/rust/cargo-proton-bundle/Cargo.lock b/tools/rust/cargo-proton-bundle/Cargo.lock new file mode 100644 index 000000000..bd437d345 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/Cargo.lock @@ -0,0 +1,1534 @@ +[[package]] +name = "adler32" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ar" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "argon2rs" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayvec" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "c2-chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cab" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cargo-proton-bundle" +version = "1.0.0" +dependencies = [ + "ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cab 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "icns 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libflate 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "msi 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "target_build_utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfb" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cfg-if" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "chrono" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap" +version = "2.33.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.13 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.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 = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cocoa" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "color_quant" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "constant_time_eq" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-foundation" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-graphics" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-queue" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "deflate" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dirs" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dlib" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dtoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "either" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "enum_primitive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "error-chain" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.33 (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 = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.40 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "filetime" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "flate2" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getrandom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gif" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glob" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "icns" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "image" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gif 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "inflate" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "inflate" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "jpeg-decoder" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libflate" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libloading" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lzw" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "md5" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "memmap" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memoffset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "miniz-sys" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide_c_api" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "msi" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cfb 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nodrop" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-rational" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num_cpus" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "phf" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_codegen" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "png" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)", + "inflate 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "png" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)", + "inflate 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +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 = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon-core" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_users" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rle-decode-fast" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-demangle" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "same-file" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.3.4 (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.9.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha1" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "spin" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (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 = "synstructure" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.40 (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 = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "tar" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "filetime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "target_build_utils" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.11.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 = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "token_store" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "toml" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-width" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "uuid" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "sha1 0.2.0 (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 = "walkdir" +version = "2.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-client" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "token_store 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-kbd" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-protocols" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-scanner" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-sys" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-window" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-protocols 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.7" +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-build" +version = "0.1.1" +source = "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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (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 = "winit" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-kbd 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-protocols 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-window 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "x11-dl" +version = "2.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xml-rs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35c7a5669cb64f085739387e1308b74e6d44022464b7f1b63bbd4ceb6379ec31" +"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" +"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)" = "88fb679bc9af8fa639198790a77f52d345fe13656c08b43afa9424c206b731c6" +"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" +"checksum cab 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9edc5cbf053f06eff0700c840a4e8ef14c6d3c39f277b8340f03481ebac99d0" +"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" +"checksum cfb 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8e7fb075b9b54e939006aa12e1f6cd2d3194041ff4ebe7f2efcbedf18f25b667" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cocoa 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0c23085dde1ef4429df6e5896b89356d35cdd321fb43afe3e378d010bb5adc6" +"checksum color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" +"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" +"checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" +"checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" +"checksum core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb0ed45fdc32f9ab426238fba9407dfead7bacd7900c9b4dd3f396f46eafdae3" +"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" +"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" +"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" +"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" +"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" +"checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +"checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" +"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" +"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" +"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +"checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +"checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +"checksum encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +"checksum encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +"checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" +"checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" +"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum filetime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "450537dc346f0c4d738dda31e790da1da5d4bd12145aad4da0d03d713cb3794f" +"checksum flate2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "550934ad4808d5d39365e5d61727309bf18b3b02c6c56b729cb92e7dd84bc3d8" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum getrandom 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e65cce4e5084b14874c4e7097f38cab54f47ee554f9194673456ea379dcc4c55" +"checksum gif 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e41945ba23db3bf51b24756d73d81acb4f28d85c3dccc32c6fae904438c25f" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum icns 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b324f19f93365e45c7375968a81ff3c52dd99893a48b886099d1664df6d38e68" +"checksum image 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d95816db758249fe16f23a4e23f1a3a817fe11892dbfd1c5836f625324702158" +"checksum inflate 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e0062d2dc2f17d2f13750d95316ae8a2ff909af0fda957084f5defd87c43bb" +"checksum inflate 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f5f9f47468e9a76a6452271efadc88fe865a82be91fe75e6c0c57b87ccea59d4" +"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" +"checksum jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b7d43206b34b3f94ea9445174bda196e772049b9bddbc620c9d29b2d20110d" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" +"checksum libflate 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "90c6f86f4b0caa347206f916f8b687b51d77c6ef8ff18d52dd007491fd580529" +"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" +"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" +"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" +"checksum miniz_oxide 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b6c3756d66cf286314d5f7ebe74886188a9a92f5eee68b06f31ac2b4f314c99d" +"checksum miniz_oxide_c_api 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5b78ca5446dd9fe0dab00e058731b6b08a8c1d2b9cdb8efb10876e24e9ae2494" +"checksum msi 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a20bdea5e04f55fae0d8f89e88beec71822f2d63f61487ff2205d9d05b677923" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" +"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" +"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" +"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" +"checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" +"checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" +"checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum png 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f0b0cabbbd20c2d7f06dbf015e06aad59b6ca3d9ed14848783e98af9aaf19925" +"checksum png 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3cb773e9a557edb568ce9935cf783e3cdcabe06a9449d41b3e5506d88e582c82" +"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_chacha 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e193067942ef6f485a349a113329140d0ab9e2168ce92274499bb0e9a4190d9d" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4b0186e22767d5b9738a05eab7c6ac90b15db17e5b5f9bd87976dd7d89a10a4" +"checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" +"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" +"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" +"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" +"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" +"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ad8bcf487be7d2e15d3d543f04312de991d631cfe1b43ea0ade69e6a8a5b16a1" +"checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" +"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" +"checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" +"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 0.15.40 (registry+https://github.com/rust-lang/crates.io-index)" = "bc945221ccf4a7e8c31222b9d1fc77aefdd6638eb901a6ce457a3dc29d4c31e8" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" +"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" +"checksum target_build_utils 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "013d134ae4a25ee744ad6129db589018558f620ddfa44043887cdd45fa08e75c" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum token_store 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a686838375fc11103b9c1529c6508320b7bd5e2401cd62831ca51b3e82e61849" +"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22" +"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 walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum wayland-client 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2b90adf943117ee4930d7944fe103dcb6f36ba05421f46521cb5adbf6bf0fbc8" +"checksum wayland-kbd 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe0fb1c9917da9529d781659e456d84a693d74fe873d1658109758444616f76" +"checksum wayland-protocols 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb5942dd2fc79d934db437c9ea3aabffceb49b546046ea453bcba531005e5537" +"checksum wayland-scanner 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dcffa55a621e6f2c3d436de64d840fc325e1d0a467b92ee5e7292e17552e08ad" +"checksum wayland-sys 0.12.5 (registry+https://github.com/rust-lang/crates.io-index)" = "377a2f83063c463e801ca10ae8cb9666e6e597eecac0049ac36cc7b9a83b0db3" +"checksum wayland-window 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e5bf431e84f0de9cd06a30b2fb9ab9458f449cb6c36277da703e979ad5c141b1" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum winit 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f1a29847ed6928d6cbabe6b2d5b11dd0ce63380af53a8dcd41775d27d104d285" +"checksum x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)" = "940586acb859ea05c53971ac231685799a7ec1dee66ac0bccc0e6ad96e06b4e3" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" diff --git a/tools/rust/cargo-proton-bundle/Cargo.toml b/tools/rust/cargo-proton-bundle/Cargo.toml new file mode 100644 index 000000000..7d31bd741 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "cargo-proton-bundle" +version = "1.0.0" +authors = ["George Burton ", "Lucas Fernandes Gonçalves Nogueira ", "Daniel Thompson-Yvetot "] +license = "MIT/Apache-2.0" +keywords = ["bundle", "cargo", "proton", "quasar"] +repository = "https://github.com/quasarframework/proton" +description = "Wrap rust executables in OS-specific app bundles for Quasar-Proton" +edition = "2018" + +[dependencies] +ar = "0.3" +cab = "0.1" +chrono = "0.4" +clap = "^2" +dirs = "1.0" +error-chain = "0.12" +glob = "0.2" +icns = "^0.2" +image = "0.12" +libflate = "0.1" +md5 = "0.3" +msi = "0.2" +serde = "1.0" +serde_derive = "1.0" +strsim = "0.7" +tar = "0.4" +target_build_utils = "0.3" +term = "0.4" +toml = "0.4" +uuid = { version = "0.5", features = ["v5"] } +walkdir = "2" + +[dev-dependencies] +tempfile = "3" +winit = "0.11" diff --git a/tools/rust/cargo-proton-bundle/License_Apache.md b/tools/rust/cargo-proton-bundle/License_Apache.md new file mode 100644 index 000000000..e94b926da --- /dev/null +++ b/tools/rust/cargo-proton-bundle/License_Apache.md @@ -0,0 +1,30 @@ +Copyright 2017 Cargo-Bundle developers + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +------- + +Copyright 2019 Quasar Framework + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/tools/rust/cargo-proton-bundle/License_MIT.md b/tools/rust/cargo-proton-bundle/License_MIT.md new file mode 100644 index 000000000..a4560e06a --- /dev/null +++ b/tools/rust/cargo-proton-bundle/License_MIT.md @@ -0,0 +1,31 @@ +Copyright 2017 Cargo-Bundle developers + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +---- + +MIT License + +Copyright (c) 2019 Quasar Framework + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/rust/cargo-proton-bundle/Readme.md b/tools/rust/cargo-proton-bundle/Readme.md new file mode 100644 index 000000000..92d43c73d --- /dev/null +++ b/tools/rust/cargo-proton-bundle/Readme.md @@ -0,0 +1,136 @@ +# Cargo Proton Bundle + +Wrap Rust executables in OS-specific app bundles + +## About + +`cargo proton-bundle` is a tool used to generate installers or app bundles for GUI +executables built with `cargo`. It can create `.app` bundles for Mac OS X and +iOS, `.deb` packages for Linux, and `.msi` installers for Windows (note however +that iOS and Windows support is still experimental). Support for creating +`.rpm` packages (for Linux) and `.apk` packages (for Android) is still pending. + +To install `cargo proton-bundle`, run `cargo install cargo-proton-bundle`. This will add the most recent version of `cargo-bundle` +published to [crates.io](https://crates.io/crates/cargo-bundle) as a subcommand to your default `cargo` installation. + +To start using `cargo proton-bundle`, add a `[package.metadata.bundle]` section to your project's `Cargo.toml` file. This +section describes various attributes of the generated bundle, such as its name, icon, description, copyright, as well +as any packaging scripts you need to generate extra data. The full manifest format is described below. + +To build a bundle for the OS you're on, simply run `cargo proton-bundle` in your +project's directory (where the `Cargo.toml` is placed). If you would like to +bundle a release build, you must add the `--release` flag to your call. To +cross-compile and bundle an application for another OS, add an appropriate +`--target` flag, just as you would for `cargo build`. + +## Bundle manifest format + +There are several fields in the `[package.metadata.bundle]` section. + +### General settings + +These settings apply to bundles for all (or most) OSes. + + * `name`: The name of the built application. If this is not present, then it will use the `name` value from + your `Cargo.toml` file. + * `identifier`: [REQUIRED] A string that uniquely identifies your application, + in reverse-DNS form (for example, `"com.example.appname"` or + `"io.github.username.project"`). For OS X and iOS, this is used as the + bundle's `CFBundleIdentifier` value; for Windows, this is hashed to create + an application GUID. + * `icon`: [OPTIONAL] The icons used for your application. This should be an array of file paths or globs (with images + in various sizes/formats); `cargo-bundle` will automatically convert between image formats as necessary for + different platforms. Supported formats include ICNS, ICO, PNG, and anything else that can be decoded by the + [`image`](https://crates.io/crates/image) crate. Icons intended for high-resolution (e.g. Retina) displays + should have a filename with `@2x` just before the extension (see example below). + * `version`: [OPTIONAL] The version of the application. If this is not present, then it will use the `version` + value from your `Cargo.toml` file. + * `resources`: [OPTIONAL] List of files or directories which will be copied to the resources section of the + bundle. Globs are supported. + * `script`: [OPTIONAL] This is a reserved field; at the moment it is not used for anything, but may be used to + run scripts while packaging the bundle (e.g. download files, compress and encrypt, etc.). + * `copyright`: [OPTIONAL] This contains a copyright string associated with your application. + * `category`: [OPTIONAL] What kind of application this is. This can + be a human-readable string (e.g. `"Puzzle game"`), or a Mac OS X + LSApplicationCategoryType value + (e.g. `"public.app-category.puzzle-games"`), or a GNOME desktop + file category name (e.g. `"LogicGame"`), and `cargo-bundle` will + automatically convert as needed for different platforms. + * `short_description`: [OPTIONAL] A short, one-line description of the application. If this is not present, then it + will use the `description` value from your `Cargo.toml` file. + * `long_description`: [OPTIONAL] A longer, multi-line description of the application. + +### Debian-specific settings + +These settings are used only when bundling `deb` packages. + +* `deb_depends`: A list of strings indicating other packages (e.g. shared + libraries) that this package depends on to be installed. If present, this + forms the `Depends:` field of the `deb` package control file. + +### Mac OS X-specific settings + +These settings are used only when bundling `osx` packages. + +* `osx_frameworks`: A list of strings indicating any Mac OS X frameworks that + need to be bundled with the app. Each string can either be the name of a + framework (without the `.framework` extension, e.g. `"SDL2"`), in which case + `cargo-bundle` will search for that framework in the standard install + locations (`~/Library/Frameworks/`, `/Library/Frameworks/`, and + `/Network/Library/Frameworks/`), or a path to a specific framework bundle + (e.g. `./data/frameworks/SDL2.framework`). Note that this setting just makes + `cargo-bundle` copy the specified frameworks into the OS X app bundle (under + `Foobar.app/Contents/Frameworks/`); you are still responsible for (1) + arranging for the compiled binary to link against those frameworks (e.g. by + emitting lines like `cargo:rustc-link-lib=framework=SDL2` from your + `build.rs` script), and (2) embedding the correct rpath in your binary + (e.g. by running `install_name_tool -add_rpath + "@executable_path/../Frameworks" path/to/binary` after compiling). +* `osx_minimum_system_version`: A version string indicating the minimum Mac OS + X version that the bundled app supports (e.g. `"10.11"`). If you are using + this config field, you may also want have your `build.rs` script emit + `cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.11` (or whatever version number + you want) to ensure that the compiled binary has the same minimum version. + +### Example `Cargo.toml`: + +```toml +[package] +name = "example" +# ...other fields... + +[package.metadata.bundle] +name = "ExampleApplication" +identifier = "com.doe.exampleapplication" +icon = ["32x32.png", "128x128.png", "128x128@2x.png"] +version = "1.0.0" +resources = ["assets", "images/**/*.png", "secrets/public_key.txt"] +copyright = "Copyright (c) Jane Doe 2016. All rights reserved." +category = "Developer Tool" +short_description = "An example application." +long_description = """ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do +eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut +enim ad minim veniam, quis nostrud exercitation ullamco laboris +nisi ut aliquip ex ea commodo consequat. +""" +deb_depends = ["libgl1-mesa-glx", "libsdl2-2.0-0 (>= 2.0.5)"] +osx_frameworks = ["SDL2"] +``` + +## Contributing + +`cargo-proton-bundle` has ambitions to be inclusive project and welcome contributions from anyone. Please abide by the Rust +code of conduct. + +## Status + +Very early alpha. Expect the format of the `[package.metadata.bundle]` section to change, and there is no guarantee of +stability. + +## License +(c) 2017 - present, George Burton, Lucas Fernandes Gonçalves Nogueira, Daniel Thompson-Yvetot, Razvan Stoenescu + +This program is licensed either under the terms of the +[Apache Software License](http://www.apache.org/licenses/LICENSE-2.0), or the +[MIT License](https://opensource.org/licenses/MIT). diff --git a/tools/rust/cargo-proton-bundle/rustfmt.toml b/tools/rust/cargo-proton-bundle/rustfmt.toml new file mode 100644 index 000000000..9da25275e --- /dev/null +++ b/tools/rust/cargo-proton-bundle/rustfmt.toml @@ -0,0 +1,13 @@ +max_width = 100 +hard_tabs = false +tab_spaces = 2 +newline_style = "Auto" +use_small_heuristics = "Default" +reorder_imports = true +reorder_modules = true +remove_nested_parens = true +edition = "2015" +merge_derives = true +use_try_shorthand = false +use_field_init_shorthand = false +force_explicit_abi = true diff --git a/tools/rust/cargo-proton-bundle/src/bundle/category.rs b/tools/rust/cargo-proton-bundle/src/bundle/category.rs new file mode 100644 index 000000000..2e4345862 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/category.rs @@ -0,0 +1,455 @@ +use serde; +use std::fmt; +use strsim; + +const CONFIDENCE_THRESHOLD: f64 = 0.8; + +const OSX_APP_CATEGORY_PREFIX: &str = "public.app-category."; + +// TODO: RIght now, these categories correspond to LSApplicationCategoryType +// values for OS X. There are also some additional GNOME registered categories +// that don't fit these; we should add those here too. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum AppCategory { + Business, + DeveloperTool, + Education, + Entertainment, + Finance, + Game, + ActionGame, + AdventureGame, + ArcadeGame, + BoardGame, + CardGame, + CasinoGame, + DiceGame, + EducationalGame, + FamilyGame, + KidsGame, + MusicGame, + PuzzleGame, + RacingGame, + RolePlayingGame, + SimulationGame, + SportsGame, + StrategyGame, + TriviaGame, + WordGame, + GraphicsAndDesign, + HealthcareAndFitness, + Lifestyle, + Medical, + Music, + News, + Photography, + Productivity, + Reference, + SocialNetworking, + Sports, + Travel, + Utility, + Video, + Weather, +} + +impl AppCategory { + /// Given a string, returns the `AppCategory` it refers to, or the closest + /// string that the user might have intended (if any). + pub fn from_str(input: &str) -> Result> { + // Canonicalize input: + let mut input = input.to_ascii_lowercase(); + if input.starts_with(OSX_APP_CATEGORY_PREFIX) { + input = input.split_at(OSX_APP_CATEGORY_PREFIX.len()).1.to_string(); + } + input = input.replace(" ", ""); + input = input.replace("-", ""); + + // Find best match: + let mut best_confidence = 0.0; + let mut best_category: Option = None; + for &(string, category) in CATEGORY_STRINGS.iter() { + if input == string { + return Ok(category); + } + let confidence = strsim::jaro_winkler(&input, string); + if confidence >= CONFIDENCE_THRESHOLD && confidence > best_confidence { + best_confidence = confidence; + best_category = Some(category); + } + } + Err(best_category.map(AppCategory::canonical)) + } + + /// Map an AppCategory to the string we recommend to use in Cargo.toml if + /// the users misspells the category name. + fn canonical(self) -> &'static str { + match self { + AppCategory::Business => "Business", + AppCategory::DeveloperTool => "Developer Tool", + AppCategory::Education => "Education", + AppCategory::Entertainment => "Entertainment", + AppCategory::Finance => "Finance", + AppCategory::Game => "Game", + AppCategory::ActionGame => "Action Game", + AppCategory::AdventureGame => "Adventure Game", + AppCategory::ArcadeGame => "Arcade Game", + AppCategory::BoardGame => "Board Game", + AppCategory::CardGame => "Card Game", + AppCategory::CasinoGame => "Casino Game", + AppCategory::DiceGame => "Dice Game", + AppCategory::EducationalGame => "Educational Game", + AppCategory::FamilyGame => "Family Game", + AppCategory::KidsGame => "Kids Game", + AppCategory::MusicGame => "Music Game", + AppCategory::PuzzleGame => "Puzzle Game", + AppCategory::RacingGame => "Racing Game", + AppCategory::RolePlayingGame => "Role-Playing Game", + AppCategory::SimulationGame => "Simulation Game", + AppCategory::SportsGame => "Sports Game", + AppCategory::StrategyGame => "Strategy Game", + AppCategory::TriviaGame => "Trivia Game", + AppCategory::WordGame => "Word Game", + AppCategory::GraphicsAndDesign => "Graphics and Design", + AppCategory::HealthcareAndFitness => "Healthcare and Fitness", + AppCategory::Lifestyle => "Lifestyle", + AppCategory::Medical => "Medical", + AppCategory::Music => "Music", + AppCategory::News => "News", + AppCategory::Photography => "Photography", + AppCategory::Productivity => "Productivity", + AppCategory::Reference => "Reference", + AppCategory::SocialNetworking => "Social Networking", + AppCategory::Sports => "Sports", + AppCategory::Travel => "Travel", + AppCategory::Utility => "Utility", + AppCategory::Video => "Video", + AppCategory::Weather => "Weather", + } + } + + /// Map an AppCategory to the closest set of GNOME desktop registered + /// categories that matches that category. + pub fn gnome_desktop_categories(&self) -> &'static str { + match &self { + AppCategory::Business => "Office;", + AppCategory::DeveloperTool => "Development;", + AppCategory::Education => "Education;", + AppCategory::Entertainment => "Network;", + AppCategory::Finance => "Office;Finance;", + AppCategory::Game => "Game;", + AppCategory::ActionGame => "Game;ActionGame;", + AppCategory::AdventureGame => "Game;AdventureGame;", + AppCategory::ArcadeGame => "Game;ArcadeGame;", + AppCategory::BoardGame => "Game;BoardGame;", + AppCategory::CardGame => "Game;CardGame;", + AppCategory::CasinoGame => "Game;", + AppCategory::DiceGame => "Game;", + AppCategory::EducationalGame => "Game;Education;", + AppCategory::FamilyGame => "Game;", + AppCategory::KidsGame => "Game;KidsGame;", + AppCategory::MusicGame => "Game;", + AppCategory::PuzzleGame => "Game;LogicGame;", + AppCategory::RacingGame => "Game;", + AppCategory::RolePlayingGame => "Game;RolePlaying;", + AppCategory::SimulationGame => "Game;Simulation;", + AppCategory::SportsGame => "Game;SportsGame;", + AppCategory::StrategyGame => "Game;StrategyGame;", + AppCategory::TriviaGame => "Game;", + AppCategory::WordGame => "Game;", + AppCategory::GraphicsAndDesign => "Graphics;", + AppCategory::HealthcareAndFitness => "Science;", + AppCategory::Lifestyle => "Education;", + AppCategory::Medical => "Science;MedicalSoftware;", + AppCategory::Music => "AudioVideo;Audio;Music;", + AppCategory::News => "Network;News;", + AppCategory::Photography => "Graphics;Photography;", + AppCategory::Productivity => "Office;", + AppCategory::Reference => "Education;", + AppCategory::SocialNetworking => "Network;", + AppCategory::Sports => "Education;Sports;", + AppCategory::Travel => "Education;", + AppCategory::Utility => "Utility;", + AppCategory::Video => "AudioVideo;Video;", + AppCategory::Weather => "Science;", + } + } + + /// Map an AppCategory to the closest LSApplicationCategoryType value that + /// matches that category. + pub fn osx_application_category_type(&self) -> &'static str { + match &self { + AppCategory::Business => "public.app-category.business", + AppCategory::DeveloperTool => "public.app-category.developer-tools", + AppCategory::Education => "public.app-category.education", + AppCategory::Entertainment => "public.app-category.entertainment", + AppCategory::Finance => "public.app-category.finance", + AppCategory::Game => "public.app-category.games", + AppCategory::ActionGame => "public.app-category.action-games", + AppCategory::AdventureGame => "public.app-category.adventure-games", + AppCategory::ArcadeGame => "public.app-category.arcade-games", + AppCategory::BoardGame => "public.app-category.board-games", + AppCategory::CardGame => "public.app-category.card-games", + AppCategory::CasinoGame => "public.app-category.casino-games", + AppCategory::DiceGame => "public.app-category.dice-games", + AppCategory::EducationalGame => "public.app-category.educational-games", + AppCategory::FamilyGame => "public.app-category.family-games", + AppCategory::KidsGame => "public.app-category.kids-games", + AppCategory::MusicGame => "public.app-category.music-games", + AppCategory::PuzzleGame => "public.app-category.puzzle-games", + AppCategory::RacingGame => "public.app-category.racing-games", + AppCategory::RolePlayingGame => "public.app-category.role-playing-games", + AppCategory::SimulationGame => "public.app-category.simulation-games", + AppCategory::SportsGame => "public.app-category.sports-games", + AppCategory::StrategyGame => "public.app-category.strategy-games", + AppCategory::TriviaGame => "public.app-category.trivia-games", + AppCategory::WordGame => "public.app-category.word-games", + AppCategory::GraphicsAndDesign => "public.app-category.graphics-design", + AppCategory::HealthcareAndFitness => "public.app-category.healthcare-fitness", + AppCategory::Lifestyle => "public.app-category.lifestyle", + AppCategory::Medical => "public.app-category.medical", + AppCategory::Music => "public.app-category.music", + AppCategory::News => "public.app-category.news", + AppCategory::Photography => "public.app-category.photography", + AppCategory::Productivity => "public.app-category.productivity", + AppCategory::Reference => "public.app-category.reference", + AppCategory::SocialNetworking => "public.app-category.social-networking", + AppCategory::Sports => "public.app-category.sports", + AppCategory::Travel => "public.app-category.travel", + AppCategory::Utility => "public.app-category.utilities", + AppCategory::Video => "public.app-category.video", + AppCategory::Weather => "public.app-category.weather", + } + } +} + +impl<'d> serde::Deserialize<'d> for AppCategory { + fn deserialize>(deserializer: D) -> Result { + deserializer.deserialize_str(AppCategoryVisitor { did_you_mean: None }) + } +} + +struct AppCategoryVisitor { + did_you_mean: Option<&'static str>, +} + +impl<'d> serde::de::Visitor<'d> for AppCategoryVisitor { + type Value = AppCategory; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self.did_you_mean { + Some(string) => write!( + formatter, + "a valid app category string (did you mean \"{}\"?)", + string + ), + None => write!(formatter, "a valid app category string"), + } + } + + fn visit_str(mut self, value: &str) -> Result { + match AppCategory::from_str(value) { + Ok(category) => Ok(category), + Err(did_you_mean) => { + self.did_you_mean = did_you_mean; + let unexp = serde::de::Unexpected::Str(value); + Err(serde::de::Error::invalid_value(unexp, &self)) + } + } + } +} + +const CATEGORY_STRINGS: &[(&str, AppCategory)] = &[ + ("actiongame", AppCategory::ActionGame), + ("actiongames", AppCategory::ActionGame), + ("adventuregame", AppCategory::AdventureGame), + ("adventuregames", AppCategory::AdventureGame), + ("arcadegame", AppCategory::ArcadeGame), + ("arcadegames", AppCategory::ArcadeGame), + ("boardgame", AppCategory::BoardGame), + ("boardgames", AppCategory::BoardGame), + ("business", AppCategory::Business), + ("cardgame", AppCategory::CardGame), + ("cardgames", AppCategory::CardGame), + ("casinogame", AppCategory::CasinoGame), + ("casinogames", AppCategory::CasinoGame), + ("developer", AppCategory::DeveloperTool), + ("developertool", AppCategory::DeveloperTool), + ("developertools", AppCategory::DeveloperTool), + ("development", AppCategory::DeveloperTool), + ("dicegame", AppCategory::DiceGame), + ("dicegames", AppCategory::DiceGame), + ("education", AppCategory::Education), + ("educationalgame", AppCategory::EducationalGame), + ("educationalgames", AppCategory::EducationalGame), + ("entertainment", AppCategory::Entertainment), + ("familygame", AppCategory::FamilyGame), + ("familygames", AppCategory::FamilyGame), + ("finance", AppCategory::Finance), + ("fitness", AppCategory::HealthcareAndFitness), + ("game", AppCategory::Game), + ("games", AppCategory::Game), + ("graphicdesign", AppCategory::GraphicsAndDesign), + ("graphicsanddesign", AppCategory::GraphicsAndDesign), + ("graphicsdesign", AppCategory::GraphicsAndDesign), + ("healthcareandfitness", AppCategory::HealthcareAndFitness), + ("healthcarefitness", AppCategory::HealthcareAndFitness), + ("kidsgame", AppCategory::KidsGame), + ("kidsgames", AppCategory::KidsGame), + ("lifestyle", AppCategory::Lifestyle), + ("logicgame", AppCategory::PuzzleGame), + ("medical", AppCategory::Medical), + ("medicalsoftware", AppCategory::Medical), + ("music", AppCategory::Music), + ("musicgame", AppCategory::MusicGame), + ("musicgames", AppCategory::MusicGame), + ("news", AppCategory::News), + ("photography", AppCategory::Photography), + ("productivity", AppCategory::Productivity), + ("puzzlegame", AppCategory::PuzzleGame), + ("puzzlegames", AppCategory::PuzzleGame), + ("racinggame", AppCategory::RacingGame), + ("racinggames", AppCategory::RacingGame), + ("reference", AppCategory::Reference), + ("roleplaying", AppCategory::RolePlayingGame), + ("roleplayinggame", AppCategory::RolePlayingGame), + ("roleplayinggames", AppCategory::RolePlayingGame), + ("rpg", AppCategory::RolePlayingGame), + ("simulationgame", AppCategory::SimulationGame), + ("simulationgames", AppCategory::SimulationGame), + ("socialnetwork", AppCategory::SocialNetworking), + ("socialnetworking", AppCategory::SocialNetworking), + ("sports", AppCategory::Sports), + ("sportsgame", AppCategory::SportsGame), + ("sportsgames", AppCategory::SportsGame), + ("strategygame", AppCategory::StrategyGame), + ("strategygames", AppCategory::StrategyGame), + ("travel", AppCategory::Travel), + ("triviagame", AppCategory::TriviaGame), + ("triviagames", AppCategory::TriviaGame), + ("utilities", AppCategory::Utility), + ("utility", AppCategory::Utility), + ("video", AppCategory::Video), + ("weather", AppCategory::Weather), + ("wordgame", AppCategory::WordGame), + ("wordgames", AppCategory::WordGame), +]; + +#[cfg(test)] +mod tests { + use super::AppCategory; + + #[test] + fn category_from_string_ok() { + // Canonical name of category works: + assert_eq!( + AppCategory::from_str("Education"), + Ok(AppCategory::Education) + ); + assert_eq!( + AppCategory::from_str("Developer Tool"), + Ok(AppCategory::DeveloperTool) + ); + // Lowercase, spaces, and hypens are fine: + assert_eq!( + AppCategory::from_str(" puzzle game "), + Ok(AppCategory::PuzzleGame) + ); + assert_eq!( + AppCategory::from_str("Role-playing game"), + Ok(AppCategory::RolePlayingGame) + ); + // Using macOS LSApplicationCategoryType value is fine: + assert_eq!( + AppCategory::from_str("public.app-category.developer-tools"), + Ok(AppCategory::DeveloperTool) + ); + assert_eq!( + AppCategory::from_str("public.app-category.role-playing-games"), + Ok(AppCategory::RolePlayingGame) + ); + // Using GNOME category name is fine: + assert_eq!( + AppCategory::from_str("Development"), + Ok(AppCategory::DeveloperTool) + ); + assert_eq!( + AppCategory::from_str("LogicGame"), + Ok(AppCategory::PuzzleGame) + ); + // Using common abbreviations is fine: + assert_eq!( + AppCategory::from_str("RPG"), + Ok(AppCategory::RolePlayingGame) + ); + } + + #[test] + fn category_from_string_did_you_mean() { + assert_eq!(AppCategory::from_str("gaming"), Err(Some("Game"))); + assert_eq!(AppCategory::from_str("photos"), Err(Some("Photography"))); + assert_eq!( + AppCategory::from_str("strategery"), + Err(Some("Strategy Game")) + ); + } + + #[test] + fn category_from_string_totally_wrong() { + assert_eq!(AppCategory::from_str("fhqwhgads"), Err(None)); + assert_eq!(AppCategory::from_str("WHARRGARBL"), Err(None)); + } + + #[test] + fn ls_application_category_type_round_trip() { + let values = &[ + "public.app-category.business", + "public.app-category.developer-tools", + "public.app-category.education", + "public.app-category.entertainment", + "public.app-category.finance", + "public.app-category.games", + "public.app-category.action-games", + "public.app-category.adventure-games", + "public.app-category.arcade-games", + "public.app-category.board-games", + "public.app-category.card-games", + "public.app-category.casino-games", + "public.app-category.dice-games", + "public.app-category.educational-games", + "public.app-category.family-games", + "public.app-category.kids-games", + "public.app-category.music-games", + "public.app-category.puzzle-games", + "public.app-category.racing-games", + "public.app-category.role-playing-games", + "public.app-category.simulation-games", + "public.app-category.sports-games", + "public.app-category.strategy-games", + "public.app-category.trivia-games", + "public.app-category.word-games", + "public.app-category.graphics-design", + "public.app-category.healthcare-fitness", + "public.app-category.lifestyle", + "public.app-category.medical", + "public.app-category.music", + "public.app-category.news", + "public.app-category.photography", + "public.app-category.productivity", + "public.app-category.reference", + "public.app-category.social-networking", + "public.app-category.sports", + "public.app-category.travel", + "public.app-category.utilities", + "public.app-category.video", + "public.app-category.weather", + ]; + // Test that if the user uses an LSApplicationCategoryType string as + // the category string, they will get back that same string for the + // macOS app bundle LSApplicationCategoryType. + for &value in values.iter() { + let category = AppCategory::from_str(value).expect(value); + assert_eq!(category.osx_application_category_type(), value); + } + } +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/common.rs b/tools/rust/cargo-proton-bundle/src/bundle/common.rs new file mode 100644 index 000000000..d8c1f738e --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/common.rs @@ -0,0 +1,314 @@ +use std; +use std::ffi::OsStr; +use std::fs::{self, File}; +use std::io::{self, BufWriter, Write}; +use std::path::{Component, Path, PathBuf}; +use term; +use walkdir; +use crate::ResultExt; + +/// Returns true if the path has a filename indicating that it is a high-desity +/// "retina" icon. Specifically, returns true the the file stem ends with +/// "@2x" (a convention specified by the [Apple developer docs]( +/// https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html)). +pub fn is_retina>(path: P) -> bool { + path + .as_ref() + .file_stem() + .and_then(OsStr::to_str) + .map(|stem| stem.ends_with("@2x")) + .unwrap_or(false) +} + +/// Creates a new file at the given path, creating any parent directories as +/// needed. +pub fn create_file(path: &Path) -> crate::Result> { + if let Some(parent) = path.parent() { + fs::create_dir_all(&parent).chain_err(|| format!("Failed to create directory {:?}", parent))?; + } + let file = File::create(path).chain_err(|| format!("Failed to create file {:?}", path))?; + Ok(BufWriter::new(file)) +} + +#[cfg(unix)] +fn symlink_dir(src: &Path, dst: &Path) -> io::Result<()> { + std::os::unix::fs::symlink(src, dst) +} + +#[cfg(windows)] +fn symlink_dir(src: &Path, dst: &Path) -> io::Result<()> { + std::os::windows::fs::symlink_dir(src, dst) +} + +#[cfg(unix)] +fn symlink_file(src: &Path, dst: &Path) -> io::Result<()> { + std::os::unix::fs::symlink(src, dst) +} + +#[cfg(windows)] +fn symlink_file(src: &Path, dst: &Path) -> io::Result<()> { + std::os::windows::fs::symlink_file(src, dst) +} + +/// Copies a regular file from one path to another, creating any parent +/// directories of the destination path as necessary. Fails if the source path +/// is a directory or doesn't exist. +pub fn copy_file(from: &Path, to: &Path) -> crate::Result<()> { + if !from.exists() { + bail!("{:?} does not exist", from); + } + if !from.is_file() { + bail!("{:?} is not a file", from); + } + let dest_dir = to.parent().unwrap(); + fs::create_dir_all(dest_dir).chain_err(|| format!("Failed to create {:?}", dest_dir))?; + fs::copy(from, to).chain_err(|| format!("Failed to copy {:?} to {:?}", from, to))?; + Ok(()) +} + +/// Recursively copies a directory file from one path to another, creating any +/// parent directories of the destination path as necessary. Fails if the +/// source path is not a directory or doesn't exist, or if the destination path +/// already exists. +pub fn copy_dir(from: &Path, to: &Path) -> crate::Result<()> { + if !from.exists() { + bail!("{:?} does not exist", from); + } + if !from.is_dir() { + bail!("{:?} is not a directory", from); + } + if to.exists() { + bail!("{:?} already exists", to); + } + let parent = to.parent().unwrap(); + fs::create_dir_all(parent).chain_err(|| format!("Failed to create {:?}", parent))?; + for entry in walkdir::WalkDir::new(from) { + let entry = entry?; + debug_assert!(entry.path().starts_with(from)); + let rel_path = entry.path().strip_prefix(from).unwrap(); + let dest_path = to.join(rel_path); + if entry.file_type().is_symlink() { + let target = fs::read_link(entry.path())?; + if entry.path().is_dir() { + symlink_dir(&target, &dest_path)?; + } else { + symlink_file(&target, &dest_path)?; + } + } else if entry.file_type().is_dir() { + fs::create_dir(dest_path)?; + } else { + fs::copy(entry.path(), dest_path)?; + } + } + Ok(()) +} + +/// Given a path (absolute or relative) to a resource file, returns the +/// relative path from the bundle resources directory where that resource +/// should be stored. +pub fn resource_relpath(path: &Path) -> PathBuf { + let mut dest = PathBuf::new(); + for component in path.components() { + match component { + Component::Prefix(_) => {} + Component::RootDir => dest.push("_root_"), + Component::CurDir => {} + Component::ParentDir => dest.push("_up_"), + Component::Normal(string) => dest.push(string), + } + } + dest +} + +/// Prints a message to stderr, in the same format that `cargo` uses, +/// indicating that we are creating a bundle with the given filename. +pub fn print_bundling(filename: &str) -> crate::Result<()> { + print_progress("Bundling", filename) +} + +/// Prints a message to stderr, in the same format that `cargo` uses, +/// indicating that we have finished the the given bundles. +pub fn print_finished(output_paths: &Vec) -> crate::Result<()> { + let pluralised = if output_paths.len() == 1 { + "bundle" + } else { + "bundles" + }; + let msg = format!("{} {} at:", output_paths.len(), pluralised); + print_progress("Finished", &msg)?; + for path in output_paths { + println!(" {}", path.display()); + } + Ok(()) +} + +fn safe_term_attr( + output: &mut Box, + attr: term::Attr, +) -> term::Result<()> { + match output.supports_attr(attr) { + true => output.attr(attr), + false => Ok(()), + } +} + +fn print_progress(step: &str, msg: &str) -> crate::Result<()> { + if let Some(mut output) = term::stderr() { + safe_term_attr(&mut output, term::Attr::Bold)?; + output.fg(term::color::GREEN)?; + write!(output, " {}", step)?; + output.reset()?; + write!(output, " {}\n", msg)?; + output.flush()?; + Ok(()) + } else { + let mut output = io::stderr(); + write!(output, " {}", step)?; + write!(output, " {}\n", msg)?; + output.flush()?; + Ok(()) + } +} + +/// Prints a warning message to stderr, in the same format that `cargo` uses. +pub fn print_warning(message: &str) -> crate::Result<()> { + if let Some(mut output) = term::stderr() { + safe_term_attr(&mut output, term::Attr::Bold)?; + output.fg(term::color::YELLOW)?; + write!(output, "warning:")?; + output.reset()?; + write!(output, " {}\n", message)?; + output.flush()?; + Ok(()) + } else { + let mut output = io::stderr(); + write!(output, "warning:")?; + write!(output, " {}\n", message)?; + output.flush()?; + Ok(()) + } +} + +/// Prints an error to stderr, in the same format that `cargo` uses. +pub fn print_error(error: &crate::Error) -> crate::Result<()> { + if let Some(mut output) = term::stderr() { + safe_term_attr(&mut output, term::Attr::Bold)?; + output.fg(term::color::RED)?; + write!(output, "error:")?; + output.reset()?; + safe_term_attr(&mut output, term::Attr::Bold)?; + writeln!(output, " {}", error)?; + output.reset()?; + for cause in error.iter().skip(1) { + writeln!(output, " Caused by: {}", cause)?; + } + if let Some(backtrace) = error.backtrace() { + writeln!(output, "{:?}", backtrace)?; + } + output.flush()?; + Ok(()) + } else { + let mut output = io::stderr(); + write!(output, "error:")?; + writeln!(output, " {}", error)?; + for cause in error.iter().skip(1) { + writeln!(output, " Caused by: {}", cause)?; + } + if let Some(backtrace) = error.backtrace() { + writeln!(output, "{:?}", backtrace)?; + } + output.flush()?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::{copy_dir, create_file, is_retina, resource_relpath, symlink_file}; + use std; + use std::io::Write; + use std::path::PathBuf; + use tempfile; + + #[test] + fn create_file_with_parent_dirs() { + let tmp = tempfile::tempdir().unwrap(); + assert!(!tmp.path().join("parent").exists()); + { + let mut file = create_file(&tmp.path().join("parent/file.txt")).unwrap(); + write!(file, "Hello, world!\n").unwrap(); + } + assert!(tmp.path().join("parent").is_dir()); + assert!(tmp.path().join("parent/file.txt").is_file()); + } + + #[test] + fn copy_dir_with_symlinks() { + // Create a directory structure that looks like this: + // ${TMP}/orig/ + // sub/ + // file.txt + // link -> sub/file.txt + let tmp = tempfile::tempdir().unwrap(); + { + let mut file = create_file(&tmp.path().join("orig/sub/file.txt")).unwrap(); + write!(file, "Hello, world!\n").unwrap(); + } + symlink_file( + &PathBuf::from("sub/file.txt"), + &tmp.path().join("orig/link"), + ) + .unwrap(); + assert_eq!( + std::fs::read(tmp.path().join("orig/link")) + .unwrap() + .as_slice(), + b"Hello, world!\n" + ); + // Copy ${TMP}/orig to ${TMP}/parent/copy, and make sure that the + // directory structure, file, and symlink got copied correctly. + copy_dir(&tmp.path().join("orig"), &tmp.path().join("parent/copy")).unwrap(); + assert!(tmp.path().join("parent/copy").is_dir()); + assert!(tmp.path().join("parent/copy/sub").is_dir()); + assert!(tmp.path().join("parent/copy/sub/file.txt").is_file()); + assert_eq!( + std::fs::read(tmp.path().join("parent/copy/sub/file.txt")) + .unwrap() + .as_slice(), + b"Hello, world!\n" + ); + assert!(tmp.path().join("parent/copy/link").exists()); + assert_eq!( + std::fs::read_link(tmp.path().join("parent/copy/link")).unwrap(), + PathBuf::from("sub/file.txt") + ); + assert_eq!( + std::fs::read(tmp.path().join("parent/copy/link")) + .unwrap() + .as_slice(), + b"Hello, world!\n" + ); + } + + #[test] + fn retina_icon_paths() { + assert!(!is_retina("data/icons/512x512.png")); + assert!(is_retina("data/icons/512x512@2x.png")); + } + + #[test] + fn resource_relative_paths() { + assert_eq!( + resource_relpath(&PathBuf::from("./data/images/button.png")), + PathBuf::from("data/images/button.png") + ); + assert_eq!( + resource_relpath(&PathBuf::from("../../images/wheel.png")), + PathBuf::from("_up_/_up_/images/wheel.png") + ); + assert_eq!( + resource_relpath(&PathBuf::from("/home/ferris/crab.png")), + PathBuf::from("_root_/home/ferris/crab.png") + ); + } +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/deb_bundle.rs b/tools/rust/cargo-proton-bundle/src/bundle/deb_bundle.rs new file mode 100644 index 000000000..7a6f7fef1 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/deb_bundle.rs @@ -0,0 +1,333 @@ +// The structure of a Debian package looks something like this: +// +// foobar_1.2.3_i386.deb # Actually an ar archive +// debian-binary # Specifies deb format version (2.0 in our case) +// control.tar.gz # Contains files controlling the installation: +// control # Basic package metadata +// md5sums # Checksums for files in data.tar.gz below +// postinst # Post-installation script (optional) +// prerm # Pre-uninstallation script (optional) +// data.tar.gz # Contains files to be installed: +// usr/bin/foobar # Binary executable file +// usr/share/applications/foobar.desktop # Desktop file (for apps) +// usr/share/icons/hicolor/... # Icon files (for apps) +// usr/lib/foobar/... # Other resource files +// +// For cargo-bundle, we put bundle resource files under /usr/lib/package_name/, +// and then generate the desktop file and control file from the bundle +// metadata, as well as generating the md5sums file. Currently we do not +// generate postinst or prerm files. + +use super::common; +use ar; +use icns; +use image::png::{PNGDecoder, PNGEncoder}; +use image::{self, GenericImage, ImageDecoder}; +use libflate::gzip; +use md5; +use std::collections::BTreeSet; +use std::ffi::OsStr; +use std::fs::{self, File}; +use std::io::{self, Write}; +use std::path::{Path, PathBuf}; +use tar; +use walkdir::WalkDir; +use crate::{ResultExt, Settings}; + +pub fn bundle_project(settings: &Settings) -> crate::Result> { + let arch = match settings.binary_arch() { + "x86" => "i386", + "x86_64" => "amd64", + other => other, + }; + let package_base_name = format!( + "{}_{}_{}", + settings.binary_name(), + settings.version_string(), + arch + ); + let package_name = format!("{}.deb", package_base_name); + common::print_bundling(&package_name)?; + let base_dir = settings.project_out_directory().join("bundle/deb"); + let package_dir = base_dir.join(&package_base_name); + if package_dir.exists() { + fs::remove_dir_all(&package_dir) + .chain_err(|| format!("Failed to remove old {}", package_base_name))?; + } + let package_path = base_dir.join(package_name); + + // Generate data files. + let data_dir = package_dir.join("data"); + let binary_dest = data_dir.join("usr/bin").join(settings.binary_name()); + common::copy_file(settings.binary_path(), &binary_dest) + .chain_err(|| "Failed to copy binary file")?; + transfer_resource_files(settings, &data_dir).chain_err(|| "Failed to copy resource files")?; + generate_icon_files(settings, &data_dir).chain_err(|| "Failed to create icon files")?; + generate_desktop_file(settings, &data_dir).chain_err(|| "Failed to create desktop file")?; + + // Generate control files. + let control_dir = package_dir.join("control"); + generate_control_file(settings, arch, &control_dir, &data_dir) + .chain_err(|| "Failed to create control file")?; + generate_md5sums(&control_dir, &data_dir).chain_err(|| "Failed to create md5sums file")?; + + // Generate `debian-binary` file; see + // http://www.tldp.org/HOWTO/Debian-Binary-Package-Building-HOWTO/x60.html#AEN66 + let debian_binary_path = package_dir.join("debian-binary"); + create_file_with_data(&debian_binary_path, "2.0\n") + .chain_err(|| "Failed to create debian-binary file")?; + + // Apply tar/gzip/ar to create the final package file. + let control_tar_gz_path = + tar_and_gzip_dir(control_dir).chain_err(|| "Failed to tar/gzip control directory")?; + let data_tar_gz_path = + tar_and_gzip_dir(data_dir).chain_err(|| "Failed to tar/gzip data directory")?; + create_archive( + vec![debian_binary_path, control_tar_gz_path, data_tar_gz_path], + &package_path, + ) + .chain_err(|| "Failed to create package archive")?; + Ok(vec![package_path]) +} + +/// Generate the application desktop file and store it under the `data_dir`. +fn generate_desktop_file(settings: &Settings, data_dir: &Path) -> crate::Result<()> { + let bin_name = settings.binary_name(); + let desktop_file_name = format!("{}.desktop", bin_name); + let desktop_file_path = data_dir + .join("usr/share/applications") + .join(desktop_file_name); + let file = &mut common::create_file(&desktop_file_path)?; + // For more information about the format of this file, see + // https://developer.gnome.org/integration-guide/stable/desktop-files.html.en + write!(file, "[Desktop Entry]\n")?; + write!(file, "Encoding=UTF-8\n")?; + if let Some(category) = settings.app_category() { + write!(file, "Categories={}\n", category.gnome_desktop_categories())?; + } + if !settings.short_description().is_empty() { + write!(file, "Comment={}\n", settings.short_description())?; + } + write!(file, "Exec={}\n", bin_name)?; + write!(file, "Icon={}\n", bin_name)?; + write!(file, "Name={}\n", settings.bundle_name())?; + write!(file, "Terminal=false\n")?; + write!(file, "Type=Application\n")?; + write!(file, "Version={}\n", settings.version_string())?; + Ok(()) +} + +fn generate_control_file( + settings: &Settings, + arch: &str, + control_dir: &Path, + data_dir: &Path, +) -> crate::Result<()> { + // For more information about the format of this file, see + // https://www.debian.org/doc/debian-policy/ch-controlfields.html + let dest_path = control_dir.join("control"); + let mut file = common::create_file(&dest_path)?; + writeln!( + &mut file, + "Package: {}", + str::replace(settings.bundle_name(), " ", "-").to_ascii_lowercase() + )?; + writeln!(&mut file, "Version: {}", settings.version_string())?; + writeln!(&mut file, "Architecture: {}", arch)?; + writeln!(&mut file, "Installed-Size: {}", total_dir_size(data_dir)?)?; + let authors = settings.authors_comma_separated().unwrap_or(String::new()); + writeln!(&mut file, "Maintainer: {}", authors)?; + if !settings.homepage_url().is_empty() { + writeln!(&mut file, "Homepage: {}", settings.homepage_url())?; + } + let dependencies = settings.debian_dependencies(); + if !dependencies.is_empty() { + writeln!(&mut file, "Depends: {}", dependencies.join(", "))?; + } + let mut short_description = settings.short_description().trim(); + if short_description.is_empty() { + short_description = "(none)"; + } + let mut long_description = settings.long_description().unwrap_or("").trim(); + if long_description.is_empty() { + long_description = "(none)"; + } + writeln!(&mut file, "Description: {}", short_description)?; + for line in long_description.lines() { + let line = line.trim(); + if line.is_empty() { + writeln!(&mut file, " .")?; + } else { + writeln!(&mut file, " {}", line)?; + } + } + file.flush()?; + Ok(()) +} + +/// Create an `md5sums` file in the `control_dir` containing the MD5 checksums +/// for each file within the `data_dir`. +fn generate_md5sums(control_dir: &Path, data_dir: &Path) -> crate::Result<()> { + let md5sums_path = control_dir.join("md5sums"); + let mut md5sums_file = common::create_file(&md5sums_path)?; + for entry in WalkDir::new(data_dir) { + let entry = entry?; + let path = entry.path(); + if path.is_dir() { + continue; + } + let mut file = File::open(path)?; + let mut hash = md5::Context::new(); + io::copy(&mut file, &mut hash)?; + for byte in hash.compute().iter() { + write!(md5sums_file, "{:02x}", byte)?; + } + let rel_path = path.strip_prefix(data_dir).unwrap(); + let path_str = rel_path.to_str().ok_or_else(|| { + let msg = format!("Non-UTF-8 path: {:?}", rel_path); + io::Error::new(io::ErrorKind::InvalidData, msg) + })?; + write!(md5sums_file, " {}\n", path_str)?; + } + Ok(()) +} + +/// Copy the bundle's resource files into an appropriate directory under the +/// `data_dir`. +fn transfer_resource_files(settings: &Settings, data_dir: &Path) -> crate::Result<()> { + let resource_dir = data_dir.join("usr/lib").join(settings.binary_name()); + for src in settings.resource_files() { + let src = src?; + let dest = resource_dir.join(common::resource_relpath(&src)); + common::copy_file(&src, &dest) + .chain_err(|| format!("Failed to copy resource file {:?}", src))?; + } + Ok(()) +} + +/// Generate the icon files and store them under the `data_dir`. +fn generate_icon_files(settings: &Settings, data_dir: &PathBuf) -> crate::Result<()> { + let base_dir = data_dir.join("usr/share/icons/hicolor"); + let get_dest_path = |width: u32, height: u32, is_high_density: bool| { + base_dir.join(format!( + "{}x{}{}/apps/{}.png", + width, + height, + if is_high_density { "@2x" } else { "" }, + settings.binary_name() + )) + }; + let mut sizes = BTreeSet::new(); + // Prefer PNG files. + for icon_path in settings.icon_files() { + let icon_path = icon_path?; + if icon_path.extension() != Some(OsStr::new("png")) { + continue; + } + let mut decoder = PNGDecoder::new(File::open(&icon_path)?); + let (width, height) = decoder.dimensions()?; + let is_high_density = common::is_retina(&icon_path); + if !sizes.contains(&(width, height, is_high_density)) { + sizes.insert((width, height, is_high_density)); + let dest_path = get_dest_path(width, height, is_high_density); + common::copy_file(&icon_path, &dest_path)?; + } + } + // Fall back to non-PNG files for any missing sizes. + for icon_path in settings.icon_files() { + let icon_path = icon_path?; + if icon_path.extension() == Some(OsStr::new("png")) { + continue; + } else if icon_path.extension() == Some(OsStr::new("icns")) { + let icon_family = icns::IconFamily::read(File::open(&icon_path)?)?; + for icon_type in icon_family.available_icons() { + let width = icon_type.screen_width(); + let height = icon_type.screen_height(); + let is_high_density = icon_type.pixel_density() > 1; + if !sizes.contains(&(width, height, is_high_density)) { + sizes.insert((width, height, is_high_density)); + let dest_path = get_dest_path(width, height, is_high_density); + let icon = icon_family.get_icon_with_type(icon_type)?; + icon.write_png(common::create_file(&dest_path)?)?; + } + } + } else { + let icon = r#try!(image::open(&icon_path)); + let (width, height) = icon.dimensions(); + let is_high_density = common::is_retina(&icon_path); + if !sizes.contains(&(width, height, is_high_density)) { + sizes.insert((width, height, is_high_density)); + let dest_path = get_dest_path(width, height, is_high_density); + let encoder = PNGEncoder::new(common::create_file(&dest_path)?); + encoder.encode(&icon.raw_pixels(), width, height, icon.color())?; + } + } + } + Ok(()) +} + +/// Create an empty file at the given path, creating any parent directories as +/// needed, then write `data` into the file. +fn create_file_with_data>(path: P, data: &str) -> crate::Result<()> { + let mut file = common::create_file(path.as_ref())?; + file.write_all(data.as_bytes())?; + file.flush()?; + Ok(()) +} + +/// Computes the total size, in bytes, of the given directory and all of its +/// contents. +fn total_dir_size(dir: &Path) -> crate::Result { + let mut total: u64 = 0; + for entry in WalkDir::new(&dir) { + total += entry?.metadata()?.len(); + } + Ok(total) +} + +/// Writes a tar file to the given writer containing the given directory. +fn create_tar_from_dir, W: Write>(src_dir: P, dest_file: W) -> crate::Result { + let src_dir = src_dir.as_ref(); + let mut tar_builder = tar::Builder::new(dest_file); + for entry in WalkDir::new(&src_dir) { + let entry = entry?; + let src_path = entry.path(); + if src_path == src_dir { + continue; + } + let dest_path = src_path.strip_prefix(&src_dir).unwrap(); + if entry.file_type().is_dir() { + tar_builder.append_dir(dest_path, src_path)?; + } else { + let mut src_file = fs::File::open(src_path)?; + tar_builder.append_file(dest_path, &mut src_file)?; + } + } + let dest_file = tar_builder.into_inner()?; + Ok(dest_file) +} + +/// Creates a `.tar.gz` file from the given directory (placing the new file +/// within the given directory's parent directory), then deletes the original +/// directory and returns the path to the new file. +fn tar_and_gzip_dir>(src_dir: P) -> crate::Result { + let src_dir = src_dir.as_ref(); + let dest_path = src_dir.with_extension("tar.gz"); + let dest_file = common::create_file(&dest_path)?; + let gzip_encoder = gzip::Encoder::new(dest_file)?; + let gzip_encoder = create_tar_from_dir(src_dir, gzip_encoder)?; + let mut dest_file = gzip_encoder.finish().into_result()?; + dest_file.flush()?; + Ok(dest_path) +} + +/// Creates an `ar` archive from the given source files and writes it to the +/// given destination path. +fn create_archive(srcs: Vec, dest: &Path) -> crate::Result<()> { + let mut builder = ar::Builder::new(common::create_file(&dest)?); + for path in &srcs { + builder.append_path(path)?; + } + builder.into_inner()?.flush()?; + Ok(()) +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/ios_bundle.rs b/tools/rust/cargo-proton-bundle/src/bundle/ios_bundle.rs new file mode 100644 index 000000000..3784a0a89 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/ios_bundle.rs @@ -0,0 +1,176 @@ +// An iOS package is laid out like: +// +// Foobar.app # Actually a directory +// Foobar # The main binary executable of the app +// Info.plist # An XML file containing the app's metadata +// ... # Icons and other resource files +// +// See https://developer.apple.com/go/?id=bundle-structure for a full +// explanation. + +use super::common; +use icns; +use image::png::{PNGDecoder, PNGEncoder}; +use image::{self, GenericImage, ImageDecoder}; +use std::collections::BTreeSet; +use std::ffi::OsStr; +use std::fs::{self, File}; +use std::io::Write; +use std::path::{Path, PathBuf}; +use crate::{ResultExt, Settings}; + +pub fn bundle_project(settings: &Settings) -> crate::Result> { + common::print_warning("iOS bundle support is still experimental.")?; + + let app_bundle_name = format!("{}.app", settings.bundle_name()); + common::print_bundling(&app_bundle_name)?; + let bundle_dir = settings + .project_out_directory() + .join("bundle/ios") + .join(&app_bundle_name); + if bundle_dir.exists() { + fs::remove_dir_all(&bundle_dir) + .chain_err(|| format!("Failed to remove old {}", app_bundle_name))?; + } + fs::create_dir_all(&bundle_dir) + .chain_err(|| format!("Failed to create bundle directory at {:?}", bundle_dir))?; + + for src in settings.resource_files() { + let src = src?; + let dest = bundle_dir.join(common::resource_relpath(&src)); + common::copy_file(&src, &dest) + .chain_err(|| format!("Failed to copy resource file {:?}", src))?; + } + + let icon_filenames = + generate_icon_files(&bundle_dir, settings).chain_err(|| "Failed to create app icons")?; + generate_info_plist(&bundle_dir, settings, &icon_filenames) + .chain_err(|| "Failed to create Info.plist")?; + let bin_path = bundle_dir.join(&settings.bundle_name()); + common::copy_file(settings.binary_path(), &bin_path) + .chain_err(|| format!("Failed to copy binary from {:?}", settings.binary_path()))?; + Ok(vec![bundle_dir]) +} + +/// Generate the icon files and store them under the `bundle_dir`. +fn generate_icon_files(bundle_dir: &Path, settings: &Settings) -> crate::Result> { + let mut filenames = Vec::new(); + { + let mut get_dest_path = |width: u32, height: u32, is_retina: bool| { + let filename = format!( + "icon_{}x{}{}.png", + width, + height, + if is_retina { "@2x" } else { "" } + ); + let path = bundle_dir.join(&filename); + filenames.push(filename); + path + }; + let mut sizes = BTreeSet::new(); + // Prefer PNG files. + for icon_path in settings.icon_files() { + let icon_path = icon_path?; + if icon_path.extension() != Some(OsStr::new("png")) { + continue; + } + let mut decoder = PNGDecoder::new(File::open(&icon_path)?); + let (width, height) = decoder.dimensions()?; + let is_retina = common::is_retina(&icon_path); + if !sizes.contains(&(width, height, is_retina)) { + sizes.insert((width, height, is_retina)); + let dest_path = get_dest_path(width, height, is_retina); + common::copy_file(&icon_path, &dest_path)?; + } + } + // Fall back to non-PNG files for any missing sizes. + for icon_path in settings.icon_files() { + let icon_path = icon_path?; + if icon_path.extension() == Some(OsStr::new("png")) { + continue; + } else if icon_path.extension() == Some(OsStr::new("icns")) { + let icon_family = icns::IconFamily::read(File::open(&icon_path)?)?; + for icon_type in icon_family.available_icons() { + let width = icon_type.screen_width(); + let height = icon_type.screen_height(); + let is_retina = icon_type.pixel_density() > 1; + if !sizes.contains(&(width, height, is_retina)) { + sizes.insert((width, height, is_retina)); + let dest_path = get_dest_path(width, height, is_retina); + let icon = icon_family.get_icon_with_type(icon_type)?; + icon.write_png(File::create(dest_path)?)?; + } + } + } else { + let icon = r#try!(image::open(&icon_path)); + let (width, height) = icon.dimensions(); + let is_retina = common::is_retina(&icon_path); + if !sizes.contains(&(width, height, is_retina)) { + sizes.insert((width, height, is_retina)); + let dest_path = get_dest_path(width, height, is_retina); + let encoder = PNGEncoder::new(common::create_file(&dest_path)?); + encoder.encode(&icon.raw_pixels(), width, height, icon.color())?; + } + } + } + } + Ok(filenames) +} + +fn generate_info_plist( + bundle_dir: &Path, + settings: &Settings, + icon_filenames: &Vec, +) -> crate::Result<()> { + let file = &mut common::create_file(&bundle_dir.join("Info.plist"))?; + write!( + file, + "\n\ + \n\ + \n\ + \n" + )?; + + write!( + file, + " CFBundleIdentifier\n {}\n", + settings.bundle_identifier() + )?; + write!( + file, + " CFBundleDisplayName\n {}\n", + settings.bundle_name() + )?; + write!( + file, + " CFBundleName\n {}\n", + settings.bundle_name() + )?; + write!( + file, + " CFBundleExecutable\n {}\n", + settings.binary_name() + )?; + write!( + file, + " CFBundleVersion\n {}\n", + settings.version_string() + )?; + write!( + file, + " CFBundleDevelopmentRegion\n en_US\n" + )?; + + if !icon_filenames.is_empty() { + write!(file, " CFBundleIconFiles\n \n")?; + for filename in icon_filenames { + write!(file, " {}\n", filename)?; + } + write!(file, " \n")?; + } + write!(file, " LSRequiresIPhoneOS\n \n")?; + write!(file, "\n\n")?; + file.flush()?; + Ok(()) +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/mod.rs b/tools/rust/cargo-proton-bundle/src/bundle/mod.rs new file mode 100644 index 000000000..f16102bee --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/mod.rs @@ -0,0 +1,26 @@ +mod category; +mod common; +mod deb_bundle; +mod ios_bundle; +mod msi_bundle; +mod osx_bundle; +mod rpm_bundle; +mod settings; + +pub use self::common::{print_error, print_finished}; +pub use self::settings::{BuildArtifact, PackageType, Settings}; +use std::path::PathBuf; + +pub fn bundle_project(settings: Settings) -> crate::Result> { + let mut paths = Vec::new(); + for package_type in settings.package_types()? { + paths.append(&mut match package_type { + PackageType::OsxBundle => osx_bundle::bundle_project(&settings)?, + PackageType::IosBundle => ios_bundle::bundle_project(&settings)?, + PackageType::WindowsMsi => msi_bundle::bundle_project(&settings)?, + PackageType::Deb => deb_bundle::bundle_project(&settings)?, + PackageType::Rpm => rpm_bundle::bundle_project(&settings)?, + }); + } + Ok(paths) +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/msi_bundle.rs b/tools/rust/cargo-proton-bundle/src/bundle/msi_bundle.rs new file mode 100644 index 000000000..ed5117276 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/msi_bundle.rs @@ -0,0 +1,614 @@ +use super::common; +use super::settings::Settings; +use cab; +use msi; +use std; +use std::collections::{BTreeMap, HashMap, HashSet}; +use std::ffi::OsStr; +use std::fs; +use std::io::{self, Write}; +use std::path::{Path, PathBuf}; +use uuid::Uuid; +use crate::ResultExt; + +type Package = msi::Package; + +// Don't add more files to a cabinet folder that already has this many bytes: +const CABINET_FOLDER_SIZE_LIMIT: u64 = 0x8000; +// The maximum number of resource files we'll put in one cabinet: +const CABINET_MAX_FILES: usize = 1000; +// The maximum number of data bytes we'll put in one cabinet: +const CABINET_MAX_SIZE: u64 = 0x1000_0000; + +// File table attribute indicating that a file is "vital": +const FILE_ATTR_VITAL: u16 = 0x200; + +// The name of the installer package's sole Feature: +const MAIN_FEATURE_NAME: &str = "MainFeature"; + +// A v4 UUID that was generated specifically for cargo-bundle, to be used as a +// namespace for generating v5 UUIDs from bundle identifier strings. +const UUID_NAMESPACE: [u8; 16] = [ + 0xfd, 0x85, 0x95, 0xa8, 0x17, 0xa3, 0x47, 0x4e, 0xa6, 0x16, 0x76, 0x14, 0x8d, 0xfa, 0x0c, 0x7b, +]; + +// Info about a resource file (including the main executable) in the bundle. +struct ResourceInfo { + // The path to the existing file that will be bundled as a resource. + source_path: PathBuf, + // Relative path from the install dir where this will be installed. + dest_path: PathBuf, + // The name of this resource file in the filesystem. + filename: String, + // The size of this resource file, in bytes. + size: u64, + // The database key for the Component that this resource is part of. + component_key: String, +} + +// Info about a directory that needs to be created during installation. +struct DirectoryInfo { + // The database key for this directory. + key: String, + // The database key for this directory's parent. + parent_key: String, + // The name of this directory in the filesystem. + name: String, + // List of files in this directory, not counting subdirectories. + files: Vec, +} + +// Info about a CAB archive within the installer package. +struct CabinetInfo { + // The stream name for this cabinet. + name: String, + // The resource files that are in this cabinet. + resources: Vec, +} + +pub fn bundle_project(settings: &Settings) -> crate::Result> { + common::print_warning("MSI bundle support is still experimental.")?; + + let msi_name = format!("{}.msi", settings.bundle_name()); + common::print_bundling(&msi_name)?; + let base_dir = settings.project_out_directory().join("bundle/msi"); + let msi_path = base_dir.join(&msi_name); + let mut package = + new_empty_package(&msi_path).chain_err(|| "Failed to initialize MSI package")?; + + // Generate package metadata: + let guid = generate_package_guid(settings); + set_summary_info(&mut package, guid, settings); + create_property_table(&mut package, guid, settings) + .chain_err(|| "Failed to generate Property table")?; + + // Copy resource files into package: + let mut resources = + collect_resource_info(settings).chain_err(|| "Failed to collect resource file information")?; + let directories = collect_directory_info(settings, &mut resources) + .chain_err(|| "Failed to collect resource directory information")?; + let cabinets = divide_resources_into_cabinets(resources); + generate_resource_cabinets(&mut package, &cabinets) + .chain_err(|| "Failed to generate resource cabinets")?; + + // Set up installer database tables: + create_directory_table(&mut package, &directories) + .chain_err(|| "Failed to generate Directory table")?; + create_feature_table(&mut package, settings).chain_err(|| "Failed to generate Feature table")?; + create_component_table(&mut package, guid, &directories) + .chain_err(|| "Failed to generate Component table")?; + create_feature_components_table(&mut package, &directories) + .chain_err(|| "Failed to generate FeatureComponents table")?; + create_media_table(&mut package, &cabinets).chain_err(|| "Failed to generate Media table")?; + create_file_table(&mut package, &cabinets).chain_err(|| "Failed to generate File table")?; + // TODO: Create other needed tables. + + // Create app icon: + package.create_table( + "Icon", + vec![ + msi::Column::build("Name").primary_key().id_string(72), + msi::Column::build("Data").binary(), + ], + )?; + let icon_name = format!("{}.ico", settings.binary_name()); + { + let stream_name = format!("Icon.{}", icon_name); + let mut stream = package.write_stream(&stream_name)?; + create_app_icon(&mut stream, settings)?; + } + package.insert_rows(msi::Insert::into("Icon").row(vec![ + msi::Value::Str(icon_name.clone()), + msi::Value::from("Name"), + ]))?; + + package.flush()?; + Ok(vec![msi_path]) +} + +fn new_empty_package(msi_path: &Path) -> crate::Result { + if let Some(parent) = msi_path.parent() { + fs::create_dir_all(&parent).chain_err(|| format!("Failed to create directory {:?}", parent))?; + } + let msi_file = fs::OpenOptions::new() + .read(true) + .write(true) + .create(true) + .truncate(true) + .open(msi_path) + .chain_err(|| format!("Failed to create file {:?}", msi_path))?; + let package = msi::Package::create(msi::PackageType::Installer, msi_file)?; + Ok(package) +} + +// Generates a GUID for the package, based on `settings.bundle_identifier()`. +fn generate_package_guid(settings: &Settings) -> Uuid { + let namespace = Uuid::from_bytes(&UUID_NAMESPACE).unwrap(); + Uuid::new_v5(&namespace, &settings.bundle_identifier()) +} + +// Populates the summary metadata for the package from the bundle settings. +fn set_summary_info(package: &mut Package, package_guid: Uuid, settings: &Settings) { + let summary_info = package.summary_info_mut(); + summary_info.set_creation_time_to_now(); + summary_info.set_subject(settings.bundle_name().to_string()); + summary_info.set_uuid(package_guid); + summary_info.set_comments(settings.short_description().to_string()); + if let Some(authors) = settings.authors_comma_separated() { + summary_info.set_author(authors); + } + let creating_app = format!("cargo-bundle v{}", crate_version!()); + summary_info.set_creating_application(creating_app); +} + +// Creates and populates the `Property` database table for the package. +fn create_property_table( + package: &mut Package, + package_guid: Uuid, + settings: &Settings, +) -> crate::Result<()> { + let authors = settings.authors_comma_separated().unwrap_or(String::new()); + package.create_table( + "Property", + vec![ + msi::Column::build("Property").primary_key().id_string(72), + msi::Column::build("Value").text_string(0), + ], + )?; + package.insert_rows( + msi::Insert::into("Property") + .row(vec![ + msi::Value::from("Manufacturer"), + msi::Value::Str(authors), + ]) + .row(vec![ + msi::Value::from("ProductCode"), + msi::Value::from(package_guid), + ]) + .row(vec![ + msi::Value::from("ProductLanguage"), + msi::Value::from(msi::Language::from_tag("en-US")), + ]) + .row(vec![ + msi::Value::from("ProductName"), + msi::Value::from(settings.bundle_name()), + ]) + .row(vec![ + msi::Value::from("ProductVersion"), + msi::Value::from(settings.version_string()), + ]), + )?; + Ok(()) +} + +// Returns a list of `ResourceInfo` structs for the binary executable and all +// the resource files that should be included in the package. +fn collect_resource_info(settings: &Settings) -> crate::Result> { + let mut resources = Vec::::new(); + resources.push(ResourceInfo { + source_path: settings.binary_path().to_path_buf(), + dest_path: PathBuf::from(settings.binary_name()), + filename: settings.binary_name().to_string(), + size: settings.binary_path().metadata()?.len(), + component_key: String::new(), + }); + let root_rsrc_dir = PathBuf::from("Resources"); + for source_path in settings.resource_files() { + let source_path = source_path?; + let metadata = source_path.metadata()?; + let size = metadata.len(); + let dest_path = root_rsrc_dir.join(common::resource_relpath(&source_path)); + let filename = dest_path.file_name().unwrap().to_string_lossy().to_string(); + let info = ResourceInfo { + source_path, + dest_path, + filename, + size, + component_key: String::new(), + }; + resources.push(info); + } + Ok(resources) +} + +// Based on the list of all resource files to be bundled, returns a list of +// all the directories that need to be created during installation. Also, +// modifies each `ResourceInfo` object to populate its `component_key` field +// with the database key of the Component that the resource will be associated +// with. +fn collect_directory_info( + settings: &Settings, + resources: &mut Vec, +) -> crate::Result> { + let mut dir_map = BTreeMap::::new(); + let mut dir_index: i32 = 0; + dir_map.insert( + PathBuf::new(), + DirectoryInfo { + key: "INSTALLDIR".to_string(), + parent_key: "ProgramFilesFolder".to_string(), + name: settings.bundle_name().to_string(), + files: Vec::new(), + }, + ); + for resource in resources.iter_mut() { + let mut dir_key = "INSTALLDIR".to_string(); + let mut dir_path = PathBuf::new(); + for component in resource.dest_path.parent().unwrap().components() { + if let std::path::Component::Normal(name) = component { + dir_path.push(name); + if dir_map.contains_key(&dir_path) { + dir_key = dir_map.get(&dir_path).unwrap().key.clone(); + } else { + let new_key = format!("RDIR{:04}", dir_index); + dir_map.insert( + dir_path.clone(), + DirectoryInfo { + key: new_key.clone(), + parent_key: dir_key.clone(), + name: name.to_string_lossy().to_string(), + files: Vec::new(), + }, + ); + dir_key = new_key; + dir_index += 1; + } + } + } + let directory = dir_map.get_mut(&dir_path).unwrap(); + debug_assert_eq!(directory.key, dir_key); + directory.files.push(resource.filename.clone()); + resource.component_key = dir_key.to_string(); + } + Ok(dir_map.into_iter().map(|(_k, v)| v).collect()) +} + +// Divides up the list of resource into some number of cabinets, subject to a +// few contraints: 1) no one cabinet will have two resources with the same +// filename, 2) no one cabinet will have more than `CABINET_MAX_FILES` files +// in it, and 3) no one cabinet will contain mroe than `CABINET_MAX_SIZE` +// bytes of data (unless that cabinet consists of a single file that is +// already bigger than that). +fn divide_resources_into_cabinets(mut resources: Vec) -> Vec { + let mut cabinets = Vec::new(); + while !resources.is_empty() { + let mut filenames = HashSet::::new(); + let mut total_size = 0; + let mut leftovers = Vec::::new(); + let mut cabinet = CabinetInfo { + name: format!("rsrc{:04}.cab", cabinets.len()), + resources: Vec::new(), + }; + for resource in resources.into_iter() { + if cabinet.resources.len() >= CABINET_MAX_FILES + || (!cabinet.resources.is_empty() && total_size + resource.size > CABINET_MAX_SIZE) + || filenames.contains(&resource.filename) + { + leftovers.push(resource); + } else { + filenames.insert(resource.filename.clone()); + total_size += resource.size; + cabinet.resources.push(resource); + } + } + cabinets.push(cabinet); + resources = leftovers; + } + cabinets +} + +// Creates the CAB archives within the package that contain the binary +// execuable and all the resource files. +fn generate_resource_cabinets(package: &mut Package, cabinets: &[CabinetInfo]) -> crate::Result<()> { + for cabinet_info in cabinets.iter() { + let mut builder = cab::CabinetBuilder::new(); + let mut file_map = HashMap::::new(); + let mut resource_index: usize = 0; + while resource_index < cabinet_info.resources.len() { + let folder = builder.add_folder(cab::CompressionType::MsZip); + let mut folder_size: u64 = 0; + while resource_index < cabinet_info.resources.len() && folder_size < CABINET_FOLDER_SIZE_LIMIT + { + let resource = &cabinet_info.resources[resource_index]; + folder_size += resource.size; + folder.add_file(resource.filename.as_str()); + debug_assert!(!file_map.contains_key(&resource.filename)); + file_map.insert(resource.filename.clone(), &resource.source_path); + resource_index += 1; + } + } + let stream = package.write_stream(cabinet_info.name.as_str())?; + let mut cabinet_writer = builder.build(stream)?; + while let Some(mut file_writer) = cabinet_writer.next_file()? { + debug_assert!(file_map.contains_key(file_writer.file_name())); + let file_path = file_map.get(file_writer.file_name()).unwrap(); + let mut file = fs::File::open(file_path)?; + io::copy(&mut file, &mut file_writer)?; + } + cabinet_writer.finish()?; + } + Ok(()) +} + +// Creates and populates the `Directory` database table for the package. +fn create_directory_table(package: &mut Package, directories: &[DirectoryInfo]) -> crate::Result<()> { + package.create_table( + "Directory", + vec![ + msi::Column::build("Directory").primary_key().id_string(72), + msi::Column::build("Directory_Parent") + .nullable() + .foreign_key("Directory", 1) + .id_string(72), + msi::Column::build("DefaultDir") + .category(msi::Category::DefaultDir) + .string(255), + ], + )?; + let mut rows = Vec::new(); + for directory in directories.iter() { + rows.push(vec![ + msi::Value::Str(directory.key.clone()), + msi::Value::Str(directory.parent_key.clone()), + msi::Value::Str(directory.name.clone()), + ]); + } + package.insert_rows( + msi::Insert::into("Directory") + .row(vec![ + msi::Value::from("TARGETDIR"), + msi::Value::Null, + msi::Value::from("SourceDir"), + ]) + .row(vec![ + msi::Value::from("ProgramFilesFolder"), + msi::Value::from("TARGETDIR"), + msi::Value::from("."), + ]) + .rows(rows), + )?; + Ok(()) +} + +// Creates and populates the `Feature` database table for the package. The +// package will have a single main feature that installs everything. +fn create_feature_table(package: &mut Package, settings: &Settings) -> crate::Result<()> { + package.create_table( + "Feature", + vec![ + msi::Column::build("Feature").primary_key().id_string(38), + msi::Column::build("Feature_Parent") + .nullable() + .foreign_key("Feature", 1) + .id_string(38), + msi::Column::build("Title").nullable().text_string(64), + msi::Column::build("Description") + .nullable() + .text_string(255), + msi::Column::build("Display") + .nullable() + .range(0, 0x7fff) + .int16(), + msi::Column::build("Level").range(0, 0x7fff).int16(), + msi::Column::build("Directory_") + .nullable() + .foreign_key("Directory", 1) + .id_string(72), + msi::Column::build("Attributes").int16(), + ], + )?; + package.insert_rows(msi::Insert::into("Feature").row(vec![ + msi::Value::from(MAIN_FEATURE_NAME), + msi::Value::Null, + msi::Value::from(settings.bundle_name()), + msi::Value::Null, + msi::Value::Int(1), + msi::Value::Int(3), + msi::Value::from("INSTALLDIR"), + msi::Value::Int(0), + ]))?; + Ok(()) +} + +// Creates and populates the `Component` database table for the package. One +// component is created for each subdirectory under in the install dir. +fn create_component_table( + package: &mut Package, + package_guid: Uuid, + directories: &[DirectoryInfo], +) -> crate::Result<()> { + package.create_table( + "Component", + vec![ + msi::Column::build("Component").primary_key().id_string(72), + msi::Column::build("ComponentId") + .nullable() + .category(msi::Category::Guid) + .string(38), + msi::Column::build("Directory_") + .nullable() + .foreign_key("Directory", 1) + .id_string(72), + msi::Column::build("Attributes").int16(), + msi::Column::build("Condition") + .nullable() + .category(msi::Category::Condition) + .string(255), + msi::Column::build("KeyPath").nullable().id_string(72), + ], + )?; + let mut rows = Vec::new(); + for directory in directories.iter() { + if !directory.files.is_empty() { + let hash_input = directory.files.join("/"); + rows.push(vec![ + msi::Value::Str(directory.key.clone()), + msi::Value::from(Uuid::new_v5(&package_guid, &hash_input)), + msi::Value::Str(directory.key.clone()), + msi::Value::Int(0), + msi::Value::Null, + msi::Value::Str(directory.files[0].clone()), + ]); + } + } + package.insert_rows(msi::Insert::into("Component").rows(rows))?; + Ok(()) +} + +// Creates and populates the `FeatureComponents` database table for the +// package. All components are added to the package's single main feature. +fn create_feature_components_table( + package: &mut Package, + directories: &[DirectoryInfo], +) -> crate::Result<()> { + package.create_table( + "FeatureComponents", + vec![ + msi::Column::build("Feature_") + .primary_key() + .foreign_key("Component", 1) + .id_string(38), + msi::Column::build("Component_") + .primary_key() + .foreign_key("Component", 1) + .id_string(72), + ], + )?; + let mut rows = Vec::new(); + for directory in directories.iter() { + if !directory.files.is_empty() { + rows.push(vec![ + msi::Value::from(MAIN_FEATURE_NAME), + msi::Value::Str(directory.key.clone()), + ]); + } + } + package.insert_rows(msi::Insert::into("FeatureComponents").rows(rows))?; + Ok(()) +} + +// Creates and populates the `Media` database table for the package, with one +// entry for each CAB archive within the package. +fn create_media_table(package: &mut Package, cabinets: &[CabinetInfo]) -> crate::Result<()> { + package.create_table( + "Media", + vec![ + msi::Column::build("DiskId") + .primary_key() + .range(1, 0x7fff) + .int16(), + msi::Column::build("LastSequence").range(0, 0x7fff).int16(), + msi::Column::build("DiskPrompt").nullable().text_string(64), + msi::Column::build("Cabinet") + .nullable() + .category(msi::Category::Cabinet) + .string(255), + msi::Column::build("VolumeLabel").nullable().text_string(32), + msi::Column::build("Source") + .nullable() + .category(msi::Category::Property) + .string(32), + ], + )?; + let mut disk_id: i32 = 0; + let mut last_seq: i32 = 0; + let mut rows = Vec::new(); + for cabinet in cabinets.iter() { + disk_id += 1; + last_seq += cabinet.resources.len() as i32; + rows.push(vec![ + msi::Value::Int(disk_id), + msi::Value::Int(last_seq), + msi::Value::Null, + msi::Value::Str(format!("#{}", cabinet.name)), + msi::Value::Null, + msi::Value::Null, + ]); + } + package.insert_rows(msi::Insert::into("Media").rows(rows))?; + Ok(()) +} + +// Creates and populates the `File` database table for the package, with one +// entry for each resource file to be installed (including the main +// executable). +fn create_file_table(package: &mut Package, cabinets: &[CabinetInfo]) -> crate::Result<()> { + package.create_table( + "File", + vec![ + msi::Column::build("File").primary_key().id_string(72), + msi::Column::build("Component_") + .foreign_key("Component", 1) + .id_string(72), + msi::Column::build("FileName") + .category(msi::Category::Filename) + .string(255), + msi::Column::build("FileSize").range(0, 0x7fffffff).int32(), + msi::Column::build("Version") + .nullable() + .category(msi::Category::Version) + .string(72), + msi::Column::build("Language") + .nullable() + .category(msi::Category::Language) + .string(20), + msi::Column::build("Attributes") + .nullable() + .range(0, 0x7fff) + .int16(), + msi::Column::build("Sequence").range(1, 0x7fff).int16(), + ], + )?; + let mut rows = Vec::new(); + let mut sequence: i32 = 1; + for cabinet in cabinets.iter() { + for resource in cabinet.resources.iter() { + rows.push(vec![ + msi::Value::Str(format!("r{:04}", sequence)), + msi::Value::Str(resource.component_key.clone()), + msi::Value::Str(resource.filename.clone()), + msi::Value::Int(resource.size as i32), + msi::Value::Null, + msi::Value::Null, + msi::Value::from(FILE_ATTR_VITAL), + msi::Value::Int(sequence), + ]); + sequence += 1; + } + } + package.insert_rows(msi::Insert::into("File").rows(rows))?; + Ok(()) +} + +fn create_app_icon(writer: &mut W, settings: &Settings) -> crate::Result<()> { + // Prefer ICO files. + for icon_path in settings.icon_files() { + let icon_path = icon_path?; + if icon_path.extension() == Some(OsStr::new("ico")) { + io::copy(&mut fs::File::open(icon_path)?, writer)?; + return Ok(()); + } + } + // TODO: Convert from other formats. + Ok(()) +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/osx_bundle.rs b/tools/rust/cargo-proton-bundle/src/bundle/osx_bundle.rs new file mode 100644 index 000000000..ec8bda721 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/osx_bundle.rs @@ -0,0 +1,323 @@ +// An OSX package is laid out like: +// +// foobar.app # Actually a directory +// Contents # A further subdirectory +// Info.plist # An xml file containing the app's metadata +// MacOS # A directory to hold executable binary files +// foobar # The main binary executable of the app +// foobar_helper # A helper application, possibly provitidng a CLI +// Resources # Data files such as images, sounds, translations and nib files +// en.lproj # Folder containing english translation strings/data +// Frameworks # A directory containing private frameworks (shared libraries) +// ... # Any other optional files the developer wants to place here +// +// See https://developer.apple.com/go/?id=bundle-structure for a full +// explanation. +// +// Currently, cargo-bundle does not support Frameworks, nor does it support placing arbitrary +// files into the `Contents` directory of the bundle. + +use super::common; +use chrono; +use dirs; +use icns; +use image::{self, GenericImage}; +use std::cmp::min; +use std::ffi::OsStr; +use std::fs::{self, File}; +use std::io::prelude::*; +use std::io::{self, BufWriter}; +use std::path::{Path, PathBuf}; +use crate::{ResultExt, Settings}; + +pub fn bundle_project(settings: &Settings) -> crate::Result> { + let app_bundle_name = format!("{}.app", settings.bundle_name()); + common::print_bundling(&app_bundle_name)?; + let app_bundle_path = settings + .project_out_directory() + .join("bundle/osx") + .join(&app_bundle_name); + if app_bundle_path.exists() { + fs::remove_dir_all(&app_bundle_path) + .chain_err(|| format!("Failed to remove old {}", app_bundle_name))?; + } + let bundle_directory = app_bundle_path.join("Contents"); + fs::create_dir_all(&bundle_directory).chain_err(|| { + format!( + "Failed to create bundle directory at {:?}", + bundle_directory + ) + })?; + + let resources_dir = bundle_directory.join("Resources"); + + let bundle_icon_file: Option = + { create_icns_file(&resources_dir, settings).chain_err(|| "Failed to create app icon")? }; + + create_info_plist(&bundle_directory, bundle_icon_file, settings) + .chain_err(|| "Failed to create Info.plist")?; + + copy_frameworks_to_bundle(&bundle_directory, settings) + .chain_err(|| "Failed to bundle frameworks")?; + + for src in settings.resource_files() { + let src = src?; + let dest = resources_dir.join(common::resource_relpath(&src)); + common::copy_file(&src, &dest) + .chain_err(|| format!("Failed to copy resource file {:?}", src))?; + } + + copy_binary_to_bundle(&bundle_directory, settings) + .chain_err(|| format!("Failed to copy binary from {:?}", settings.binary_path()))?; + + Ok(vec![app_bundle_path]) +} + +fn copy_binary_to_bundle(bundle_directory: &Path, settings: &Settings) -> crate::Result<()> { + let dest_dir = bundle_directory.join("MacOS"); + common::copy_file( + settings.binary_path(), + &dest_dir.join(settings.binary_name()), + ) +} + +fn create_info_plist( + bundle_dir: &Path, + bundle_icon_file: Option, + settings: &Settings, +) -> crate::Result<()> { + let build_number = chrono::Utc::now().format("%Y%m%d.%H%M%S"); + let file = &mut common::create_file(&bundle_dir.join("Info.plist"))?; + write!( + file, + "\n\ + \n\ + \n\ + \n" + )?; + write!( + file, + " CFBundleDevelopmentRegion\n \ + English\n" + )?; + write!( + file, + " CFBundleDisplayName\n {}\n", + settings.bundle_name() + )?; + write!( + file, + " CFBundleExecutable\n {}\n", + settings.binary_name() + )?; + if let Some(path) = bundle_icon_file { + write!( + file, + " CFBundleIconFile\n {}\n", + path.file_name().unwrap().to_string_lossy() + )?; + } + write!( + file, + " CFBundleIdentifier\n {}\n", + settings.bundle_identifier() + )?; + write!( + file, + " CFBundleInfoDictionaryVersion\n \ + 6.0\n" + )?; + write!( + file, + " CFBundleName\n {}\n", + settings.bundle_name() + )?; + write!( + file, + " CFBundlePackageType\n APPL\n" + )?; + write!( + file, + " CFBundleShortVersionString\n {}\n", + settings.version_string() + )?; + write!( + file, + " CFBundleVersion\n {}\n", + build_number + )?; + write!(file, " CSResourcesFileMapped\n \n")?; + if let Some(category) = settings.app_category() { + write!( + file, + " LSApplicationCategoryType\n \ + {}\n", + category.osx_application_category_type() + )?; + } + if let Some(version) = settings.osx_minimum_system_version() { + write!( + file, + " LSMinimumSystemVersion\n \ + {}\n", + version + )?; + } + write!(file, " LSRequiresCarbon\n \n")?; + write!(file, " NSHighResolutionCapable\n \n")?; + if let Some(copyright) = settings.copyright_string() { + write!( + file, + " NSHumanReadableCopyright\n \ + {}\n", + copyright + )?; + } + write!(file, "\n\n")?; + file.flush()?; + Ok(()) +} + +fn copy_framework_from(dest_dir: &Path, framework: &str, src_dir: &Path) -> crate::Result { + let src_name = format!("{}.framework", framework); + let src_path = src_dir.join(&src_name); + if src_path.exists() { + common::copy_dir(&src_path, &dest_dir.join(&src_name))?; + Ok(true) + } else { + Ok(false) + } +} + +fn copy_frameworks_to_bundle(bundle_directory: &Path, settings: &Settings) -> crate::Result<()> { + let frameworks = settings.osx_frameworks(); + if frameworks.is_empty() { + return Ok(()); + } + let dest_dir = bundle_directory.join("Frameworks"); + fs::create_dir_all(&bundle_directory) + .chain_err(|| format!("Failed to create Frameworks directory at {:?}", dest_dir))?; + for framework in frameworks.iter() { + if framework.ends_with(".framework") { + let src_path = PathBuf::from(framework); + let src_name = src_path.file_name().unwrap(); + common::copy_dir(&src_path, &dest_dir.join(&src_name))?; + continue; + } else if framework.contains("/") { + bail!( + "Framework path should have .framework extension: {}", + framework + ); + } + if let Some(home_dir) = dirs::home_dir() { + if copy_framework_from(&dest_dir, framework, &home_dir.join("Library/Frameworks/"))? { + continue; + } + } + if copy_framework_from(&dest_dir, framework, &PathBuf::from("/Library/Frameworks/"))? + || copy_framework_from( + &dest_dir, + framework, + &PathBuf::from("/Network/Library/Frameworks/"), + )? + { + continue; + } + bail!("Could not locate {}.framework", framework); + } + Ok(()) +} + +/// Given a list of icon files, try to produce an ICNS file in the resources +/// directory and return the path to it. Returns `Ok(None)` if no usable icons +/// were provided. +fn create_icns_file(resources_dir: &PathBuf, settings: &Settings) -> crate::Result> { + if settings.icon_files().count() == 0 { + return Ok(None); + } + + // If one of the icon files is already an ICNS file, just use that. + for icon_path in settings.icon_files() { + let icon_path = icon_path?; + if icon_path.extension() == Some(OsStr::new("icns")) { + let mut dest_path = resources_dir.to_path_buf(); + dest_path.push(icon_path.file_name().unwrap()); + common::copy_file(&icon_path, &dest_path)?; + return Ok(Some(dest_path)); + } + } + + // Otherwise, read available images and pack them into a new ICNS file. + let mut family = icns::IconFamily::new(); + + fn add_icon_to_family( + icon: image::DynamicImage, + density: u32, + family: &mut icns::IconFamily, + ) -> io::Result<()> { + // Try to add this image to the icon family. Ignore images whose sizes + // don't map to any ICNS icon type; print warnings and skip images that + // fail to encode. + match icns::IconType::from_pixel_size_and_density(icon.width(), icon.height(), density) { + Some(icon_type) => { + if !family.has_icon_with_type(icon_type) { + let icon = r#try!(make_icns_image(icon)); + r#try!(family.add_icon_with_type(&icon, icon_type)); + } + Ok(()) + } + None => Err(io::Error::new( + io::ErrorKind::InvalidData, + "No matching IconType", + )), + } + } + + let mut images_to_resize: Vec<(image::DynamicImage, u32, u32)> = vec![]; + for icon_path in settings.icon_files() { + let icon_path = icon_path?; + let icon = r#try!(image::open(&icon_path)); + let density = if common::is_retina(&icon_path) { 2 } else { 1 }; + let (w, h) = icon.dimensions(); + let orig_size = min(w, h); + let next_size_down = 2f32.powf((orig_size as f32).log2().floor()) as u32; + if orig_size > next_size_down { + images_to_resize.push((icon, next_size_down, density)); + } else { + r#try!(add_icon_to_family(icon, density, &mut family)); + } + } + + for (icon, next_size_down, density) in images_to_resize { + let icon = icon.resize_exact(next_size_down, next_size_down, image::Lanczos3); + r#try!(add_icon_to_family(icon, density, &mut family)); + } + + if !family.is_empty() { + r#try!(fs::create_dir_all(resources_dir)); + let mut dest_path = resources_dir.clone(); + dest_path.push(settings.bundle_name()); + dest_path.set_extension("icns"); + let icns_file = BufWriter::new(r#try!(File::create(&dest_path))); + r#try!(family.write(icns_file)); + return Ok(Some(dest_path)); + } + + bail!("No usable icon files found."); +} + +/// Converts an image::DynamicImage into an icns::Image. +fn make_icns_image(img: image::DynamicImage) -> io::Result { + let pixel_format = match img.color() { + image::ColorType::RGBA(8) => icns::PixelFormat::RGBA, + image::ColorType::RGB(8) => icns::PixelFormat::RGB, + image::ColorType::GrayA(8) => icns::PixelFormat::GrayAlpha, + image::ColorType::Gray(8) => icns::PixelFormat::Gray, + _ => { + let msg = format!("unsupported ColorType: {:?}", img.color()); + return Err(io::Error::new(io::ErrorKind::InvalidData, msg)); + } + }; + icns::Image::from_data(pixel_format, img.width(), img.height(), img.raw_pixels()) +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/rpm_bundle.rs b/tools/rust/cargo-proton-bundle/src/bundle/rpm_bundle.rs new file mode 100644 index 000000000..3e808b44a --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/rpm_bundle.rs @@ -0,0 +1,6 @@ +use std::path::PathBuf; +use crate::Settings; + +pub fn bundle_project(_settings: &Settings) -> crate::Result> { + unimplemented!(); +} diff --git a/tools/rust/cargo-proton-bundle/src/bundle/settings.rs b/tools/rust/cargo-proton-bundle/src/bundle/settings.rs new file mode 100644 index 000000000..44244d49f --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/bundle/settings.rs @@ -0,0 +1,637 @@ +use super::category::AppCategory; +use clap::ArgMatches; +use glob; +use std; +use std::collections::HashMap; +use std::fs::File; +use std::io::Read; +use std::path::{Path, PathBuf}; +use target_build_utils::TargetInfo; +use toml; +use walkdir; + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum PackageType { + OsxBundle, + IosBundle, + WindowsMsi, + Deb, + Rpm, +} + +impl PackageType { + pub fn from_short_name(name: &str) -> Option { + // Other types we may eventually want to support: apk + match name { + "deb" => Some(PackageType::Deb), + "ios" => Some(PackageType::IosBundle), + "msi" => Some(PackageType::WindowsMsi), + "osx" => Some(PackageType::OsxBundle), + "rpm" => Some(PackageType::Rpm), + _ => None, + } + } + + pub fn short_name(&self) -> &'static str { + match *self { + PackageType::Deb => "deb", + PackageType::IosBundle => "ios", + PackageType::WindowsMsi => "msi", + PackageType::OsxBundle => "osx", + PackageType::Rpm => "rpm", + } + } + + pub fn all() -> &'static [PackageType] { + ALL_PACKAGE_TYPES + } +} + +const ALL_PACKAGE_TYPES: &[PackageType] = &[ + PackageType::Deb, + PackageType::IosBundle, + PackageType::WindowsMsi, + PackageType::OsxBundle, + PackageType::Rpm, +]; + +#[derive(Clone, Debug)] +pub enum BuildArtifact { + Main, + Bin(String), + Example(String), +} + +#[derive(Clone, Debug, Deserialize)] +struct BundleSettings { + // General settings: + name: Option, + identifier: Option, + icon: Option>, + version: Option, + resources: Option>, + copyright: Option, + category: Option, + short_description: Option, + long_description: Option, + script: Option, + // OS-specific settings: + deb_depends: Option>, + osx_frameworks: Option>, + osx_minimum_system_version: Option, + // Bundles for other binaries/examples: + bin: Option>, + example: Option>, +} + +#[derive(Clone, Debug, Deserialize)] +struct MetadataSettings { + bundle: Option, +} + +#[derive(Clone, Debug, Deserialize)] +struct PackageSettings { + name: String, + version: String, + description: String, + homepage: Option, + authors: Option>, + metadata: Option, +} + +#[derive(Clone, Debug, Deserialize)] +struct WorkspaceSettings { + members: Option>, +} + +#[derive(Clone, Debug, Deserialize)] +struct CargoSettings { + package: Option, // "Ancestor" workspace Cargo.toml files may not have package info + workspace: Option, // "Ancestor" workspace Cargo.toml files may declare workspaces +} + +#[derive(Clone, Debug)] +pub struct Settings { + package: PackageSettings, + package_type: Option, // If `None`, use the default package type for this os + target: Option<(String, TargetInfo)>, + features: Option>, + project_out_directory: PathBuf, + build_artifact: BuildArtifact, + is_release: bool, + binary_path: PathBuf, + binary_name: String, + bundle_settings: BundleSettings, +} + +impl CargoSettings { + /* + Try to load a set of CargoSettings from a "Cargo.toml" file in the specified directory + */ + fn load(dir: &PathBuf) -> crate::Result { + let toml_path = dir.join("Cargo.toml"); + let mut toml_str = String::new(); + let mut toml_file = File::open(toml_path)?; + toml_file.read_to_string(&mut toml_str)?; + toml::from_str(&toml_str).map_err(|e| e.into()) + } +} + +impl Settings { + pub fn new(current_dir: PathBuf, matches: & ArgMatches) -> crate::Result { + let package_type = match matches.value_of("format") { + Some(name) => match PackageType::from_short_name(name) { + Some(package_type) => Some(package_type), + None => bail!("Unsupported bundle format: {}", name), + }, + None => None, + }; + let build_artifact = if let Some(bin) = matches.value_of("bin") { + BuildArtifact::Bin(bin.to_string()) + } else if let Some(example) = matches.value_of("example") { + BuildArtifact::Example(example.to_string()) + } else { + BuildArtifact::Main + }; + let is_release = matches.is_present("release"); + let target = match matches.value_of("target") { + Some(triple) => Some((triple.to_string(), TargetInfo::from_str(triple)?)), + None => None, + }; + let features = if matches.is_present("features") { + Some(matches.values_of("features").unwrap().map(|s| s.to_string()).collect()) + } else { + None + }; + let cargo_settings = CargoSettings::load(¤t_dir)?; + let package = match cargo_settings.package { + Some(package_info) => package_info, + None => bail!("No 'package' info found in 'Cargo.toml'"), + }; + let workspace_dir = Settings::get_workspace_dir(¤t_dir); + let target_dir = Settings::get_target_dir(&workspace_dir, &target, is_release, &build_artifact); + let bundle_settings = if let Some(bundle_settings) = package + .metadata + .as_ref() + .and_then(|metadata| metadata.bundle.as_ref()) + { + bundle_settings.clone() + } else { + bail!("No [package.metadata.bundle] section in Cargo.toml"); + }; + let (bundle_settings, binary_name) = match build_artifact { + BuildArtifact::Main => (bundle_settings, package.name.clone()), + BuildArtifact::Bin(ref name) => ( + bundle_settings_from_table(&bundle_settings.bin, "bin", name)?, + name.clone(), + ), + BuildArtifact::Example(ref name) => ( + bundle_settings_from_table(&bundle_settings.example, "example", name)?, + name.clone(), + ), + }; + let binary_path = target_dir.join(&binary_name); + Ok(Settings { + package, + package_type, + target, + features, + build_artifact, + is_release, + project_out_directory: target_dir, + binary_path, + binary_name, + bundle_settings, + }) + } + + /* + The target_dir where binaries will be compiled to by cargo can vary: + - this directory is a member of a workspace project + - overridden by CARGO_TARGET_DIR environment variable + - specified in build.target-dir configuration key + - if the build is a 'release' or 'debug' build + + This function determines where 'target' dir is and suffixes it with 'release' or 'debug' + to determine where the compiled binary will be located. + */ + fn get_target_dir( + project_root_dir: &PathBuf, + target: &Option<(String, TargetInfo)>, + is_release: bool, + build_artifact: &BuildArtifact, + ) -> PathBuf { + let mut path = project_root_dir.join("target"); + if let &Some((ref triple, _)) = target { + path.push(triple); + } + path.push(if is_release { "release" } else { "debug" }); + if let &BuildArtifact::Example(_) = build_artifact { + path.push("examples"); + } + path + } + + /* + The specification of the Cargo.toml Manifest that covers the "workspace" section is here: + https://doc.rust-lang.org/cargo/reference/manifest.html#the-workspace-section + + Determining if the current project folder is part of a workspace: + - Walk up the file system, looking for a Cargo.toml file. + - Stop at the first one found. + - If one is found before reaching "/" then this folder belongs to that parent workspace + */ + fn get_workspace_dir(current_dir: &PathBuf) -> PathBuf { + let mut dir = current_dir.clone(); + while dir.pop() { + let set = CargoSettings::load(&dir); + if set.is_ok() { + return dir; + } + } + + // Nothing found walking up the file system, return the starting directory + current_dir.clone() + } + + /// Returns the directory where the bundle should be placed. + pub fn project_out_directory(&self) -> &Path { + &self.project_out_directory + } + + /// Returns the architecture for the binary being bundled (e.g. "arm" or + /// "x86" or "x86_64"). + pub fn binary_arch(&self) -> &str { + if let Some((_, ref info)) = self.target { + info.target_arch() + } else { + std::env::consts::ARCH + } + } + + /// Returns the file name of the binary being bundled. + pub fn binary_name(&self) -> &str { + &self.binary_name + } + + /// Returns the path to the binary being bundled. + pub fn binary_path(&self) -> &Path { + &self.binary_path + } + + /// If a specific package type was specified by the command-line, returns + /// that package type; otherwise, if a target triple was specified by the + /// command-line, returns the native package type(s) for that target; + /// otherwise, returns the native package type(s) for the host platform. + /// Fails if the host/target's native package type is not supported. + pub fn package_types(&self) -> crate::Result> { + if let Some(package_type) = self.package_type { + Ok(vec![package_type]) + } else { + let target_os = if let Some((_, ref info)) = self.target { + info.target_os() + } else { + std::env::consts::OS + }; + match target_os { + "macos" => Ok(vec![PackageType::OsxBundle]), + "ios" => Ok(vec![PackageType::IosBundle]), + "linux" => Ok(vec![PackageType::Deb]), // TODO: Do Rpm too, once it's implemented. + "windows" => Ok(vec![PackageType::WindowsMsi]), + os => bail!("Native {} bundles not yet supported.", os), + } + } + } + + /// If the bundle is being cross-compiled, returns the target triple string + /// (e.g. `"x86_64-apple-darwin"`). If the bundle is targeting the host + /// environment, returns `None`. + pub fn target_triple(&self) -> Option<&str> { + match self.target { + Some((ref triple, _)) => Some(triple.as_str()), + None => None, + } + } + + /// Returns the features that is being built. + pub fn build_features(&self) -> Option> { + self.features.to_owned() + } + + /// Returns the artifact that is being bundled. + pub fn build_artifact(&self) -> &BuildArtifact { + &self.build_artifact + } + + /// Returns true if the bundle is being compiled in release mode, false if + /// it's being compiled in debug mode. + pub fn is_release_build(&self) -> bool { + self.is_release + } + + pub fn bundle_name(&self) -> &str { + self + .bundle_settings + .name + .as_ref() + .unwrap_or(&self.package.name) + } + + pub fn bundle_identifier(&self) -> &str { + self + .bundle_settings + .identifier + .as_ref() + .map(String::as_str) + .unwrap_or("") + } + + /// Returns an iterator over the icon files to be used for this bundle. + pub fn icon_files(&self) -> ResourcePaths { + match self.bundle_settings.icon { + Some(ref paths) => ResourcePaths::new(paths.as_slice(), false), + None => ResourcePaths::new(&[], false), + } + } + + /// Returns an iterator over the resource files to be included in this + /// bundle. + pub fn resource_files(&self) -> ResourcePaths { + match self.bundle_settings.resources { + Some(ref paths) => ResourcePaths::new(paths.as_slice(), true), + None => ResourcePaths::new(&[], true), + } + } + + pub fn version_string(&self) -> &str { + self + .bundle_settings + .version + .as_ref() + .unwrap_or(&self.package.version) + } + + pub fn copyright_string(&self) -> Option<&str> { + self.bundle_settings.copyright.as_ref().map(String::as_str) + } + + pub fn author_names(&self) -> &[String] { + match self.package.authors { + Some(ref names) => names.as_slice(), + None => &[], + } + } + + pub fn authors_comma_separated(&self) -> Option { + let names = self.author_names(); + if names.is_empty() { + None + } else { + Some(names.join(", ")) + } + } + + pub fn homepage_url(&self) -> &str { + &self + .package + .homepage + .as_ref() + .map(String::as_str) + .unwrap_or("") + } + + pub fn app_category(&self) -> Option { + self.bundle_settings.category + } + + pub fn short_description(&self) -> &str { + self + .bundle_settings + .short_description + .as_ref() + .unwrap_or(&self.package.description) + } + + pub fn long_description(&self) -> Option<&str> { + self + .bundle_settings + .long_description + .as_ref() + .map(String::as_str) + } + + pub fn debian_dependencies(&self) -> &[String] { + match self.bundle_settings.deb_depends { + Some(ref dependencies) => dependencies.as_slice(), + None => &[], + } + } + + pub fn osx_frameworks(&self) -> &[String] { + match self.bundle_settings.osx_frameworks { + Some(ref frameworks) => frameworks.as_slice(), + None => &[], + } + } + + pub fn osx_minimum_system_version(&self) -> Option<&str> { + self + .bundle_settings + .osx_minimum_system_version + .as_ref() + .map(String::as_str) + } +} + +fn bundle_settings_from_table( + opt_map: &Option>, + map_name: &str, + bundle_name: &str, +) -> crate::Result { + if let Some(bundle_settings) = opt_map.as_ref().and_then(|map| map.get(bundle_name)) { + Ok(bundle_settings.clone()) + } else { + bail!( + "No [package.metadata.bundle.{}.{}] section in Cargo.toml", + map_name, + bundle_name + ); + } +} + +pub struct ResourcePaths<'a> { + pattern_iter: std::slice::Iter<'a, String>, + glob_iter: Option, + walk_iter: Option, + allow_walk: bool, +} + +impl<'a> ResourcePaths<'a> { + fn new(patterns: &'a [String], allow_walk: bool) -> ResourcePaths<'a> { + ResourcePaths { + pattern_iter: patterns.iter(), + glob_iter: None, + walk_iter: None, + allow_walk, + } + } +} + +impl<'a> Iterator for ResourcePaths<'a> { + type Item = crate::Result; + + fn next(&mut self) -> Option> { + loop { + if let Some(ref mut walk_entries) = self.walk_iter { + if let Some(entry) = walk_entries.next() { + let entry = match entry { + Ok(entry) => entry, + Err(error) => return Some(Err(crate::Error::from(error))), + }; + let path = entry.path(); + if path.is_dir() { + continue; + } + return Some(Ok(path.to_path_buf())); + } + } + self.walk_iter = None; + if let Some(ref mut glob_paths) = self.glob_iter { + if let Some(glob_result) = glob_paths.next() { + let path = match glob_result { + Ok(path) => path, + Err(error) => return Some(Err(crate::Error::from(error))), + }; + if path.is_dir() { + if self.allow_walk { + let walk = walkdir::WalkDir::new(path); + self.walk_iter = Some(walk.into_iter()); + continue; + } else { + let msg = format!("{:?} is a directory", path); + return Some(Err(crate::Error::from(msg))); + } + } + return Some(Ok(path)); + } + } + self.glob_iter = None; + if let Some(pattern) = self.pattern_iter.next() { + let glob = match glob::glob(pattern) { + Ok(glob) => glob, + Err(error) => return Some(Err(crate::Error::from(error))), + }; + self.glob_iter = Some(glob); + continue; + } + return None; + } + } +} + +#[cfg(test)] +mod tests { + use super::{AppCategory, BundleSettings, CargoSettings}; + use toml; + + #[test] + fn parse_cargo_toml() { + let toml_str = "\ + [package]\n\ + name = \"example\"\n\ + version = \"0.1.0\"\n\ + authors = [\"Jane Doe\"]\n\ + license = \"MIT\"\n\ + description = \"An example application.\"\n\ + build = \"build.rs\"\n\ + \n\ + [package.metadata.bundle]\n\ + name = \"Example Application\"\n\ + identifier = \"com.example.app\"\n\ + resources = [\"data\", \"foo/bar\"]\n\ + category = \"Puzzle Game\"\n\ + long_description = \"\"\"\n\ + This is an example of a\n\ + simple application.\n\ + \"\"\"\n\ + \n\ + [dependencies]\n\ + rand = \"0.4\"\n"; + let cargo_settings: CargoSettings = toml::from_str(toml_str).unwrap(); + let package = cargo_settings.package.unwrap(); + assert_eq!(package.name, "example"); + assert_eq!(package.version, "0.1.0"); + assert_eq!(package.description, "An example application."); + assert_eq!(package.homepage, None); + assert_eq!(package.authors, Some(vec!["Jane Doe".to_string()])); + assert!(package.metadata.is_some()); + let metadata = package.metadata.as_ref().unwrap(); + assert!(metadata.bundle.is_some()); + let bundle = metadata.bundle.as_ref().unwrap(); + assert_eq!(bundle.name, Some("Example Application".to_string())); + assert_eq!(bundle.identifier, Some("com.example.app".to_string())); + assert_eq!(bundle.icon, None); + assert_eq!(bundle.version, None); + assert_eq!( + bundle.resources, + Some(vec!["data".to_string(), "foo/bar".to_string()]) + ); + assert_eq!(bundle.category, Some(AppCategory::PuzzleGame)); + assert_eq!( + bundle.long_description, + Some( + "This is an example of a\n\ + simple application.\n" + .to_string() + ) + ); + } + + #[test] + fn parse_bin_and_example_bundles() { + let toml_str = "\ + [package]\n\ + name = \"example\"\n\ + version = \"0.1.0\"\n\ + description = \"An example application.\"\n\ + \n\ + [package.metadata.bundle.bin.foo]\n\ + name = \"Foo App\"\n\ + \n\ + [package.metadata.bundle.bin.bar]\n\ + name = \"Bar App\"\n\ + \n\ + [package.metadata.bundle.example.baz]\n\ + name = \"Baz Example\"\n\ + \n\ + [[bin]]\n\ + name = \"foo\"\n + \n\ + [[bin]]\n\ + name = \"bar\"\n + \n\ + [[example]]\n\ + name = \"baz\"\n"; + let cargo_settings: CargoSettings = toml::from_str(toml_str).unwrap(); + assert!(cargo_settings.package.is_some()); + let package = cargo_settings.package.as_ref().unwrap(); + assert!(package.metadata.is_some()); + let metadata = package.metadata.as_ref().unwrap(); + assert!(metadata.bundle.is_some()); + let bundle = metadata.bundle.as_ref().unwrap(); + assert!(bundle.example.is_some()); + + let bins = bundle.bin.as_ref().unwrap(); + assert!(bins.contains_key("foo")); + let foo: &BundleSettings = bins.get("foo").unwrap(); + assert_eq!(foo.name, Some("Foo App".to_string())); + assert!(bins.contains_key("bar")); + let bar: &BundleSettings = bins.get("bar").unwrap(); + assert_eq!(bar.name, Some("Bar App".to_string())); + + let examples = bundle.example.as_ref().unwrap(); + assert!(examples.contains_key("baz")); + let baz: &BundleSettings = examples.get("baz").unwrap(); + assert_eq!(baz.name, Some("Baz Example".to_string())); + } +} diff --git a/tools/rust/cargo-proton-bundle/src/main.rs b/tools/rust/cargo-proton-bundle/src/main.rs new file mode 100644 index 000000000..94338a444 --- /dev/null +++ b/tools/rust/cargo-proton-bundle/src/main.rs @@ -0,0 +1,161 @@ +extern crate ar; +extern crate cab; +extern crate chrono; +#[macro_use] +extern crate clap; +extern crate dirs; +#[macro_use] +extern crate error_chain; +extern crate glob; +extern crate icns; +extern crate image; +extern crate libflate; +extern crate md5; +extern crate msi; +extern crate serde; +#[macro_use] +extern crate serde_derive; +extern crate strsim; +extern crate tar; +extern crate target_build_utils; +extern crate term; +extern crate toml; +extern crate uuid; +extern crate walkdir; + +#[cfg(test)] +extern crate tempfile; + +mod bundle; + +use crate::bundle::{bundle_project, BuildArtifact, PackageType, Settings}; +use clap::{App, AppSettings, Arg, SubCommand}; +use std::env; +use std::process; + +error_chain! { + foreign_links { + Glob(::glob::GlobError); + GlobPattern(::glob::PatternError); + Io(::std::io::Error); + Image(::image::ImageError); + Target(::target_build_utils::Error); + Term(::term::Error); + Toml(::toml::de::Error); + Walkdir(::walkdir::Error); + } + errors { } +} + +/// Runs `cargo build` to make sure the binary file is up-to-date. +fn build_project_if_unbuilt(settings: &Settings) -> crate::Result<()> { + let mut args = vec!["build".to_string()]; + if let Some(triple) = settings.target_triple() { + args.push(format!("--target={}", triple)); + } + match settings.build_artifact() { + &BuildArtifact::Main => {} + &BuildArtifact::Bin(ref name) => { + args.push(format!("--bin={}", name)); + } + &BuildArtifact::Example(ref name) => { + args.push(format!("--example={}", name)); + } + } + if settings.is_release_build() { + args.push("--release".to_string()); + } + + match settings.build_features() { + Some(features) => { + args.push(format!("--features={}", features.join(" "))); + }, + None => {} + } + + let status = process::Command::new("cargo").args(args).status()?; + if !status.success() { + bail!( + "Result of `cargo build` operation was unsuccessful: {}", + status + ); + } + Ok(()) +} + +fn run() -> crate::Result<()> { + let all_formats: Vec<&str> = PackageType::all() + .iter() + .map(PackageType::short_name) + .collect(); + let m = App::new("cargo-proton-bundle") + .version(format!("v{}", crate_version!()).as_str()) + .bin_name("cargo") + .setting(AppSettings::GlobalVersion) + .setting(AppSettings::SubcommandRequired) + .subcommand( + SubCommand::with_name("proton-bundle") + .author("George Burton , Lucas Fernandes Gonçalves Nogueira , Daniel Thompson-Yvetot ") + .about("Bundle Rust executables into OS bundles") + .setting(AppSettings::DisableVersion) + .setting(AppSettings::UnifiedHelpMessage) + .arg( + Arg::with_name("bin") + .long("bin") + .value_name("NAME") + .help("Bundle the specified binary"), + ) + .arg( + Arg::with_name("example") + .long("example") + .value_name("NAME") + .conflicts_with("bin") + .help("Bundle the specified example"), + ) + .arg( + Arg::with_name("format") + .long("format") + .value_name("FORMAT") + .possible_values(&all_formats) + .help("Which bundle format to produce"), + ) + .arg( + Arg::with_name("release") + .long("release") + .help("Build a bundle from a target built in release mode"), + ) + .arg( + Arg::with_name("target") + .long("target") + .value_name("TRIPLE") + .help("Build a bundle for the target triple"), + ) + .arg( + Arg::with_name("features") + .long("features") + .value_name("FEATURES") + .multiple(true) + .help("Which features to build"), + ), + ) + .get_matches(); + + if let Some(m) = m.subcommand_matches("proton-bundle") { + let output_paths = env::current_dir() + .map_err(From::from) + .and_then(|d| Settings::new(d, m)) + .and_then(|s| { + r#try!(build_project_if_unbuilt(&s)); + Ok(s) + }) + .and_then(bundle_project)?; + bundle::print_finished(&output_paths)?; + } + Ok(()) +} + +fn main() { + if let Err(error) = run() { + bundle::print_error(&error).unwrap(); + } +} diff --git a/ui/proton.h b/ui/proton.h index b2a6f83d5..b2805c7fa 100644 --- a/ui/proton.h +++ b/ui/proton.h @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2017 Serge Zaitsev + * Copyright (c) 2017 Serge Zaitsev, (c) 2019 Quasar Framework * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -1575,7 +1575,7 @@ WEBVIEW_API void webview_dialog(struct webview *w, IShellItem *res = NULL; WCHAR *ws = NULL; char *s = NULL; - FILEOPENDIALOGOPTIONS opts, add_opts; + FILEOPENDIALOGOPTIONS opts = 0, add_opts = 0; if (dlgtype == WEBVIEW_DIALOG_TYPE_OPEN) { if (CoCreateInstance( iid_unref(&CLSID_FileOpenDialog), NULL, CLSCTX_INPROC_SERVER, @@ -2062,6 +2062,49 @@ WEBVIEW_API int webview_init(struct webview *w) { item = create_menu_item(title, "terminate:", "q"); objc_msgSend(appMenu, sel_registerName("addItem:"), item); +id editMenuItem = + objc_msgSend((id)objc_getClass("NSMenuItem"), sel_registerName("alloc")); + objc_msgSend(editMenuItem, + sel_registerName("initWithTitle:action:keyEquivalent:"), get_nsstring("Edit"), + NULL, get_nsstring("")); + + /*** + Edit menu + ***/ + +id editMenu = + objc_msgSend((id)objc_getClass("NSMenu"), sel_registerName("alloc")); + objc_msgSend(editMenu, sel_registerName("initWithTitle:"), get_nsstring("Edit")); + objc_msgSend(editMenu, sel_registerName("autorelease")); + + objc_msgSend(editMenuItem, sel_registerName("setSubmenu:"), editMenu); + objc_msgSend(menubar, sel_registerName("addItem:"), editMenuItem); + + item = create_menu_item(get_nsstring("Undo"), "undo:", "z"); + objc_msgSend(editMenu, sel_registerName("addItem:"), item); + + item = create_menu_item(get_nsstring("Redo"), "redo:", "y"); + objc_msgSend(editMenu, sel_registerName("addItem:"), item); + + item = objc_msgSend((id)objc_getClass("NSMenuItem"), sel_registerName("separatorItem")); + objc_msgSend(editMenu, sel_registerName("addItem:"), item); + + item = create_menu_item(get_nsstring("Cut"), "cut:", "x"); + objc_msgSend(editMenu, sel_registerName("addItem:"), item); + + item = create_menu_item(get_nsstring("Copy"), "copy:", "c"); + objc_msgSend(editMenu, sel_registerName("addItem:"), item); + + item = create_menu_item(get_nsstring("Paste"), "paste:", "v"); + objc_msgSend(editMenu, sel_registerName("addItem:"), item); + + item = create_menu_item(get_nsstring("Select All"), "selectAll:", "a"); + objc_msgSend(editMenu, sel_registerName("addItem:"), item); + + /*** + Finalize menubar + ***/ + objc_msgSend(objc_msgSend((id)objc_getClass("NSApplication"), sel_registerName("sharedApplication")), sel_registerName("setMainMenu:"), menubar); @@ -2145,6 +2188,7 @@ WEBVIEW_API void webview_set_color(struct webview *w, uint8_t r, uint8_t g, objc_msgSend(w->priv.window, sel_registerName("setOpaque:"), 0); objc_msgSend(w->priv.window, sel_registerName("setTitlebarAppearsTransparent:"), 1); + objc_msgSend(w->priv.webview, sel_registerName("_setDrawsBackground:"), 0); } WEBVIEW_API void webview_dialog(struct webview *w,