Skip to content

Commit

Permalink
Further tweak feature flagging
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <[email protected]>
  • Loading branch information
Patrik-Stas committed Jul 28, 2023
1 parent 4ece588 commit 2426163
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 53 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ jobs:
run: |
cd did_resolver_sov
cargo check
cargo check --features vdrtools --no-default-features
cargo check --features modular_libs --no-default-features
check-aries-vcx-feature-variants:
runs-on: ubuntu-20.04
Expand All @@ -193,7 +191,7 @@ jobs:
cd aries_vcx
cargo check --no-default-features
cargo check --tests --all-features
cargo check --features vdrtools --no-default-features
cargo check --features vdrtools_lib --no-default-features
cargo check --features modular_libs --no-default-features
cargo check --features vdr_proxy_ledger --no-default-features
Expand Down Expand Up @@ -431,7 +429,7 @@ jobs:
strategy:
matrix:
features: [
"vdrtools",
"vdrtools_lib",
"modular_libs"
]
steps:
Expand Down
8 changes: 4 additions & 4 deletions aries_vcx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ path = "src/lib.rs"
doctest = false

[features]
default = ["vdrtools"]
vdrtools = ["aries_vcx_core/vdrtools_anoncreds", "aries_vcx_core/vdrtools_ledger", "aries_vcx_core/vdrtools_wallet"]
default = ["vdrtools_lib"]
vdrtools_lib = ["aries_vcx_core/vdrtools_anoncreds", "aries_vcx_core/vdrtools_ledger", "aries_vcx_core/vdrtools_wallet"]
# Feature flag to include the 'modular library' dependencies (vdrtools alternatives; indy-vdr, indy-credx)
modular_libs = ["aries_vcx_core/modular_libs"]
# TODO: Remove using "vdrtools" feature flag for vdr_proxy_ledger once IndyCredxAnonCreds
# is fully implemented
vdr_proxy_ledger = ["aries_vcx_core/vdr_proxy_ledger", "vdrtools"]
vdr_proxy_ledger = ["aries_vcx_core/vdr_proxy_ledger", "vdrtools_lib"]
# Used for testing the migrator
migration = ["vdrtools", "modular_libs"]
migration = ["vdrtools_lib", "modular_libs"]

[dependencies]
agency_client = { path = "../agency_client" }
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pub mod ledger;
pub mod primitives;
pub mod proofs;
pub mod signing;
#[cfg(feature = "vdrtools")]
#[cfg(feature = "vdrtools_lib")]
pub mod test_utils;
2 changes: 1 addition & 1 deletion aries_vcx/src/core/profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod modular_libs_profile;
pub mod profile;
#[cfg(feature = "vdr_proxy_ledger")]
pub mod vdr_proxy_profile;
#[cfg(feature = "vdrtools")]
#[cfg(feature = "vdrtools_lib")]
pub mod vdrtools_profile;

