Adjust module organization to facilitate resurrection of the playground.
The playground doesn't / cannot depend on aiken-project because that becomes a gigantic pain. So instead, we try to keep essential stuff inside aiken-lang when possible.
This commit is contained in:
@@ -19,7 +19,6 @@ aiken-lang = { path = "../aiken-lang", version = "1.0.31-alpha" }
|
||||
askama = { version = "0.12.0", features = ["urlencode"] }
|
||||
camino = "1.1.9"
|
||||
ciborium = "0.2.2"
|
||||
cryptoxide = "0.4.4"
|
||||
dirs = "4.0.0"
|
||||
fslock = "0.2.1"
|
||||
futures = "0.3.26"
|
||||
@@ -27,7 +26,7 @@ hex = "0.4.3"
|
||||
ignore = "0.4.20"
|
||||
indexmap = "1.9.2"
|
||||
itertools = "0.10.5"
|
||||
miette.workspace = true
|
||||
miette = { version = "7.2.0", features = ["fancy"] }
|
||||
notify = "6.1.1"
|
||||
num-bigint = "0.4.4"
|
||||
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
|
||||
@@ -36,7 +35,6 @@ pallas-codec.workspace = true
|
||||
pallas-crypto.workspace = true
|
||||
pallas-primitives.workspace = true
|
||||
pallas-traverse.workspace = true
|
||||
patricia_tree = "0.8.0"
|
||||
petgraph = "0.6.3"
|
||||
pulldown-cmark = { version = "0.12.0", default-features = false, features = ["html"] }
|
||||
rayon = "1.7.0"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::{github::repo::LatestRelease, package_name::PackageName, paths, Error};
|
||||
pub use aiken_lang::plutus_version::PlutusVersion;
|
||||
use aiken_lang::{
|
||||
ast::{
|
||||
Annotation, ByteArrayFormatPreference, Constant, ModuleConstant, Span, UntypedDefinition,
|
||||
@@ -7,6 +6,7 @@ use aiken_lang::{
|
||||
expr::UntypedExpr,
|
||||
parser::token::Base,
|
||||
};
|
||||
pub use aiken_lang::{plutus_version::PlutusVersion, version::compiler_version};
|
||||
use miette::NamedSource;
|
||||
use semver::Version;
|
||||
use serde::{
|
||||
@@ -355,18 +355,6 @@ mod built_info {
|
||||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||
}
|
||||
|
||||
pub fn compiler_version(include_commit_hash: bool) -> String {
|
||||
if include_commit_hash {
|
||||
format!(
|
||||
"v{}+{}",
|
||||
built_info::PKG_VERSION,
|
||||
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("unknown")
|
||||
)
|
||||
} else {
|
||||
format!("v{}", built_info::PKG_VERSION,)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compiler_info() -> String {
|
||||
format!(
|
||||
r#"
|
||||
|
||||
@@ -3,6 +3,7 @@ use aiken_lang::{
|
||||
ast::{self, Span},
|
||||
error::ExtraData,
|
||||
parser::error::ParseError,
|
||||
test_framework::{PropertyTestResult, TestResult, UnitTestResult},
|
||||
tipo,
|
||||
};
|
||||
use miette::{
|
||||
@@ -162,6 +163,28 @@ impl Error {
|
||||
|
||||
errors
|
||||
}
|
||||
|
||||
pub fn from_test_result<U, T>(result: &TestResult<U, T>, verbose: bool) -> Self {
|
||||
let (name, path, src) = match result {
|
||||
TestResult::UnitTestResult(UnitTestResult { test, .. }) => (
|
||||
test.name.to_string(),
|
||||
test.input_path.to_path_buf(),
|
||||
test.program.to_pretty(),
|
||||
),
|
||||
TestResult::PropertyTestResult(PropertyTestResult { test, .. }) => (
|
||||
test.name.to_string(),
|
||||
test.input_path.to_path_buf(),
|
||||
test.program.to_pretty(),
|
||||
),
|
||||
};
|
||||
|
||||
Error::TestFailure {
|
||||
name,
|
||||
path,
|
||||
src,
|
||||
verbose,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for Error {
|
||||
|
||||
@@ -12,10 +12,10 @@ pub mod package_name;
|
||||
pub mod paths;
|
||||
pub mod pretty;
|
||||
pub mod telemetry;
|
||||
pub mod test_framework;
|
||||
pub mod utils;
|
||||
pub mod watch;
|
||||
|
||||
mod test_framework;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
@@ -40,8 +40,9 @@ use aiken_lang::{
|
||||
format::{Formatter, MAX_COLUMNS},
|
||||
gen_uplc::CodeGenerator,
|
||||
line_numbers::LineNumbers,
|
||||
test_framework::{Test, TestResult},
|
||||
tipo::{Type, TypeInfo},
|
||||
IdGenerator,
|
||||
utils, IdGenerator,
|
||||
};
|
||||
use export::Export;
|
||||
use indexmap::IndexMap;
|
||||
@@ -58,7 +59,6 @@ use std::{
|
||||
rc::Rc,
|
||||
};
|
||||
use telemetry::EventListener;
|
||||
use test_framework::{Test, TestResult};
|
||||
use uplc::{
|
||||
ast::{Constant, Name, Program},
|
||||
PlutusData,
|
||||
@@ -419,7 +419,7 @@ where
|
||||
if e.is_success() {
|
||||
None
|
||||
} else {
|
||||
Some(e.into_error(verbose))
|
||||
Some(Error::from_test_result(e, verbose))
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
use crate::{
|
||||
pretty,
|
||||
use crate::pretty;
|
||||
use aiken_lang::{
|
||||
ast::OnTestFailure,
|
||||
expr::UntypedExpr,
|
||||
format::Formatter,
|
||||
test_framework::{PropertyTestResult, TestResult, UnitTestResult},
|
||||
};
|
||||
use aiken_lang::{ast::OnTestFailure, expr::UntypedExpr, format::Formatter};
|
||||
use owo_colors::{OwoColorize, Stream::Stderr};
|
||||
use std::{collections::BTreeMap, fmt::Display, path::PathBuf};
|
||||
use uplc::machine::cost_model::ExBudget;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,21 +0,0 @@
|
||||
use indexmap::IndexMap;
|
||||
use std::{collections::HashMap, hash::Hash};
|
||||
|
||||
pub fn as_ref_values<'a, K, V>(iter: &'a IndexMap<K, V>) -> IndexMap<&'a K, &'a V>
|
||||
where
|
||||
K: Eq + Hash + Clone + 'a,
|
||||
{
|
||||
let mut refs = IndexMap::new();
|
||||
for (k, v) in iter {
|
||||
refs.insert(k, v);
|
||||
}
|
||||
refs
|
||||
}
|
||||
|
||||
pub fn as_str_ref_values<V>(iter: &'_ HashMap<String, V>) -> IndexMap<&'_ str, &'_ V> {
|
||||
let mut refs = IndexMap::new();
|
||||
for (k, v) in iter {
|
||||
refs.insert(k.as_str(), v);
|
||||
}
|
||||
refs
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
pub mod indexmap;
|
||||
Reference in New Issue
Block a user