feat(deps): start laying out some types and functions
This commit is contained in:
parent
b3266fb837
commit
a6fd8f92a8
|
@ -109,6 +109,7 @@ version = "0.0.26"
|
|||
dependencies = [
|
||||
"aiken-lang",
|
||||
"askama",
|
||||
"fslock",
|
||||
"hex",
|
||||
"ignore",
|
||||
"itertools",
|
||||
|
@ -455,6 +456,14 @@ name = "funty"
|
|||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
|
||||
name = "fslock"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04412b8935272e3a9bae6f48c7bfff74c2911f60525404edfdd28e49884c3bfb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
|
|
|
@ -11,6 +11,7 @@ authors = ["Lucas Rosa <x@rvcas.dev>", "Kasey White <kwhitemsg@gmail.com>"]
|
|||
[dependencies]
|
||||
aiken-lang = { path = "../lang", version = "0.0.26" }
|
||||
askama = "0.10.5"
|
||||
fslock = "0.2.1"
|
||||
hex = "0.4.3"
|
||||
ignore = "0.4.18"
|
||||
itertools = "0.10.1"
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::{
|
||||
error::Error,
|
||||
paths,
|
||||
telemetry::{Event, EventListener},
|
||||
};
|
||||
|
||||
use self::manifest::Manifest;
|
||||
|
||||
pub mod manifest;
|
||||
|
||||
pub enum UseManifest {
|
||||
Yes,
|
||||
No,
|
||||
}
|
||||
|
||||
pub fn download<T>(
|
||||
event_listener: &T,
|
||||
new_package: Option<(Vec<String>, bool)>,
|
||||
use_manifest: UseManifest,
|
||||
root_path: &Path,
|
||||
) -> Result<Manifest, Error>
|
||||
where
|
||||
T: EventListener,
|
||||
{
|
||||
let build_path = root_path.join(paths::build());
|
||||
|
||||
let mut build_lock = fslock::LockFile::open(&build_path).expect("Build Lock Creation");
|
||||
|
||||
if !build_lock
|
||||
.try_lock_with_pid()
|
||||
.expect("Trying build locking")
|
||||
{
|
||||
event_listener.handle_event(Event::WaitingForBuildDirLock);
|
||||
|
||||
build_lock.lock_with_pid().expect("Build locking")
|
||||
}
|
||||
|
||||
todo!()
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
pub struct Manifest {
|
||||
pub requirements: HashMap<String, String>,
|
||||
pub packages: Vec<Package>,
|
||||
}
|
||||
|
||||
pub struct Package {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub requirements: Vec<String>,
|
||||
pub source: PackageSource,
|
||||
}
|
||||
|
||||
pub enum PackageSource {
|
||||
GitHub { url: String },
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
pub mod config;
|
||||
pub mod deps;
|
||||
pub mod docs;
|
||||
pub mod error;
|
||||
pub mod format;
|
||||
pub mod module;
|
||||
pub mod options;
|
||||
pub mod paths;
|
||||
pub mod pretty;
|
||||
pub mod script;
|
||||
pub mod telemetry;
|
||||
|
@ -17,6 +19,7 @@ use aiken_lang::{
|
|||
uplc::CodeGenerator,
|
||||
IdGenerator,
|
||||
};
|
||||
use deps::UseManifest;
|
||||
use miette::NamedSource;
|
||||
use options::{CodeGenMode, Options};
|
||||
use pallas::{
|
||||
|
@ -148,6 +151,8 @@ where
|
|||
}
|
||||
|
||||
pub fn compile(&mut self, options: Options) -> Result<(), Error> {
|
||||
let manifest = deps::download(&self.event_listener, None, UseManifest::Yes, &self.root)?;
|
||||
|
||||
self.event_listener
|
||||
.handle_event(Event::StartingCompilation {
|
||||
root: self.root.clone(),
|
||||
|
@ -718,7 +723,7 @@ where
|
|||
|
||||
let cbor_hex = hex::encode(&cbor);
|
||||
|
||||
fs::write(script_path, &cbor_hex)?;
|
||||
fs::write(script_path, cbor_hex)?;
|
||||
|
||||
// Create the payment script JSON file
|
||||
let payment_script_path = script_output_dir.join("payment_script.json");
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
pub fn build() -> PathBuf {
|
||||
PathBuf::from("build")
|
||||
}
|
|
@ -35,4 +35,5 @@ pub enum Event {
|
|||
FinishedTests {
|
||||
tests: Vec<EvalInfo>,
|
||||
},
|
||||
WaitingForBuildDirLock,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue