From 85662fbca97e2408ed4c4370fe9bafab86bcbcb1 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 17 Apr 2018 09:13:33 -0700 Subject: [PATCH] Add an "umbrella" crate, which seeks to provide a convenient interface. This currently pulls in cretonne-codegen and cretonne-frontend and provides a simple prelude interface. This fixes #287. --- cranelift/Cargo.toml | 1 + cranelift/publish-all.sh | 8 +++++++- lib/umbrella/Cargo.toml | 18 ++++++++++++++++++ lib/umbrella/README.md | 3 +++ lib/umbrella/src/lib.rs | 19 +++++++++++++++++++ 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 lib/umbrella/Cargo.toml create mode 100644 lib/umbrella/README.md create mode 100644 lib/umbrella/src/lib.rs diff --git a/cranelift/Cargo.toml b/cranelift/Cargo.toml index b8acb84d62..4a28857088 100644 --- a/cranelift/Cargo.toml +++ b/cranelift/Cargo.toml @@ -19,6 +19,7 @@ cretonne-frontend = { path = "lib/frontend", version = "0.4.4" } cretonne-wasm = { path = "lib/wasm", version = "0.4.4" } cretonne-native = { path = "lib/native", version = "0.4.4" } cretonne-filetests = { path = "lib/filetests", version = "0.4.4" } +cretonne = { path = "lib/umbrella", version = "0.4.4" } filecheck = "0.2.1" docopt = "0.8.0" serde = "1.0.8" diff --git a/cranelift/publish-all.sh b/cranelift/publish-all.sh index 27d507f8b4..108d8055c2 100755 --- a/cranelift/publish-all.sh +++ b/cranelift/publish-all.sh @@ -27,7 +27,13 @@ cargo update echo git commit -a -m "\"Bump version to $version"\" echo git push -for crate in entity codegen frontend native reader wasm ; do +for crate in entity codegen frontend native reader wasm umbrella ; do + if [ "$crate" == "umbrella" ]; then + dir="cretonne" + else + dir="$crate" + fi + echo cargo publish --manifest-path "lib/$crate/Cargo.toml" done echo diff --git a/lib/umbrella/Cargo.toml b/lib/umbrella/Cargo.toml new file mode 100644 index 0000000000..d1f7f95786 --- /dev/null +++ b/lib/umbrella/Cargo.toml @@ -0,0 +1,18 @@ +[package] +authors = ["The Cretonne Project Developers"] +name = "cretonne" +version = "0.4.4" +description = "Umbrella for commonly-used cretonne crates" +license = "Apache-2.0" +documentation = "https://cretonne.readthedocs.io/" +repository = "https://github.com/cretonne/cretonne" +readme = "README.md" +keywords = ["compile", "compiler", "jit"] + +[dependencies] +cretonne-codegen = { path = "../codegen", version = "0.4.4" } +cretonne-frontend = { path = "../frontend", version = "0.4.4" } + +[badges] +maintenance = { status = "experimental" } +travis-ci = { repository = "cretonne/cretonne" } diff --git a/lib/umbrella/README.md b/lib/umbrella/README.md new file mode 100644 index 0000000000..f9c2ee3fbf --- /dev/null +++ b/lib/umbrella/README.md @@ -0,0 +1,3 @@ +This is an umbrella crate which contains no code of its own, but pulls in +other cretonne library crates to provide a convenient one-line dependency +for common use cases. diff --git a/lib/umbrella/src/lib.rs b/lib/umbrella/src/lib.rs new file mode 100644 index 0000000000..a70a97e86f --- /dev/null +++ b/lib/umbrella/src/lib.rs @@ -0,0 +1,19 @@ +//! Cretonne umbrella crate, providing a convenient one-line dependency. + +#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] +#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] + +pub extern crate cretonne_codegen; +pub extern crate cretonne_frontend; + +/// A prelude providing convenient access to commonly-used cretonne features. Use +/// as `use cretonne::prelude::*`. +pub mod prelude { + pub use cretonne_codegen; + pub use cretonne_codegen::entity::EntityRef; + pub use cretonne_codegen::ir::{AbiParam, InstBuilder, Value, Ebb, Signature, CallConv}; + pub use cretonne_codegen::ir::types; + pub use cretonne_codegen::ir::condcodes::IntCC; + + pub use cretonne_frontend::{FunctionBuilderContext, FunctionBuilder, Variable}; +}