,
assertions: bool,
) -> crate::Result<&mut Self> {
- let mut entry_point = if entry_point.is_none() {
- self.nest.default_package()
- } else {
- entry_point.unwrap().as_ref().to_path_buf()
- };
-
- if !entry_point.is_file() {
- // Use is_file to skip messing with pathing for src/
- // If target is not a file (explicit entry point), check if it's a known package
- // and use that's package's default entry point.
+ let mut entry_point = entry_point.expect("No entry point found").as_ref().to_path_buf();
+ while entry_point.is_file() {
entry_point = self
.packages
.get(&entry_point)
.ok_or(Error::UnknownPackage)?
- .entry_point();
+ .entry_point()
+ .expect("No entry point found");
}
+ // let mut entry_point = if entry_point.is_none() {
+ // self.nest.entry_point()
+ // } else {
+ // //entry_point.unwrap().as_ref().to_path_buf()
+ // };
+ //
+ // if !entry_point.is_file() {
+ // // Use is_file to skip messing with pathing for src/
+ // // If target is not a file (explicit entry point), check if it's a known package
+ // // and use that's package's default entry point.
+ // entry_point = self
+ // .packages
+ // .get(&entry_point)
+ // .ok_or(Error::UnknownPackage)?
+ // .entry_point();
+ // }
+ //
if entry_point.file_name().is_none() {
- return Err(Error::UndefinedEntryPoint);
+ return Err(Error::UndefinedEntryPoint);
}
-
+ //
java::runtime::JVMBuilder::new(Self::DIR_TARGET)
.assertions(assertions)
.monitor(true)
.build()
.run(entry_point)?;
-
Ok(self)
}
@@ -201,7 +211,7 @@ impl WorkspaceHandler {
self.project_root
.join(Self::DIR_SRC)
.join(handler.name())
- .join(F_PREY_LOCK),
+ .join(F_NEST_LOCK),
) {
if err.kind() != std::io::ErrorKind::NotFound {
return Err(Error::from(err));
@@ -216,6 +226,9 @@ impl WorkspaceHandler {
}
/// Add any newly created packages.
+ /// Prey.toml files designate packages.
+ /// discover_packages() iterates the filesystem recursively to discover all such packages.
+ /// discovered packages are stored as a hashmap ) -> Result