Skip to content
Open
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 src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl Project {
}))
}

fn used_packages( &self, profile: Profile ) -> Vec< &CargoPackage > {
pub fn used_packages( &self, profile: Profile ) -> Vec< &CargoPackage > {
let main_package = self.package();
let mut packages = self.project.used_packages(
self.backend().triplet(),
Expand Down
2 changes: 1 addition & 1 deletion src/cmd_deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn command_deploy(build_args: BuildArgs, directory: Option<PathBuf>) -> Resu
let target = targets[ 0 ];
let result = project.build( &config, target )?;

let deployment = Deployment::new( package, target, &result )?;
let deployment = Deployment::new(&project, target, &result )?;

let is_using_default_directory;
let directory = match directory {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl LastBuild {
fn new( project: Project, target: CargoTarget, counter: Counter ) -> Result< Self, Error > {
let config = project.aggregate_configuration( Profile::Main )?;
let result = project.build( &config, &target )?;
let deployment = Deployment::new( project.package(), &target, &result )?;
let deployment = Deployment::new( &project, &target, &result )?;

Ok( LastBuild {
counter,
Expand Down
22 changes: 14 additions & 8 deletions src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ use cargo_shim::{
TargetKind,
CargoPackage,
CargoTarget,
CargoResult
CargoResult,
Profile
};

use build::Project;

use error::Error;
use utils::read_bytes;

Expand Down Expand Up @@ -101,8 +104,9 @@ impl Artifact {
}

impl Deployment {
pub fn new( package: &CargoPackage, target: &CargoTarget, result: &CargoResult ) -> Result< Self, Error > {
let crate_static_path = package.crate_root.join( "static" );
pub fn new( project: &Project, target: &CargoTarget, result: &CargoResult ) -> Result< Self, Error > {
let package = project.package();

let target_static_path = match target.kind {
TargetKind::Example => Some( target.source_directory.join( format!( "{}-static", target.name ) ) ),
TargetKind::Bin => Some( target.source_directory.join( "static" ) ),
Expand Down Expand Up @@ -150,11 +154,13 @@ impl Deployment {
});
}

routes.push( Route {
key: "".to_owned(),
kind: RouteKind::StaticDirectory( crate_static_path.to_owned() ),
can_be_deployed: true
});
for package in project.used_packages(Profile::Main) {
routes.push( Route {
key: "".to_owned(),
kind: RouteKind::StaticDirectory( package.crate_root.join( "static" ) ),
can_be_deployed: true
})
}

routes.push( Route {
key: "index.html".to_owned(),
Expand Down