Skip to content
Closed
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
118 changes: 100 additions & 18 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ portpicker = "0.1.1"
tokio = { version = "1.23.0", features = ["full"] }
async-trait = "0.1.59"
semver = "1.0.14"
tracing = "0.1.37"
tracing-subscriber = "0.3.17"

[dev-dependencies]
dotenv-parser = "0.1.3"
Expand Down
11 changes: 6 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use providers::{
rust::RustProvider, scala::ScalaProvider, staticfile::StaticfileProvider, swift::SwiftProvider,
zig::ZigProvider, Provider,
};
use tracing::info;

mod chain;
#[macro_use]
Expand Down Expand Up @@ -118,7 +119,7 @@ pub async fn create_docker_image(

if let Ok(subdir) = app.source.strip_prefix(orig_path) {
if subdir != std::path::Path::new("") {
println!("Using subdirectory \"{}\"", subdir.to_str().unwrap());
info!("Using subdirectory \"{}\"", subdir.to_str().unwrap());
}
}

Expand All @@ -127,19 +128,19 @@ pub async fn create_docker_image(

let phase_count = plan.phases.clone().map_or(0, |phases| phases.len());
if phase_count > 0 {
println!("{}", plan.get_build_string()?);
info!("Build plan has {} phases", phase_count);

let start = plan.start_phase.clone().unwrap_or_default();
if start.cmd.is_none() && !build_options.no_error_without_start {
bail!("No start command could be found")
}
} else {
println!("\nNixpacks was unable to generate a build plan for this app.\nPlease check the documentation for supported languages: https://nixpacks.com");
println!("\nThe contents of the app directory are:\n");
info!("\nNixpacks was unable to generate a build plan for this app.\nPlease check the documentation for supported languages: https://nixpacks.com");
info!("\nThe contents of the app directory are:\n");

for file in &app.paths {
let path = app.strip_source_path(file.as_path())?;
println!(
info!(
" {}{}",
path.display(),
if file.is_dir() { "/" } else { "" }
Expand Down
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::{
ops::Deref,
string::ToString,
};
use tracing::info;

/// The build plan config file format to use.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
Expand Down Expand Up @@ -156,6 +157,8 @@ enum Commands {

#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();

let args = Args::parse();

let pkgs = args
Expand Down Expand Up @@ -213,12 +216,12 @@ async fn main() -> Result<()> {
PlanFormat::Toml => plan.to_toml()?,
};

println!("{plan_s}");
info!("Generated build plan: {}", plan_s);
}
// Detect which providers should be used to build a project and print them to stdout.
// Detect which providers should be used to build a project and print them.
Commands::Detect { path } => {
let providers = get_plan_providers(&path, env, &options)?;
println!("{}", providers.join(", "));
info!("Detected providers: {}", providers.join(", "));
}
// Generate a Dockerfile and builds a container, using any specified build options.
Commands::Build {
Expand Down
Loading