Skip to content

Commit

Permalink
Merge pull request #748 from IntersectMBO/merge-internal-lib
Browse files Browse the repository at this point in the history
Merge `cardano-api:internal` with `cardano-api` main library under `Cardano.Api.Internal.*` and export required symbols
  • Loading branch information
palas authored Feb 10, 2025
2 parents 8b5f077 + 8e1c59b commit ab6fc23
Show file tree
Hide file tree
Showing 203 changed files with 1,009 additions and 1,029 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
e28fadbebc18b87991f84af72d8611393ae8875a
b76f949e815990545371530a466b16f691a3aa98
73fd9122f78282b1db7f6884b3bc23fb29f3e67f
7634a9e8235050a55e5e3022a22a550aa3ade06e
256 changes: 117 additions & 139 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,114 +51,49 @@ common text
else
build-depends: text >=2.0

library internal
library
import: project-config, maybe-unix, maybe-Win32, text
visibility: public
hs-source-dirs: internal
hs-source-dirs:
src

-- Do not expose any additional modules. The correct way
-- to expose new functionality is via Cardano.Api or
-- Cardano.Api.Shelley
exposed-modules:
Cardano.Api.Address
Cardano.Api.Anchor
Cardano.Api.Block
Cardano.Api.Certificate
Cardano.Api.Convenience.Construction
Cardano.Api.Convenience.Query
Cardano.Api.DRepMetadata
Cardano.Api.DeserialiseAnyOf
Cardano.Api.Eon.AllegraEraOnwards
Cardano.Api.Eon.AlonzoEraOnwards
Cardano.Api.Eon.BabbageEraOnwards
Cardano.Api.Eon.ByronToAlonzoEra
Cardano.Api.Eon.Convert
Cardano.Api.Eon.ConwayEraOnwards
Cardano.Api.Eon.MaryEraOnwards
Cardano.Api.Eon.ShelleyBasedEra
Cardano.Api.Eon.ShelleyEraOnly
Cardano.Api.Eon.ShelleyToAllegraEra
Cardano.Api.Eon.ShelleyToAlonzoEra
Cardano.Api.Eon.ShelleyToBabbageEra
Cardano.Api.Eon.ShelleyToMaryEra
Cardano.Api.Eras
Cardano.Api.Eras.Case
Cardano.Api.Eras.Core
Cardano.Api.Error
Cardano.Api.Experimental.Eras
Cardano.Api.Experimental.Tx
Cardano.Api.Feature
Cardano.Api.Fees
Cardano.Api.Genesis
Cardano.Api.GenesisParameters
Cardano.Api.Governance.Actions.ProposalProcedure
Cardano.Api.Governance.Actions.VotingProcedure
Cardano.Api.Governance.Metadata.DrepRegistration
Cardano.Api.Governance.Metadata.GovAction
Cardano.Api.Governance.Metadata.Parsers
Cardano.Api.Governance.Metadata.Validation
Cardano.Api.Governance.Poll
Cardano.Api.HasTypeProxy
Cardano.Api.Hash
Cardano.Api.IO
Cardano.Api.IO.Base
Cardano.Api.IO.Compat
Cardano.Api.IO.Compat.Posix
Cardano.Api.IO.Compat.Win32
Cardano.Api.IPC
Cardano.Api.IPC.Monad
Cardano.Api.IPC.Version
Cardano.Api.InMode
Cardano.Api.Json
Cardano.Api.Keys.Byron
Cardano.Api.Keys.Class
Cardano.Api.Keys.Praos
Cardano.Api.Keys.Read
Cardano.Api.Keys.Shelley
Cardano.Api
Cardano.Api.Byron
Cardano.Api.ChainSync.Client
Cardano.Api.ChainSync.ClientPipelined
Cardano.Api.Compatible
Cardano.Api.Consensus
Cardano.Api.Crypto.Ed25519Bip32
Cardano.Api.Experimental
Cardano.Api.Internal.Address
Cardano.Api.Internal.Block
Cardano.Api.Internal.DRepMetadata
Cardano.Api.Internal.Eon.ShelleyBasedEra
Cardano.Api.Internal.Eras
Cardano.Api.Internal.Error
Cardano.Api.Internal.Fees
Cardano.Api.Internal.Genesis
Cardano.Api.Internal.GenesisParameters
Cardano.Api.Internal.Governance.Metadata.Validation
Cardano.Api.Internal.IO
Cardano.Api.Internal.LedgerState
Cardano.Api.Internal.Modes
Cardano.Api.Internal.Orphans
Cardano.Api.Internal.Plutus
Cardano.Api.Internal.Pretty
Cardano.Api.Internal.ProtocolParameters
Cardano.Api.Internal.Query
Cardano.Api.Internal.Script
Cardano.Api.Internal.SerialiseLedgerCddl
Cardano.Api.Internal.SerialiseTextEnvelope
Cardano.Api.Internal.Tx.Sign
Cardano.Api.Ledger
Cardano.Api.Ledger.Lens
Cardano.Api.LedgerEvents.ConvertLedgerEvent
Cardano.Api.LedgerEvents.LedgerEvent
Cardano.Api.LedgerEvents.Rule.BBODY.DELEGS
Cardano.Api.LedgerEvents.Rule.BBODY.LEDGER
Cardano.Api.LedgerEvents.Rule.BBODY.UTXOW
Cardano.Api.LedgerEvents.Rule.TICK.NEWEPOCH
Cardano.Api.LedgerEvents.Rule.TICK.RUPD
Cardano.Api.LedgerState
Cardano.Api.Modes
Cardano.Api.Monad.Error
Cardano.Api.NetworkId
Cardano.Api.OperationalCertificate
Cardano.Api.Orphans
Cardano.Api.Plutus
Cardano.Api.Pretty
Cardano.Api.Protocol
Cardano.Api.ProtocolParameters
Cardano.Api.Query
Cardano.Api.Query.Expr
Cardano.Api.Query.Types
Cardano.Api.ReexposeConsensus
Cardano.Api.ReexposeLedger
Cardano.Api.ReexposeNetwork
Cardano.Api.Rewards
Cardano.Api.Script
Cardano.Api.ScriptData
Cardano.Api.SerialiseBech32
Cardano.Api.SerialiseCBOR
Cardano.Api.SerialiseJSON
Cardano.Api.SerialiseLedgerCddl
Cardano.Api.SerialiseRaw
Cardano.Api.SerialiseTextEnvelope
Cardano.Api.SerialiseUsing
Cardano.Api.SpecialByron
Cardano.Api.StakePoolMetadata
Cardano.Api.Tx.Body
Cardano.Api.Tx.Compatible
Cardano.Api.Tx.Sign
Cardano.Api.TxIn
Cardano.Api.TxMetadata
Cardano.Api.Utils
Cardano.Api.Value
Cardano.Api.ValueParser
Cardano.Api.Via.ShowOf
Cardano.Api.Network
Cardano.Api.Shelley

