Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new Cargo features & resolver to enable feature-based inclusion of crates #522

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 129 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 70 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,47 +1,100 @@
[workspace]
resolver = "2"


## Here, we specify that all subdirectories in the kernel/ and applications/ directories should be built,
## except for those starting with a "." So, we build all kernel and application crates except hidden directories.
##
## The `members` field of this workspace is used to specify all of the crates that are built
## when the entire workspace is built, e.g., with `cargo build --workspace` or `cargo build --all`.
##
## Note that a full workspace build will *not* include crates that are explicitly excluded below.
members = [
"theseus_features", ## Must be included to realize global Cargo features across Theseus.
"kernel/[!.]*/",
"applications/[!.]*/",
"ports/theseus_std",
]


## Default members are the crates built by default if no specific packages (crates)
## are specified when invoking `cargo build`.
## Currently, this is only relevant when overriding the Makefile's default `CARGOFLAGS`,
## which has the default value of `--workspace`, ensuring that all `members` above are built
## `CARGOFLAGS` are explicitly set when invoking `make`.
##
## So far, this includes only the minimum crates required to allow Theseus to boot.
default-members = [
"theseus_features", ## Must be included to realize global Cargo features across Theseus.
"kernel/nano_core",
]


exclude = [
## exclude the build directories
## Exclude the build directories
"build",
"target",

## Exclude configuration, tools, scripts, etc
"cfg",
"compiler_plugins",
"libs",
"old_crates",
"scripts",
"target",
"tools",

## Exclude old components
"old_crates",
"userspace",

## Exclude *all* ports for now, as only the ones requested by core Theseus crates
## should be included in the workspace build by default.
## Exclude third-party libs and ports for now.
## This allows Theseus crates that *are* included in a build to pull these
## third-party crates in only when needed to fulfill their dependencies.
"libs",
"ports",

## exclude tlibc, since we currently build it separately.
## Exclude tlibc and libtheseus, which are currently built separately.
"tlibc",
"libtheseus",

## exclude unused test applications by default
"applications/test_exception",
"applications/test_exception2",
"applications/test_filerw",
########################################################################################
## Below, we exclude things that should NEVER be considered part of Theseus's workspace.
########################################################################################
##
## Note that if you simply need to exclude something from a custom build of Theseus,
## it's best to add that crate as an optional dependency and then create a feature
## to enable it in a non-workspace build (i.e., when not calling `cargo build --all`).

## Exclude kernel crates that exist purely for testing or benchmarking purposes.
"kernel/libtest",
"kernel/test_thread_local",
"kernel/mapper_spillful",
"kernel/unified_channel",

## Exclude benchmark-related crates in all builds; they must be explicitly included via features.
## TODO: move these to a specific "benches" folder so we can exclude that entire folder.
"applications/bm",
"applications/heap_eval",
"applications/mm_eval",
"applications/rq_eval",
"applications/scheduler_eval",

## Exclude application crates used for testing specific Theseus functionality.
## TODO: move these to a specific "tests" folder so we can exclude that entire folder.
"applications/test_backtrace",
"applications/test_block_io",
"applications/test_channel",
"applications/test_downtime",
"applications/test_filerw",
"applications/test_ixgbe",
"applications/test_libc",
"applications/test_mlx5",
"applications/test_mutex_sleep",
"applications/test_panic",
"applications/test_realtime",
"applications/test_restartable",
"applications/test_serial_echo",
"applications/test_std_fs",
"applications/test_wait_queue",
"applications/test_ixgbe",
# "applications/test_backtrace",

## libtheseus is currently built separately and not used
"libtheseus",
"applications/tls_test",
"applications/unwind_test",
]


Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ cargo: check-rustc
@echo -e "\t KERNEL_PREFIX: \"$(KERNEL_PREFIX)\""
@echo -e "\t APP_PREFIX: \"$(APP_PREFIX)\""
@echo -e "\t THESEUS_CONFIG (before build.rs script): \"$(THESEUS_CONFIG)\""
RUST_TARGET_PATH="$(CFG_DIR)" RUSTFLAGS="$(RUSTFLAGS)" cargo build $(CARGOFLAGS) $(BUILD_STD_CARGOFLAGS) $(RUST_FEATURES) --all --target $(TARGET)
RUST_TARGET_PATH="$(CFG_DIR)" RUSTFLAGS="$(RUSTFLAGS)" cargo build $(CARGOFLAGS) $(BUILD_STD_CARGOFLAGS) $(RUST_FEATURES) --target $(TARGET)

## We tried using the "cargo rustc" command here instead of "cargo build" to avoid cargo unnecessarily rebuilding core/alloc crates,
## But it doesn't really seem to work (it's not the cause of cargo rebuilding everything).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "channel_app"
name = "channel_eval"
version = "0.1.0"
description = "Used for evaluating live evolution between sync/async channels in Theseus"
authors = ["Kevin Boos <kevinaboos@gmail.com>"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn main(args: Vec<String>) -> isize {

match rmain(matches) {
Ok(_) => {
println!("channel_app completed successfully.");
println!("channel_eval completed successfully.");
0
}
Err(e) => {
Expand Down Expand Up @@ -113,5 +113,5 @@ fn print_usage(opts: Options) {
}


const USAGE: &'static str = "Usage: channel_app [ARGS]
const USAGE: &'static str = "Usage: channel_eval [ARGS]
Used for evaluating live evolution between sync/async channels in Theseus.";
22 changes: 0 additions & 22 deletions applications/test_exception/Cargo.toml

This file was deleted.

47 changes: 0 additions & 47 deletions applications/test_exception/src/lib.rs

This file was deleted.

Loading