forked from Cutieguwu/raven
Support proper locating of Nest.toml; Cleanup.
This commit is contained in:
14
src/nest.rs
14
src/nest.rs
@@ -11,14 +11,8 @@ use anyhow::Context;
|
||||
use semver::Version;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub static NEST: LazyLock<anyhow::Result<Nest>> = LazyLock::new(|| {
|
||||
Nest::try_from(
|
||||
PROJECT_ROOT
|
||||
.lock()
|
||||
.expect("Failed to lock mutex")
|
||||
.join(F_NEST_TOML.as_path()),
|
||||
)
|
||||
});
|
||||
pub static NEST: LazyLock<anyhow::Result<Nest>> =
|
||||
LazyLock::new(|| Nest::try_from(PROJECT_ROOT.join(F_NEST_TOML.as_path())));
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Nest {
|
||||
@@ -133,16 +127,12 @@ impl Class {
|
||||
// If the source file exists, hasn't been moved to a package (path is a file) and
|
||||
// the associated compiled class file exists in DIR_TARGET
|
||||
PROJECT_ROOT
|
||||
.lock()
|
||||
.expect("Failed to lock mutex")
|
||||
.join(DIR_TARGET.as_path())
|
||||
.join(self.name.as_path())
|
||||
.with_extension(JAVA_EXT_CLASS)
|
||||
.exists()
|
||||
&& sha256::try_digest(
|
||||
PROJECT_ROOT
|
||||
.lock()
|
||||
.expect("Failed to lock mutex")
|
||||
.join(if self.test {
|
||||
DIR_TEST.clone()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user