build-depends:
FailT,
Expand Down Expand Up @@ -191,6 +126,7 @@ library internal
cborg,
containers,
contra-tracer,
cryptonite,
data-default-class,
deepseq,
directory,
Expand All @@ -206,6 +142,7 @@ library internal
mtl,
network,
network-mux,
nothunks,
ordered-containers,
ouroboros-consensus ^>=0.22,
ouroboros-consensus-cardano ^>=0.21,
Expand Down Expand Up @@ -235,40 +172,84 @@ library internal
vector,
yaml,

library
import: project-config
hs-source-dirs: src
-- Do not expose any additional modules. The correct way
-- to expose new functionality is via Cardano.Api or
-- Cardano.Api.Shelley
exposed-modules:
Cardano.Api
Cardano.Api.Byron
Cardano.Api.ChainSync.Client
Cardano.Api.ChainSync.ClientPipelined
Cardano.Api.Compatible
Cardano.Api.Consensus
Cardano.Api.Crypto.Ed25519Bip32
Cardano.Api.Experimental
Cardano.Api.Ledger
Cardano.Api.Network
Cardano.Api.Shelley

reexported-modules: Cardano.Api.Ledger.Lens
build-depends:
bytestring,
cardano-api:internal,
cardano-binary,
cardano-crypto,
cardano-crypto-class ^>=2.1.2,
cardano-ledger-byron,
cryptonite,
deepseq,
memory,
nothunks,
ouroboros-network,
ouroboros-network-protocols,
typed-protocols,
other-modules:
Cardano.Api.Internal.Anchor
Cardano.Api.Internal.Certificate
Cardano.Api.Internal.Convenience.Construction
Cardano.Api.Internal.Convenience.Query
Cardano.Api.Internal.DeserialiseAnyOf
Cardano.Api.Internal.Eon.AllegraEraOnwards
Cardano.Api.Internal.Eon.AlonzoEraOnwards
Cardano.Api.Internal.Eon.BabbageEraOnwards
Cardano.Api.Internal.Eon.ByronToAlonzoEra
Cardano.Api.Internal.Eon.Convert
Cardano.Api.Internal.Eon.ConwayEraOnwards
Cardano.Api.Internal.Eon.MaryEraOnwards
Cardano.Api.Internal.Eon.ShelleyEraOnly
Cardano.Api.Internal.Eon.ShelleyToAllegraEra
Cardano.Api.Internal.Eon.ShelleyToAlonzoEra
Cardano.Api.Internal.Eon.ShelleyToBabbageEra
Cardano.Api.Internal.Eon.ShelleyToMaryEra
Cardano.Api.Internal.Eras.Case
Cardano.Api.Internal.Eras.Core
Cardano.Api.Internal.Experimental.Eras
Cardano.Api.Internal.Experimental.Tx
Cardano.Api.Internal.Feature
Cardano.Api.Internal.Governance.Actions.ProposalProcedure
Cardano.Api.Internal.Governance.Actions.VotingProcedure
Cardano.Api.Internal.Governance.Metadata.DrepRegistration
Cardano.Api.Internal.Governance.Metadata.GovAction
Cardano.Api.Internal.Governance.Metadata.Parsers
Cardano.Api.Internal.Governance.Poll
Cardano.Api.Internal.HasTypeProxy
Cardano.Api.Internal.Hash
Cardano.Api.Internal.IO.Base
Cardano.Api.Internal.IO.Compat
Cardano.Api.Internal.IO.Compat.Posix
Cardano.Api.Internal.IO.Compat.Win32
Cardano.Api.Internal.IPC
Cardano.Api.Internal.IPC.Monad
Cardano.Api.Internal.IPC.Version
Cardano.Api.Internal.InMode
Cardano.Api.Internal.Json
Cardano.Api.Internal.Keys.Byron
Cardano.Api.Internal.Keys.Class
Cardano.Api.Internal.Keys.Praos
Cardano.Api.Internal.Keys.Read
Cardano.Api.Internal.Keys.Shelley
Cardano.Api.Internal.LedgerEvents.ConvertLedgerEvent
Cardano.Api.Internal.LedgerEvents.LedgerEvent
Cardano.Api.Internal.LedgerEvents.Rule.BBODY.DELEGS
Cardano.Api.Internal.LedgerEvents.Rule.BBODY.LEDGER
Cardano.Api.Internal.LedgerEvents.Rule.BBODY.UTXOW
Cardano.Api.Internal.LedgerEvents.Rule.TICK.NEWEPOCH
Cardano.Api.Internal.LedgerEvents.Rule.TICK.RUPD
Cardano.Api.Internal.Monad.Error
Cardano.Api.Internal.NetworkId
Cardano.Api.Internal.OperationalCertificate
Cardano.Api.Internal.Protocol
Cardano.Api.Internal.Query.Expr
Cardano.Api.Internal.Query.Types
Cardano.Api.Internal.ReexposeConsensus
Cardano.Api.Internal.ReexposeLedger
Cardano.Api.Internal.ReexposeNetwork
Cardano.Api.Internal.Rewards
Cardano.Api.Internal.ScriptData
Cardano.Api.Internal.SerialiseBech32
Cardano.Api.Internal.SerialiseCBOR
Cardano.Api.Internal.SerialiseJSON
Cardano.Api.Internal.SerialiseRaw
Cardano.Api.Internal.SerialiseUsing
Cardano.Api.Internal.SpecialByron
Cardano.Api.Internal.StakePoolMetadata
Cardano.Api.Internal.Tx.Body
Cardano.Api.Internal.Tx.Compatible
Cardano.Api.Internal.TxIn
Cardano.Api.Internal.TxMetadata
Cardano.Api.Internal.Utils
Cardano.Api.Internal.Value
Cardano.Api.Internal.ValueParser
Cardano.Api.Internal.Via.ShowOf

