Move compile-time build info to aiken-project

So that we can use it as part of the blueprints.
This commit is contained in:
KtorZ
2023-10-06 14:08:47 +02:00
parent bd61a2ddf3
commit d56d5180cf
8 changed files with 40 additions and 48 deletions

View File

@@ -12,7 +12,6 @@ authors = [
"KtorZ <matthias.benkort@gmail.com>",
]
rust-version = "1.66.1"
build = "build.rs"
[dependencies]
anyhow = "1.0.69"
@@ -44,6 +43,3 @@ clap_complete = "4.3.2"
inquire = "0.6.2"
num-bigint = "0.4.3"
ordinal = "0.3.2"
[build-dependencies]
built = { version = "0.6.0", features = ["git2"] }

View File

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

View File

@@ -1,3 +1,4 @@
use aiken_project::config;
use clap::Parser;
pub mod blueprint;
@@ -12,11 +13,9 @@ pub mod packages;
pub mod tx;
pub mod uplc;
use crate::built_info;
/// Aiken: a smart-contract language and toolchain for Cardano
#[derive(Parser)]
#[clap(version = version(), about, long_about = None)]
#[clap(version = config::compiler_version(true), about, long_about = None)]
#[clap(propagate_version = true)]
pub enum Cmd {
New(new::Args),
@@ -51,11 +50,3 @@ impl Default for Cmd {
Self::parse()
}
}
fn version() -> String {
format!(
"v{} {}",
built_info::PKG_VERSION,
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("unknown")
)
}

View File

@@ -1,5 +1,5 @@
use aiken_project::{
config::Config,
config::{self, Config},
package_name::{self, PackageName},
};
use indoc::{formatdoc, indoc};
@@ -11,8 +11,6 @@ use std::{
str::FromStr,
};
use crate::built_info;
#[derive(clap::Args)]
/// Create a new Aiken project
pub struct Args {
@@ -196,13 +194,13 @@ fn create_github_action(root: &Path) -> miette::Result<()> {
- uses: aiken-lang/setup-aiken@v0.1.0
with:
version: v{version}
version: {version}
- run: aiken fmt --check
- run: aiken check -D
- run: aiken build
"#,
version = built_info::PKG_VERSION,
version = config::compiler_version(false),
},
)
.into_diagnostic()?;

View File

@@ -14,10 +14,6 @@ use uplc::machine::cost_model::ExBudget;
pub mod cmd;
pub mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}
pub fn with_project<A>(directory: Option<PathBuf>, deny: bool, mut action: A) -> miette::Result<()>
where
A: FnMut(&mut Project<Terminal>) -> Result<(), Vec<aiken_project::error::Error>>,