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

feat: use 'shuttle' feature flag if it exists #1799

Merged
merged 5 commits into from
Jun 13, 2024
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
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ args = [
"--all-features",
"--no-deps",
"--",
"--D",
"-D",
"warnings",
]

Expand Down
17 changes: 13 additions & 4 deletions cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1792,12 +1792,21 @@ impl Shuttle {

let metadata = async_cargo_metadata(manifest_path.as_path()).await?;
let packages = find_shuttle_packages(&metadata)?;
let package_name = packages
// TODO: support overriding this
let package = packages
.first()
.expect("at least one shuttle crate in the workspace")
.name
.to_owned();
.expect("at least one shuttle crate in the workspace");
let package_name = package.name.to_owned();
deployment_req_beta.package_name = package_name;

// TODO: add these to the request and builder
let (_no_default_features, _features) = if package.features.contains_key("shuttle") {
(true, vec!["shuttle".to_owned()])
} else {
(false, vec![])
};
oddgrd marked this conversation as resolved.
Show resolved Hide resolved
// TODO: determine which (one) binary to build
// TODO: have the above be configurable in CLI and Shuttle.toml
}

if let Ok(repo) = Repository::discover(working_directory) {
Expand Down
2 changes: 1 addition & 1 deletion common/src/models/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn get_resource_tables(
output.push(get_secrets_table(secrets, service_name, raw));
};

if resource_groups.get("Persist").is_some() {
if resource_groups.contains_key("Persist") {
output.push(format!("This persist instance is linked to {service_name}\nShuttle Persist: {service_name}\n"));
};

Expand Down
2 changes: 1 addition & 1 deletion examples
4 changes: 4 additions & 0 deletions service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ async fn compile(
cmd.arg("--jobs=4");
}

// TODO: Compile only one binary target in the package.
for package in &packages {
if package.features.contains_key("shuttle") {
cmd.arg("--no-default-features").arg("--features=shuttle");
}
cmd.arg("--package").arg(package.name.as_str());
}

Expand Down