library gen
import: project-config
Expand All @@ -294,7 +275,6 @@ library gen
base16-bytestring,
bytestring,
cardano-api,
cardano-api:internal,
cardano-binary >=1.6 && <1.8,
cardano-crypto-class ^>=2.1.2,
cardano-crypto-test ^>=1.5,
Expand Down Expand Up @@ -325,7 +305,6 @@ test-suite cardano-api-test
bytestring,
cardano-api,
cardano-api:gen,
cardano-api:internal,
cardano-binary,
cardano-crypto,
cardano-crypto-class ^>=2.1.2,
Expand Down Expand Up @@ -400,7 +379,6 @@ test-suite cardano-api-golden
bytestring,
cardano-api,
cardano-api:gen,
cardano-api:internal,
cardano-binary,
cardano-crypto-class ^>=2.1.2,
cardano-data >=1.0,
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/gen/Test/Gen/Cardano/Api/ProtocolParameters.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Test.Gen.Cardano.Api.ProtocolParameters where

import Cardano.Api
import Cardano.Api.Internal.ProtocolParameters
import Cardano.Api.Ledger
import Cardano.Api.ProtocolParameters

import Test.Gen.Cardano.Api.Typed (genCostModels)

Expand Down
6 changes: 3 additions & 3 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ import qualified Cardano.Api as Api
import Cardano.Api.Byron (KeyWitness (ByronKeyWitness),
WitnessNetworkIdOrByronAddress (..))
import qualified Cardano.Api.Byron as Byron
import Cardano.Api.Error
import Cardano.Api.Internal.Error
import qualified Cardano.Api.Ledger as L
import qualified Cardano.Api.Ledger.Lens as A
import Cardano.Api.Script (scriptInEraToRefScript)
import Cardano.Api.Internal.Script (scriptInEraToRefScript)
import Cardano.Api.Shelley
import qualified Cardano.Api.Shelley as ShelleyApi