#[cfg(any(feature = "modular_libs", feature = "vdr_proxy_ledger"))]
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx/src/protocols/connection/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ mod connection_serde_tests {
use crate::protocols::connection::{invitee::InviteeConnection, inviter::InviterConnection, Connection};
use crate::utils::mockdata::profile::mock_ledger::MockLedger;
use crate::utils::mockdata::profile::mock_profile::MockProfile;
use crate::utils::mockdata::profile::mock_wallet::MockWallet;
use aries_vcx_core::ledger::base_ledger::IndyLedgerRead;
use aries_vcx_core::wallet::mock_wallet::MockWallet;
use std::sync::Arc;

impl<'a> From<RefInviteeState<'a>> for InviteeState {
Expand Down
6 changes: 3 additions & 3 deletions aries_vcx/src/utils/devsetup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::core::profile::modular_libs_profile::ModularLibsProfile;
#[cfg(feature = "modular_libs")]
use crate::core::profile::prepare_taa_options;
use crate::core::profile::profile::Profile;
#[cfg(feature = "vdrtools")]
#[cfg(feature = "vdrtools_lib")]
use crate::core::profile::vdrtools_profile::VdrtoolsProfile;
use crate::global::settings;
use crate::global::settings::{
Expand Down Expand Up @@ -127,7 +127,7 @@ pub fn make_modular_profile(wallet_handle: WalletHandle, genesis_file_path: Stri
impl SetupProfile {
pub async fn _build_setup_profile(genesis_file_path: String) -> SetupProfile {
// In case of migration test setup, we are starting with vdrtools, then we migrate
#[cfg(any(feature = "vdrtools", feature = "migration"))]
#[cfg(any(feature = "vdrtools_lib", feature = "migration"))]
return {
info!("SetupProfile >> using indy profile");
SetupProfile::build_profile_vdrtools(genesis_file_path).await
Expand Down Expand Up @@ -156,7 +156,7 @@ impl SetupProfile {
setup
}

#[cfg(feature = "vdrtools")]
#[cfg(feature = "vdrtools_lib")]
async fn build_profile_vdrtools(genesis_file_path: String) -> SetupProfile {
let pool_name = Uuid::new_v4().to_string();
create_pool_ledger_config(&pool_name, &genesis_file_path).unwrap();
Expand Down
3 changes: 2 additions & 1 deletion aries_vcx/src/utils/mockdata/profile/mock_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use aries_vcx_core::{
anoncreds::base_anoncreds::BaseAnonCreds,
ledger::base_ledger::{AnoncredsLedgerRead, AnoncredsLedgerWrite, IndyLedgerRead, IndyLedgerWrite},
wallet::base_wallet::BaseWallet,
wallet::mock_wallet::MockWallet,
};

use super::{mock_anoncreds::MockAnoncreds, mock_ledger::MockLedger, mock_wallet::MockWallet};
use super::{mock_anoncreds::MockAnoncreds, mock_ledger::MockLedger};
use crate::core::profile::profile::Profile;
use crate::errors::error::VcxResult;
use async_trait::async_trait;
Expand Down
1 change: 0 additions & 1 deletion aries_vcx/src/utils/mockdata/profile/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod mock_anoncreds;
pub mod mock_ledger;
pub mod mock_profile;
pub mod mock_wallet;
4 changes: 2 additions & 2 deletions aries_vcx/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::utils::encryption_envelope::EncryptionEnvelope;
use messages::AriesMessage;

#[macro_use]
#[cfg(feature = "vdrtools")]
#[cfg(feature = "vdrtools_lib")]
pub mod devsetup;

#[cfg(debug_assertions)]
Expand Down Expand Up @@ -47,7 +47,7 @@ pub mod constants;
pub mod file;
pub mod mockdata;
pub mod openssl;
#[cfg(feature = "vdrtools")]
#[cfg(feature = "vdrtools_lib")]
pub mod provision;
pub mod qualifier;
pub mod random;
Expand Down
1 change: 0 additions & 1 deletion aries_vcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"
[features]
########################## DEP FLAGS ################################
# Feature flag to include the libvdrtools dependency
vdrtools = ["vdrtools_anoncreds", "vdrtools_wallet", "vdrtools_ledger"]
vdrtools_anoncreds = ["dep:libvdrtools"]
vdrtools_wallet = ["dep:libvdrtools"]
vdrtools_ledger = ["dep:libvdrtools"]
Expand Down
12 changes: 2 additions & 10 deletions aries_vcx_core/src/errors/mapping_vdrtools.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
use vdrtools::types::{
// todo: import this directly from indy-api-types
use indy_ledger_response_parser::{
errors::{IndyError, IndyErrorKind},
ErrorCode,
};

// #[cfg(all(
// not(feature = "vdrtools"),
// any(feature = "modular_libs", feature = "vdr_proxy_ledger")
// ))]
// use indy_ledger_response_parser::{
// errors::{IndyError, IndyErrorKind},
// ErrorCode,
// };

use crate::errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind};

impl From<IndyErrorKind> for AriesVcxCoreErrorKind {
Expand Down
1 change: 0 additions & 1 deletion aries_vcx_core/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ mod mapping_indyvdr;
#[cfg(feature = "vdr_proxy_ledger")]
mod mapping_indyvdr_proxy;
mod mapping_others;
#[cfg(any(feature = "vdrtools_wallet", feature = "vdrtools_ledger", feature = "vdrtools_anoncreds", feature = "vdr_proxy_ledger"))]
mod mapping_vdrtools;
15 changes: 10 additions & 5 deletions aries_vcx_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,21 @@ extern crate derive_builder;
pub mod anoncreds;
pub mod errors;
pub mod global;
#[cfg(any(feature = "vdrtools_anoncreds", feature = "vdrtools_ledger"))]
#[cfg(any(
feature = "vdrtools_anoncreds",
feature = "vdrtools_ledger",
feature = "vdrtools_wallet"
))]
pub mod indy;
pub mod ledger;
pub mod utils;
pub mod wallet;

#[cfg(any(feature = "vdrtools_anoncreds", feature = "vdrtools_ledger"))]
pub use vdrtools::{
PoolHandle, SearchHandle, WalletHandle, INVALID_POOL_HANDLE, INVALID_SEARCH_HANDLE, INVALID_WALLET_HANDLE,
};
#[cfg(feature = "vdrtools_ledger")]
pub use vdrtools::{PoolHandle, INVALID_POOL_HANDLE};

#[cfg(feature = "vdrtools_wallet")]
pub use vdrtools::{SearchHandle, WalletHandle, INVALID_SEARCH_HANDLE, INVALID_WALLET_HANDLE};

#[cfg(feature = "vdr_proxy_ledger")]
pub use indy_vdr_proxy_client::VdrProxyClient;
Expand Down
2 changes: 1 addition & 1 deletion aries_vcx_core/src/wallet/base_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
use async_trait::async_trait;

#[cfg(feature = "vdrtools_wallet")]
use vdrtools::WalletHandle;
use crate::WalletHandle;

use crate::errors::error::VcxCoreResult;
use crate::utils::async_fn_iterator::AsyncFnIterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use aries_vcx_core::errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind, VcxCoreResult};
use aries_vcx_core::utils::async_fn_iterator::AsyncFnIterator;
use aries_vcx_core::wallet::base_wallet::BaseWallet;
use std::collections::HashMap;

use async_trait::async_trait;

use crate::errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind, VcxCoreResult};
use crate::utils::async_fn_iterator::AsyncFnIterator;
use crate::utils::{self};
#[cfg(feature = "vdrtools")]
use aries_vcx_core::WalletHandle;
use std::collections::HashMap;
use crate::wallet::base_wallet::BaseWallet;
#[cfg(feature = "vdrtools_wallet")]
use crate::WalletHandle;

#[derive(Debug)]
pub struct MockWallet;
Expand All @@ -16,7 +17,7 @@ pub struct MockWallet;
#[allow(unused)]
#[async_trait]
impl BaseWallet for MockWallet {
#[cfg(feature = "vdrtools")]
#[cfg(feature = "vdrtools_wallet")]
fn get_wallet_handle(&self) -> WalletHandle {
WalletHandle(1)
}
Expand Down
1 change: 1 addition & 0 deletions aries_vcx_core/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pub mod agency_client_wallet;
pub mod base_wallet;
#[cfg(feature = "vdrtools_wallet")]
pub mod indy;
pub mod mock_wallet;
7 changes: 1 addition & 6 deletions did_resolver_sov/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ name = "did_resolver_sov"
version = "0.1.0"
edition = "2021"

[features]
default = []
vdrtools = ["aries_vcx_core/vdrtools"]
modular_libs = ["aries_vcx_core/modular_libs"]

[dependencies]
did_resolver = { path = "../did_resolver" }
aries_vcx_core = { path = "../aries_vcx_core" }
aries_vcx_core = { path = "../aries_vcx_core", features = ["modular_libs"] }
did_doc_sov = { path = "../did_doc_sov" }
async-trait = "0.1.68"
mockall = "0.11.4"
Expand Down
4 changes: 2 additions & 2 deletions libvcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ edition.workspace = true
fatal_warnings = []

ledger_indyvdr = ["aries-vcx/modular_libs"]
ledger_vdrtools = ["aries-vcx/vdrtools"]
ledger_vdrtools = ["aries-vcx/vdrtools_lib"]

anoncreds_credx = ["aries-vcx/modular_libs"]
anoncreds_vdrtools = ["aries-vcx/vdrtools"]
anoncreds_vdrtools = ["aries-vcx/vdrtools_lib"]

[dependencies]
num-traits = "0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion libvcx_core/src/api_vcx/api_global/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ use aries_vcx::aries_vcx_core::ledger::base_ledger::{
AnoncredsLedgerRead, AnoncredsLedgerWrite, IndyLedgerRead, IndyLedgerWrite, TxnAuthrAgrmtOptions,
};
use aries_vcx::aries_vcx_core::wallet::indy::IndySdkWallet;
use aries_vcx::aries_vcx_core::wallet::mock_wallet::MockWallet;
use aries_vcx::aries_vcx_core::{wallet::base_wallet::BaseWallet, WalletHandle};
use aries_vcx::core::profile::{profile::Profile, vdrtools_profile::VdrtoolsProfile};
use aries_vcx::errors::error::VcxResult;
use aries_vcx::utils::mockdata::profile::mock_anoncreds::MockAnoncreds;
use aries_vcx::utils::mockdata::profile::mock_ledger::MockLedger;
use aries_vcx::utils::mockdata::profile::mock_wallet::MockWallet;
use aries_vcx::{global::settings::indy_mocks_enabled, utils::mockdata::profile::mock_profile::MockProfile};

pub trait ProfileV2: Send + Sync {
Expand Down
2 changes: 1 addition & 1 deletion wallet_migrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
aries_vcx_core = { path = "../aries_vcx_core", features = ["modular_libs"] }
aries_vcx_core = { path = "../aries_vcx_core", features = ["vdrtools_wallet", "modular_libs"] }
credx = { package = "indy-credx", git = "https://github.com/anonyome/indy-shared-rs.git", rev = "7342bc624d23ece8845d1a701cd2cdc9cd401bb0" }
vdrtools = { package = "libvdrtools", path = "../libvdrtools" }
serde_json = "1.0.96"
Expand Down

0 comments on commit 2426163

Please sign in to comment.