mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-26 19:11:50 +03:00
Merge #676
676: [CLI, PM] Inputs are now published with source code r=collinc97 a=damirka Fixes #637 - now inputs are published to Aleo PM - error json message is printed to user ## Motivation We're unable to publish packages to PM, this PR fixes that. ## Test Plan TBD: CI for publishing Co-authored-by: damirka <damirka.ru@gmail.com>
This commit is contained in:
commit
077d0f76f1
@ -119,14 +119,17 @@ impl Command for Publish {
|
||||
.send();
|
||||
|
||||
// Get a response result
|
||||
let result = match response {
|
||||
Ok(json_result) => match json_result.json::<ResponseJson>() {
|
||||
let result: ResponseJson = match response {
|
||||
Ok(json_result) => {
|
||||
let text = json_result.text()?;
|
||||
|
||||
match serde_json::from_str(&text) {
|
||||
Ok(json) => json,
|
||||
Err(error) => {
|
||||
tracing::warn!("{:?}", error);
|
||||
return Err(anyhow!("Package not published"));
|
||||
Err(_) => {
|
||||
return Err(anyhow!("Package not published: {}", text));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(error) => {
|
||||
tracing::warn!("{:?}", error);
|
||||
return Err(anyhow!("Connection unavailable"));
|
||||
|
@ -19,7 +19,7 @@
|
||||
use crate::{
|
||||
errors::ZipFileError,
|
||||
imports::IMPORTS_DIRECTORY_NAME,
|
||||
inputs::{INPUTS_DIRECTORY_NAME, INPUT_FILE_EXTENSION},
|
||||
inputs::{INPUTS_DIRECTORY_NAME, INPUT_FILE_EXTENSION, STATE_FILE_EXTENSION},
|
||||
outputs::{
|
||||
CHECKSUM_FILE_EXTENSION,
|
||||
CIRCUIT_FILE_EXTENSION,
|
||||
@ -151,9 +151,8 @@ impl ZipFile {
|
||||
|
||||
/// Check if the file path should be included in the package zip file.
|
||||
fn is_included(path: &Path) -> bool {
|
||||
// excluded directories: `input`, `output`, `imports`
|
||||
if path.ends_with(INPUTS_DIRECTORY_NAME.trim_end_matches('/'))
|
||||
| path.ends_with(OUTPUTS_DIRECTORY_NAME.trim_end_matches('/'))
|
||||
// excluded directories: `output`, `imports`
|
||||
if path.ends_with(OUTPUTS_DIRECTORY_NAME.trim_end_matches('/'))
|
||||
| path.ends_with(IMPORTS_DIRECTORY_NAME.trim_end_matches('/'))
|
||||
{
|
||||
return false;
|
||||
@ -161,8 +160,7 @@ fn is_included(path: &Path) -> bool {
|
||||
|
||||
// excluded extensions: `.in`, `.bytes`, `lpk`, `lvk`, `.proof`, `.sum`, `.zip`, `.bytes`
|
||||
if let Some(true) = path.extension().map(|ext| {
|
||||
ext.eq(INPUT_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(ZIP_FILE_EXTENSION.trim_start_matches('.'))
|
||||
ext.eq(ZIP_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(PROVING_KEY_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(VERIFICATION_KEY_FILE_EXTENSION.trim_start_matches('.'))
|
||||
| ext.eq(PROOF_FILE_EXTENSION.trim_start_matches('.'))
|
||||
@ -173,6 +171,18 @@ fn is_included(path: &Path) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Allow `inputs` folder
|
||||
if path.ends_with(INPUTS_DIRECTORY_NAME.trim_end_matches('/')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow `.state` and `.in` files
|
||||
if let Some(true) = path.extension().map(|ext| {
|
||||
ext.eq(INPUT_FILE_EXTENSION.trim_start_matches('.')) | ext.eq(STATE_FILE_EXTENSION.trim_start_matches('.'))
|
||||
}) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow the README.md and Leo.toml files in the root directory
|
||||
if (path.ends_with(README_FILENAME) | path.ends_with(MANIFEST_FILENAME)) & (path.parent() == Some(Path::new(""))) {
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user