Skip to content

Commit

Permalink
Archive directory (#233)
Browse files Browse the repository at this point in the history
* Use archive directory

* Fix archive file paths
  • Loading branch information
raviqqe authored Aug 15, 2021
1 parent 4385934 commit b2fe744
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
11 changes: 9 additions & 2 deletions lib/app/src/common/file_path_resolver.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
use super::package_id_calculator;
use crate::{
common::module_id_calculator,
infra::{FilePath, FilePathConfiguration, EXTERNAL_PACKAGE_DIRECTORY, OBJECT_DIRECTORY},
infra::{
FilePath, FilePathConfiguration, ARCHIVE_DIRECTORY, EXTERNAL_PACKAGE_DIRECTORY,
OBJECT_DIRECTORY,
},
};

pub fn resolve_object_directory(output_directory: &FilePath) -> FilePath {
output_directory.join(&FilePath::new([OBJECT_DIRECTORY]))
}

pub fn resolve_archive_directory(output_directory: &FilePath) -> FilePath {
output_directory.join(&FilePath::new([ARCHIVE_DIRECTORY]))
}

pub fn resolve_source_file(
package_directory: &FilePath,
components: &[String],
Expand Down Expand Up @@ -64,7 +71,7 @@ fn resolve_package_ffi_archive_file(
package_id: &str,
file_path_configuration: &FilePathConfiguration,
) -> FilePath {
resolve_object_directory(output_directory)
resolve_archive_directory(output_directory)
.join(&FilePath::new([package_id]))
.with_extension(file_path_configuration.archive_file_extension)
}
1 change: 1 addition & 0 deletions lib/app/src/infra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ pub use package_configuration_writer::*;

pub const EXTERNAL_PACKAGE_DIRECTORY: &str = "packages";
pub const OBJECT_DIRECTORY: &str = "objects";
pub const ARCHIVE_DIRECTORY: &str = "archives";
16 changes: 10 additions & 6 deletions lib/app/src/package_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ pub fn build(

infrastructure.module_builder.build(&build_script_file)?;

let files = infrastructure.file_system.read_directory(
&file_path_resolver::resolve_object_directory(output_directory),
)?;

if is_main_package(
infrastructure,
main_package_directory,
Expand All @@ -55,14 +51,22 @@ pub fn build(
.get(&application_configuration.system_package_name)
.ok_or(ApplicationError::SystemPackageNotFound)?,
),
&files
&infrastructure
.file_system
.read_directory(&file_path_resolver::resolve_object_directory(
output_directory,
))?
.iter()
.filter(|file| {
file.has_extension(infrastructure.file_path_configuration.object_file_extension)
})
.cloned()
.collect::<Vec<_>>(),
&files
&infrastructure
.file_system
.read_directory(&file_path_resolver::resolve_archive_directory(
output_directory,
))?
.iter()
.filter(|file| {
file.has_extension(
Expand Down

0 comments on commit b2fe744

Please sign in to comment.