Expand Down Expand Up @@ -1203,7 +1203,7 @@ genProtocolParameters era = do

pure ProtocolParameters{..}

-- | Generate valid protocol parameters which pass validations in Cardano.Api.ProtocolParameters
-- | Generate valid protocol parameters which pass validations in Cardano.Api.Internal.ProtocolParameters
genValidProtocolParameters :: ShelleyBasedEra era -> Gen (LedgerProtocolParameters era)
genValidProtocolParameters sbe = shelleyBasedEraTestConstraints sbe $ LedgerProtocolParameters <$> Q.arbitrary

Expand Down
2 changes: 1 addition & 1 deletion cardano-api/gen/Test/Hedgehog/Golden/ErrorMessage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Test.Hedgehog.Golden.ErrorMessage where

import Cardano.Api (Error (..))
import Cardano.Api.Pretty
import Cardano.Api.Internal.Pretty

import qualified Control.Concurrent.QSem as IO
import Control.Exception (bracket_)
Expand Down
4 changes: 2 additions & 2 deletions cardano-api/gen/Test/Hedgehog/Roundtrip/CBOR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module Test.Hedgehog.Roundtrip.CBOR
where

import Cardano.Api
import Cardano.Api.Eon.ShelleyBasedEra
import Cardano.Api.Script
import Cardano.Api.Internal.Eon.ShelleyBasedEra
import Cardano.Api.Internal.Script

import qualified Cardano.Ledger.Core as Ledger
import qualified Cardano.Ledger.Plutus.Language as Plutus
Expand Down
Loading

0 comments on commit ab6fc23

Please sign in to comment.