Skip to content

Commit 4dd16c3

Browse files
GearsDatapackslpil
authored andcommitted
Make configuration lower level
1 parent 0420229 commit 4dd16c3

File tree

6 files changed

+90
-72
lines changed

6 files changed

+90
-72
lines changed

compiler-core/src/build/native_file_copier.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
paths::ProjectPaths,
1313
};
1414

15-
use super::package_compiler::PackageKind;
15+
use super::package_compiler::CheckModuleConflicts;
1616

1717
#[derive(Debug, Clone, PartialEq, Eq)]
1818
pub(crate) struct CopiedNativeFiles {
@@ -28,7 +28,7 @@ pub(crate) struct NativeFileCopier<'a, IO> {
2828
seen_modules: HashMap<EcoString, Utf8PathBuf>,
2929
to_compile: Vec<Utf8PathBuf>,
3030
elixir_files_copied: bool,
31-
package_kind: PackageKind,
31+
check_module_conflicts: CheckModuleConflicts,
3232
}
3333

3434
impl<'a, IO> NativeFileCopier<'a, IO>
@@ -39,7 +39,7 @@ where
3939
io: IO,
4040
root: &'a Utf8Path,
4141
out: &'a Utf8Path,
42-
package_kind: PackageKind,
42+
check_module_conflicts: CheckModuleConflicts,
4343
) -> Self {
4444
Self {
4545
io,
@@ -49,7 +49,7 @@ where
4949
seen_native_files: HashSet::new(),
5050
seen_modules: HashMap::new(),
5151
elixir_files_copied: false,
52-
package_kind,
52+
check_module_conflicts,
5353
}
5454
}
5555

@@ -226,10 +226,7 @@ where
226226
Some("erl") => {
227227
eco_format!("{}", relative_path.file_name().expect("path has file name"))
228228
}
229-
// We only check for conflicting Gleam files if this is the root
230-
// package, since Hex packages are bundled with the Gleam source files
231-
// and compiled Erlang files next to each other.
232-
Some("gleam") if self.package_kind.is_root() => relative_path
229+
Some("gleam") if self.check_module_conflicts.should_check() => relative_path
233230
.with_extension("erl")
234231
.as_str()
235232
.replace("/", "@")

0 commit comments

Comments
 (0)