Skip to content

Commit

Permalink
[ADP-3339] Extract cardano wallet exe from api package (#4707)
Browse files Browse the repository at this point in the history
This PR is necessary to incorporate the web ui service into the cardano
wallet application without polluting the `api` package even more. In
fact I'm moving all non-API related modules from the `api` package to
the `exe` package.

- [x] Move `Cardano.Wallet.Shelley`,` Cardano.CLI`,
`Cardano.Wallet.Version`, `Cardano.Wallet.Tracers` to a new `exe`
internal lib.
- [x] Rename them so they form the `Cardano.Wallet.Application`
namespace

ADP-3339
  • Loading branch information
paolino authored Jul 30, 2024
2 parents 4b711d4 + dc08164 commit 5a90eb6
Show file tree
Hide file tree
Showing 35 changed files with 955 additions and 636 deletions.
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ packages:
lib/delta-store/
lib/delta-table/
lib/delta-types/
lib/exe/
lib/faucet/
lib/iohk-monitoring-extra/
lib/integration/
Expand Down
4 changes: 2 additions & 2 deletions docs/site/src/contributor/what/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
As an example, this will show the help page:

```console
> cabal run cardano-wallet-api:exe:cardano-wallet -- --help
> cabal run cardano-wallet-exe:exe:cardano-wallet -- --help
```

4. Make a build with `-O2` level compiler optimizations:
```console
> cabal build cardano-wallet-api:exe:cardano-wallet -frelease
> cabal build cardano-wallet-exe:exe:cardano-wallet -frelease
```

5. Build and run the test suites or benchmarks.
Expand Down
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

overlay = final: prev: {
cardanoWalletHaskellProject = self.legacyPackages.${final.system};
inherit (final.cardanoWalletHaskellProject.hsPkgs.cardano-wallet-api.components.exes) cardano-wallet;
inherit (final.cardanoWalletHaskellProject.hsPkgs.cardano-wallet-exe.components.exes) cardano-wallet;
haskell-nix = prev.haskell-nix // {
extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings // {
# String pkgconfig-depends names are mapped to lists of Nixpkgs
Expand Down Expand Up @@ -231,7 +231,7 @@
# Cardano wallet
cardano-wallet = import ./nix/release-build.nix {
inherit pkgs;
exe = project.hsPkgs.cardano-wallet-api.components.exes.cardano-wallet;
exe = project.hsPkgs.cardano-wallet-exe.components.exes.cardano-wallet;
backend = self.cardano-node;
};
# Local test cluster and mock metadata server
Expand Down
53 changes: 2 additions & 51 deletions lib/api/cardano-wallet-api.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.6
name: cardano-wallet-api
version: 2024.7.27
version: 0.2024.7.27
synopsis: Cardano wallet http api.
description: Please see README.md
homepage: https://github.com/cardano-foundation/cardano-wallet
Expand All @@ -22,13 +22,7 @@ common language
OverloadedStrings

common opts-lib
ghc-options: -Wall -Wcompat -Wredundant-constraints

if flag(release)
ghc-options: -O2 -Werror

common opts-exe
ghc-options: -threaded -rtsopts -Wall -Wredundant-constraints
ghc-options: -Wall -Wcompat -Wredundant-constraints -Wunused-packages

if flag(release)
ghc-options: -O2 -Werror
Expand All @@ -44,22 +38,16 @@ library
build-depends:
, address-derivation-discovery
, aeson
, aeson-pretty
, ansi-terminal
, base
, bech32
, bech32-th
, binary
, bytestring
, cardano-addresses
, cardano-addresses-cli
, cardano-api:{cardano-api, internal}
, cardano-balance-tx:{cardano-balance-tx, internal}
, cardano-binary
, cardano-crypto
, cardano-ledger-alonzo
, cardano-ledger-babbage
, cardano-ledger-conway
, cardano-ledger-core
, cardano-wallet
, cardano-wallet-launcher
Expand All @@ -72,38 +60,29 @@ library
, crypto-primitives
, data-default
, deepseq
, directory
, either
, errors
, extra
, file-embed
, filepath
, fmt
, generic-lens
, hashable
, http-api-data
, http-client
, http-media
, http-types
, int-cast
, iohk-monitoring
, iohk-monitoring-extra
, memory
, mtl
, network
, network-uri
, ntp-client
, OddWord
, optparse-applicative
, quiet
, random
, safe
, servant
, servant-client
, servant-client-core
, servant-server
, streaming-commons
, template-haskell
, text
, text-class
, time
Expand All @@ -114,13 +93,11 @@ library
, wai-middleware-logging
, warp
, warp-tls
, Win32-network
, x509
, x509-store
, x509-validation

exposed-modules:
Cardano.CLI
Cardano.Wallet.Api
Cardano.Wallet.Api.Aeson
Cardano.Wallet.Api.Aeson.Variant
Expand Down Expand Up @@ -160,31 +137,5 @@ library
Cardano.Wallet.Api.Types.Transaction
Cardano.Wallet.Api.Types.WalletAsset
Cardano.Wallet.Api.Types.WalletAssets
Cardano.Wallet.Shelley
Cardano.Wallet.Tracers
Cardano.Wallet.Version
Cardano.Wallet.Version.TH
other-modules:
Paths_cardano_wallet_api

executable cardano-wallet
import: language, opts-exe
hs-source-dirs: exe
main-is: cardano-wallet.hs
build-depends:
, base
, cardano-wallet
, cardano-wallet-api
, cardano-wallet-launcher
, cardano-wallet-network-layer
, contra-tracer
, iohk-monitoring
, iohk-monitoring-extra
, lobemo-backend-ekg
, network-uri
, optparse-applicative
, text
, text-class
, transformers
, unliftio
, with-utf8
Loading

0 comments on commit 5a90eb6

Please sign in to comment.