Skip to content

Commit

Permalink
[ADP-3288] Extract cardano-wallet-api cabal package (#4460)
Browse files Browse the repository at this point in the history
Another step in de-cluttering the `cardano-wallet` cabal.

As for HLS, with this PR opening together

- lib/benchmarks/exe/latency-bench.hs
- lib/integration/framework/Test/Integration/Framework/DSL.hs

should not create false positives of overlapping instances on the

- lib/api/src/Cardano/Wallet/Api/Types.hs

- [x] Extract `cardano-wallet-api-http` and `cardano-wallet` exe in the
new `cardano-wallet-api` cabal package

ADP-3288
  • Loading branch information
paolino authored Mar 19, 2024
2 parents e51fa9f + d66f8bb commit 1c6f193
Show file tree
Hide file tree
Showing 52 changed files with 615 additions and 181 deletions.
3 changes: 2 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ index-state:

packages:
lib/address-derivation-discovery
lib/api
lib/application-extras
lib/balance-tx/
lib/benchmarks/
Expand Down Expand Up @@ -273,7 +274,7 @@ package cardano-coin-selection
package cardano-wallet
tests: True

package cardano-wallet-api-http
package cardano-wallet-api
tests: True

package cardano-wallet-cli
Expand Down
10 changes: 5 additions & 5 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:exe:cardano-wallet -- --help
> cabal run cardano-wallet-api:exe:cardano-wallet -- --help
```

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

5. Build and run the test suites or benchmarks.
Expand All @@ -59,17 +59,17 @@

To run one of the unit test suites:
```console
> cabal run cardano-wallet:test:unit
> cabal run cardano-wallet-unit:test:unit
```

To run the DB benchmark:
```console
> cabal run cardano-wallet:bench:db
> cabal run cardano-wallet-benchmarks:bench:db
```

To run the integration test suite:
```console
> cabal run cardano-wallet:test:integration
> cabal run cardano-wallet-integration:test:integration
```

6. Install binaries from `./dist-newstyle/` into a system location:
Expand Down
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@

overlay = final: prev: {
cardanoWalletHaskellProject = self.legacyPackages.${final.system};
inherit (final.cardanoWalletHaskellProject.hsPkgs.cardano-wallet.components.exes) cardano-wallet;
inherit (final.cardanoWalletHaskellProject.hsPkgs.cardano-wallet-api.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 @@ -232,7 +232,7 @@
# Cardano wallet
cardano-wallet = import ./nix/release-build.nix {
inherit pkgs;
exe = project.hsPkgs.cardano-wallet.components.exes.cardano-wallet;
exe = project.hsPkgs.cardano-wallet-api.components.exes.cardano-wallet;
backend = self.cardano-node;
};
# Local test cluster and mock metadata server
Expand Down
14 changes: 7 additions & 7 deletions hie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ cradle:
- path: "lib/address-derivation-discovery/lib"
component: "lib:address-derivation-discovery"

- path: "lib/api/src"
component: "lib:cardano-wallet-api"

- path: "lib/api/exe/cardano-wallet.hs"
component: "cardano-wallet-api:exe:cardano-wallet"

- path: "lib/application-extras/lib"
component: "lib:cardano-wallet-application-extras"

Expand Down Expand Up @@ -183,17 +189,11 @@ cradle:
- path: "lib/wallet/src"
component: "lib:cardano-wallet"

- path: "lib/wallet/api/http"
component: "cardano-wallet:lib:cardano-wallet-api-http"

- path: "lib/wallet/mock-token-metadata/src"
component: "cardano-wallet:lib:mock-token-metadata"

- path: "lib/wallet/exe/cardano-wallet.hs"
component: "cardano-wallet:exe:cardano-wallet"

- path: "lib/wallet/./exe/mock-token-metadata-server.hs"
component: "cardano-wallet:exe:mock-token-metadata-server"
component: "cardano-wallet-api:exe:mock-token-metadata-server"

- path: "lib/wallet-benchmarks/bench/memory-benchmark.hs"
component: "cardano-wallet-blackbox-benchmarks:bench:memory"
Expand Down
177 changes: 177 additions & 0 deletions lib/api/cardano-wallet-api.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
cabal-version: 3.6
name: cardano-wallet-api
version: 2024.3.1
synopsis: Cardano wallet http api.
description: Please see README.md
homepage: https://github.com/cardano-foundation/cardano-wallet
author: Cardano Foundation (High Assurance Lab)
maintainer: hal@cardanofoundation.org
copyright: 2018-2022 IOHK, 2024 Cardano Foundation
license: Apache-2.0
category: Web
build-type: Simple

extra-source-files:
extra/Plutus/*.hs
specifications/api/swagger.yaml

common language
default-language: Haskell2010
default-extensions:
NoImplicitPrelude
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

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

flag release
description: Enable optimization and `-Werror`
default: False
manual: True

library
import: language, opts-lib
visibility: public
hs-source-dirs: src
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-core
, cardano-wallet
, cardano-wallet-launcher
, cardano-wallet-network-layer
, cardano-wallet-primitive
, cardano-wallet-read
, cardano-wallet-secrets
, containers
, contra-tracer
, crypto-primitives
, data-default
, deepseq
, directory
, either
, errors
, extra
, filepath
, fmt
, generic-lens
, hashable
, http-api-data
, http-client
, http-media
, http-types
, int-cast
, iohk-monitoring
, iohk-monitoring-extra ^>=0.1
, memory
, mtl
, network
, network-uri
, ntp-client
, OddWord
, optparse-applicative
, quiet
, random
, safe
, servant
, servant-client
, servant-client-core
, servant-server
, streaming-commons
, text
, text-class
, time
, tls
, transformers
, unliftio
, wai
, 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
Cardano.Wallet.Api.Client
Cardano.Wallet.Api.Clients.Testnet.Byron
Cardano.Wallet.Api.Clients.Testnet.Network
Cardano.Wallet.Api.Clients.Testnet.Shelley
Cardano.Wallet.Api.Hex
Cardano.Wallet.Api.Http.Logging
Cardano.Wallet.Api.Http.Server
Cardano.Wallet.Api.Http.Server.Error
Cardano.Wallet.Api.Http.Server.Handlers.MintBurn
Cardano.Wallet.Api.Http.Server.Handlers.TxCBOR
Cardano.Wallet.Api.Http.Server.Tls
Cardano.Wallet.Api.Http.Shelley.Server
Cardano.Wallet.Api.Lib.ApiAsArray
Cardano.Wallet.Api.Lib.ApiT
Cardano.Wallet.Api.Lib.ExtendedObject
Cardano.Wallet.Api.Lib.Options
Cardano.Wallet.Api.Link
Cardano.Wallet.Api.Types
Cardano.Wallet.Api.Types.Amount
Cardano.Wallet.Api.Types.BlockHeader
Cardano.Wallet.Api.Types.Certificate
Cardano.Wallet.Api.Types.Error
Cardano.Wallet.Api.Types.Key
Cardano.Wallet.Api.Types.MintBurn
Cardano.Wallet.Api.Types.Primitive
Cardano.Wallet.Api.Types.RestorationMode
Cardano.Wallet.Api.Types.SchemaMetadata
Cardano.Wallet.Api.Types.Transaction
Cardano.Wallet.Api.Types.WalletAsset
Cardano.Wallet.Api.Types.WalletAssets
Cardano.Wallet.Shelley
Cardano.Wallet.Tracers

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 1c6f193

Please sign in to comment.