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:
KtorZ 2024-08-29 09:11:26 +02:00
parent 8bccbd9e00
commit e31c6de04e
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
18 changed files with 1360 additions and 1342 deletions

5
Cargo.lock generated vendored
View File

@ -82,7 +82,9 @@ name = "aiken-lang"
version = "1.0.31-alpha"
dependencies = [
"blst",
"built",
"chumsky",
"cryptoxide",
"hex",
"indexmap 1.9.3",
"indoc",
@ -93,6 +95,7 @@ dependencies = [
"ordinal",
"owo-colors 3.5.0",
"pallas-primitives",
"patricia_tree",
"petgraph",
"pretty_assertions",
"serde",
@ -133,7 +136,6 @@ dependencies = [
"built",
"camino",
"ciborium",
"cryptoxide",
"dirs",
"fslock",
"futures",
@ -152,7 +154,6 @@ dependencies = [
"pallas-crypto",
"pallas-primitives",
"pallas-traverse",
"patricia_tree",
"petgraph",
"pretty_assertions",
"proptest",

View File

@ -48,7 +48,7 @@ x86_64-unknown-linux-gnu = "ubuntu-22.04"
[workspace.dependencies]
walkdir = "2.3.2"
insta = { version = "1.30.0", features = ["yaml", "json", "redactions"] }
miette = { version = "7.2.0", features = ["fancy"] }
miette = { version = "7.2.0" }
pallas-addresses = "0.30.1"
pallas-codec = { version = "0.30.1", features = ["num-bigint"] }
pallas-crypto = "0.30.1"

View File

@ -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"] }

View File

@ -0,0 +1,3 @@
fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
}

View File

@ -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 {

File diff suppressed because it is too large Load Diff

View File

View 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"));
}

View File

@ -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)]

View File

@ -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"

View File

@ -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#"

View File

@ -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 {

View File

@ -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();

View File

@ -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

View File

@ -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};