From cfb627d468cbd18ba9b76515a496d975693a33e8 Mon Sep 17 00:00:00 2001 From: howardwu Date: Sun, 2 Aug 2020 22:18:03 -0700 Subject: [PATCH] Migrate files to an inputs directory in package --- leo/commands/build.rs | 3 ++- leo/commands/init.rs | 5 +++-- leo/commands/new.rs | 5 +++-- leo/commands/test.rs | 3 ++- package/src/directories/mod.rs | 3 --- package/src/errors/directory/mod.rs | 3 --- package/src/errors/files/mod.rs | 6 ------ .../errors/{directory/input.rs => inputs/directory.rs} | 0 package/src/errors/{files => inputs}/input.rs | 0 package/src/errors/inputs/mod.rs | 8 ++++++++ package/src/errors/{files => inputs}/state.rs | 0 package/src/errors/mod.rs | 3 +++ package/src/files/mod.rs | 6 ------ package/src/files/zip.rs | 4 ++-- package/src/{directories/input.rs => inputs/directory.rs} | 0 package/src/{files => inputs}/input.rs | 2 +- package/src/inputs/mod.rs | 8 ++++++++ package/src/{files => inputs}/state.rs | 2 +- package/src/lib.rs | 1 + 19 files changed, 34 insertions(+), 28 deletions(-) rename package/src/errors/{directory/input.rs => inputs/directory.rs} (100%) rename package/src/errors/{files => inputs}/input.rs (100%) create mode 100644 package/src/errors/inputs/mod.rs rename package/src/errors/{files => inputs}/state.rs (100%) rename package/src/{directories/input.rs => inputs/directory.rs} (100%) rename package/src/{files => inputs}/input.rs (95%) create mode 100644 package/src/inputs/mod.rs rename package/src/{files => inputs}/state.rs (96%) diff --git a/leo/commands/build.rs b/leo/commands/build.rs index 7702257f07..16f3d96311 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -2,7 +2,8 @@ use crate::{cli::*, cli_types::*, errors::CLIError}; use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; use leo_package::{ directories::{source::SOURCE_DIRECTORY_NAME, OutputDirectory, OUTPUT_DIRECTORY_NAME}, - files::{ChecksumFile, InputFile, LibFile, MainFile, Manifest, StateFile, LIB_FILE_NAME, MAIN_FILE_NAME}, + files::{ChecksumFile, LibFile, MainFile, Manifest, LIB_FILE_NAME, MAIN_FILE_NAME}, + inputs::*, }; use snarkos_algorithms::snark::groth16::KeypairAssembly; diff --git a/leo/commands/init.rs b/leo/commands/init.rs index a5e8b2c044..79e3e6b43b 100644 --- a/leo/commands/init.rs +++ b/leo/commands/init.rs @@ -4,8 +4,9 @@ use crate::{ errors::{CLIError, InitError}, }; use leo_package::{ - directories::{InputDirectory, SourceDirectory}, - files::{Gitignore, InputFile, LibFile, MainFile, Manifest}, + directories::SourceDirectory, + files::{Gitignore, LibFile, MainFile, Manifest}, + inputs::*, }; use clap::ArgMatches; diff --git a/leo/commands/new.rs b/leo/commands/new.rs index 7c04e16433..0d966aaf40 100644 --- a/leo/commands/new.rs +++ b/leo/commands/new.rs @@ -4,8 +4,9 @@ use crate::{ errors::{CLIError, NewError}, }; use leo_package::{ - directories::{InputDirectory, SourceDirectory}, - files::{Gitignore, InputFile, LibFile, MainFile, Manifest}, + directories::SourceDirectory, + files::{Gitignore, LibFile, MainFile, Manifest}, + inputs::*, }; use clap::ArgMatches; diff --git a/leo/commands/test.rs b/leo/commands/test.rs index d226847fff..740388f6cf 100644 --- a/leo/commands/test.rs +++ b/leo/commands/test.rs @@ -6,7 +6,8 @@ use crate::{ use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; use leo_package::{ directories::{output::OUTPUT_DIRECTORY_NAME, source::SOURCE_DIRECTORY_NAME}, - files::{InputFile, MainFile, Manifest, StateFile, MAIN_FILE_NAME}, + files::{MainFile, Manifest, MAIN_FILE_NAME}, + inputs::*, }; use snarkos_curves::edwards_bls12::Fq; diff --git a/package/src/directories/mod.rs b/package/src/directories/mod.rs index c6ad59e6c8..232d70dba1 100644 --- a/package/src/directories/mod.rs +++ b/package/src/directories/mod.rs @@ -1,9 +1,6 @@ pub mod imports; pub use self::imports::*; -pub mod input; -pub use self::input::*; - pub mod output; pub use self::output::*; diff --git a/package/src/errors/directory/mod.rs b/package/src/errors/directory/mod.rs index c6ad59e6c8..232d70dba1 100644 --- a/package/src/errors/directory/mod.rs +++ b/package/src/errors/directory/mod.rs @@ -1,9 +1,6 @@ pub mod imports; pub use self::imports::*; -pub mod input; -pub use self::input::*; - pub mod output; pub use self::output::*; diff --git a/package/src/errors/files/mod.rs b/package/src/errors/files/mod.rs index 1d9dafd21e..ed1c111b88 100644 --- a/package/src/errors/files/mod.rs +++ b/package/src/errors/files/mod.rs @@ -7,9 +7,6 @@ pub use self::checksum::*; pub mod gitignore; pub use self::gitignore::*; -pub mod input; -pub use self::input::*; - pub mod lib; pub use self::lib::*; @@ -25,8 +22,5 @@ pub use self::proof::*; pub mod proving_key; pub use self::proving_key::*; -pub mod state; -pub use self::state::*; - pub mod verification_key; pub use self::verification_key::*; diff --git a/package/src/errors/directory/input.rs b/package/src/errors/inputs/directory.rs similarity index 100% rename from package/src/errors/directory/input.rs rename to package/src/errors/inputs/directory.rs diff --git a/package/src/errors/files/input.rs b/package/src/errors/inputs/input.rs similarity index 100% rename from package/src/errors/files/input.rs rename to package/src/errors/inputs/input.rs diff --git a/package/src/errors/inputs/mod.rs b/package/src/errors/inputs/mod.rs new file mode 100644 index 0000000000..504289bc48 --- /dev/null +++ b/package/src/errors/inputs/mod.rs @@ -0,0 +1,8 @@ +pub mod directory; +pub use directory::*; + +pub mod input; +pub use input::*; + +pub mod state; +pub use state::*; diff --git a/package/src/errors/files/state.rs b/package/src/errors/inputs/state.rs similarity index 100% rename from package/src/errors/files/state.rs rename to package/src/errors/inputs/state.rs diff --git a/package/src/errors/mod.rs b/package/src/errors/mod.rs index e34227ad42..70166cd620 100644 --- a/package/src/errors/mod.rs +++ b/package/src/errors/mod.rs @@ -3,3 +3,6 @@ pub use self::directory::*; pub mod files; pub use self::files::*; + +pub mod inputs; +pub use inputs::*; diff --git a/package/src/files/mod.rs b/package/src/files/mod.rs index c073a2b825..ed1c111b88 100644 --- a/package/src/files/mod.rs +++ b/package/src/files/mod.rs @@ -4,9 +4,6 @@ pub use self::zip::*; pub mod checksum; pub use self::checksum::*; -pub mod input; -pub use self::input::*; - pub mod gitignore; pub use self::gitignore::*; @@ -25,8 +22,5 @@ pub use self::proof::*; pub mod proving_key; pub use self::proving_key::*; -pub mod state; -pub use self::state::*; - pub mod verification_key; pub use self::verification_key::*; diff --git a/package/src/files/zip.rs b/package/src/files/zip.rs index f6fffde7b2..a021159839 100644 --- a/package/src/files/zip.rs +++ b/package/src/files/zip.rs @@ -1,15 +1,15 @@ //! The program package zip file. use crate::{ - directories::{IMPORTS_DIRECTORY_NAME, INPUT_DIRECTORY_NAME, OUTPUT_DIRECTORY_NAME}, + directories::{IMPORTS_DIRECTORY_NAME, OUTPUT_DIRECTORY_NAME}, errors::ZipFileError, files::{ CHECKSUM_FILE_EXTENSION, - INPUT_FILE_EXTENSION, PROOF_FILE_EXTENSION, PROVING_KEY_FILE_EXTENSION, VERIFICATION_KEY_FILE_EXTENSION, }, + inputs::{INPUT_DIRECTORY_NAME, INPUT_FILE_EXTENSION}, }; use serde::Deserialize; diff --git a/package/src/directories/input.rs b/package/src/inputs/directory.rs similarity index 100% rename from package/src/directories/input.rs rename to package/src/inputs/directory.rs diff --git a/package/src/files/input.rs b/package/src/inputs/input.rs similarity index 95% rename from package/src/files/input.rs rename to package/src/inputs/input.rs index c6ead5cde2..56c741ab79 100644 --- a/package/src/files/input.rs +++ b/package/src/inputs/input.rs @@ -1,6 +1,6 @@ //! The `program.in` file. -use crate::{directories::input::INPUT_DIRECTORY_NAME, errors::InputFileError}; +use crate::{errors::InputFileError, inputs::INPUT_DIRECTORY_NAME}; use serde::Deserialize; use std::{ diff --git a/package/src/inputs/mod.rs b/package/src/inputs/mod.rs new file mode 100644 index 0000000000..504289bc48 --- /dev/null +++ b/package/src/inputs/mod.rs @@ -0,0 +1,8 @@ +pub mod directory; +pub use directory::*; + +pub mod input; +pub use input::*; + +pub mod state; +pub use state::*; diff --git a/package/src/files/state.rs b/package/src/inputs/state.rs similarity index 96% rename from package/src/files/state.rs rename to package/src/inputs/state.rs index a5a0816aa6..791d8b959d 100644 --- a/package/src/files/state.rs +++ b/package/src/inputs/state.rs @@ -1,6 +1,6 @@ //! The `program.state` file. -use crate::{directories::input::INPUT_DIRECTORY_NAME, errors::StateFileError}; +use crate::{errors::StateFileError, inputs::INPUT_DIRECTORY_NAME}; use serde::Deserialize; use std::{ diff --git a/package/src/lib.rs b/package/src/lib.rs index 49ed81049e..ce32f7a266 100644 --- a/package/src/lib.rs +++ b/package/src/lib.rs @@ -6,3 +6,4 @@ pub use errors::*; pub mod directories; pub mod files; +pub mod inputs;