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:
@@ -15,6 +15,7 @@ rust-version = "1.66.1"
|
||||
|
||||
[dependencies]
|
||||
blst = "0.3.11"
|
||||
cryptoxide = "0.4.4"
|
||||
hex = "0.4.3"
|
||||
indexmap = "1.9.2"
|
||||
indoc = "2.0.1"
|
||||
@@ -24,6 +25,7 @@ num-bigint = "0.4.3"
|
||||
ordinal = "0.3.2"
|
||||
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
|
||||
pallas-primitives.workspace = true
|
||||
patricia_tree = "0.8.0"
|
||||
petgraph = "0.6.3"
|
||||
serde = { version = "1.0.197", features = ["derive", "rc"] }
|
||||
strum = "0.24.1"
|
||||
@@ -43,3 +45,6 @@ chumsky = { version = "0.9.2", features = [
|
||||
indoc = "2.0.1"
|
||||
insta.workspace = true
|
||||
pretty_assertions = "1.3.0"
|
||||
|
||||
[build-dependencies]
|
||||
built = { version = "0.7.1", features = ["git2"] }
|
||||
|
||||
3
crates/aiken-lang/build.rs
Normal file
3
crates/aiken-lang/build.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
built::write_built_file().expect("Failed to acquire build-time information");
|
||||
}
|
||||
@@ -14,7 +14,10 @@ pub mod line_numbers;
|
||||
pub mod parser;
|
||||
pub mod plutus_version;
|
||||
pub mod pretty;
|
||||
pub mod test_framework;
|
||||
pub mod tipo;
|
||||
pub mod utils;
|
||||
pub mod version;
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct IdGenerator {
|
||||
|
||||
1289
crates/aiken-lang/src/test_framework.rs
Normal file
1289
crates/aiken-lang/src/test_framework.rs
Normal file
File diff suppressed because it is too large
Load Diff
0
crates/aiken-lang/src/utils/version.rs
Normal file
0
crates/aiken-lang/src/utils/version.rs
Normal file
15
crates/aiken-lang/src/version.rs
Normal file
15
crates/aiken-lang/src/version.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
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,)
|
||||
}
|
||||
}
|
||||
|
||||
mod built_info {
|
||||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
use aiken_lang::{ast::Tracing, line_numbers::LineNumbers};
|
||||
use aiken_project::{
|
||||
config::Config, error::Error as ProjectError, module::CheckedModule,
|
||||
test_framework::PropertyTest, Project,
|
||||
};
|
||||
use aiken_lang::{ast::Tracing, line_numbers::LineNumbers, test_framework::PropertyTest};
|
||||
use aiken_project::{config::Config, error::Error as ProjectError, module::CheckedModule, Project};
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -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,9 +1,9 @@
|
||||
use super::build::{filter_traces_parser, trace_level_parser};
|
||||
use aiken_lang::ast::{TraceLevel, Tracing};
|
||||
use aiken_project::{
|
||||
use aiken_lang::{
|
||||
ast::{TraceLevel, Tracing},
|
||||
test_framework::PropertyTest,
|
||||
watch::{self, watch_project, with_project},
|
||||
};
|
||||
use aiken_project::watch::{self, watch_project, with_project};
|
||||
use rand::prelude::*;
|
||||
use std::{path::PathBuf, process};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user