Skip to content

Commit 4f51b31

Browse files
iohk-bors[bot]rvlIOHK
authored
Merge #1587 #1593
1587: Cabal: Set -Werror and -Ox only with release flag r=rvl a=rvl Makes Cabal builds faster, like the `stack build --fast` flag. Nothing is changed when the development flag is unset. Some components are missing `-O`, and most others are at `-O2`. However, from what I've read, `-O2` often doesn't help, so you only use it if your benchmarks say so. 1593: cardano-node: 1.10.1 -> 1.11.0 r=rvl a=rvl # Issue Number Relates to #1577 / ADP-83. # Overview - Updates cardano-node version in nix. - Updates the cardano-haskell stack snapshot. - Adds `cardano-cli` to the shell. I am hoping to use this in the integration tests. - Build fixes # Comments WIP until input-output-hk/cardano-haskell#13 is merged. Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io> Co-authored-by: IOHK <devops+stack-project@iohk.io>
3 parents ce8a9fd + 14623f8 + a250c6c commit 4f51b31

File tree

67 files changed

+282
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+282
-280
lines changed

.buildkite/pipeline.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ steps:
2121
system: x86_64-linux
2222

2323
- label: 'Check Cabal Configure'
24-
command: 'nix-shell --run "cabal v2-update && cabal v2-configure --enable-tests --enable-benchmarks"'
24+
command:
25+
- 'nix-shell --run "cabal v2-update"'
26+
- 'nix-shell --run "cabal v2-configure --enable-tests --enable-benchmarks"'
27+
- 'nix-shell --run "cabal v2-configure -frelease --enable-tests --enable-benchmarks"'
2528
agents:
2629
system: x86_64-linux
2730

.buildkite/rebuild.hs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,19 @@ parseOpts = execParser opts
137137
)
138138

139139
buildStep :: DryRun -> Maybe BuildkiteEnv -> Bool -> IO ExitCode
140-
buildStep dryRun bk nightly =
140+
buildStep dryRun bk nightly = do
141+
pkgs <- listLocalPackages
142+
let cabalFlags = concatMap (flag "release") pkgs
143+
141144
titled "Build LTS Snapshot"
142145
(build Standard ["--only-snapshot"]) .&&.
143-
titled "Build dependencies"
146+
titled "Build dependencies"
144147
(build Standard ["--only-dependencies"]) .&&.
145-
titled "Build"
146-
(build Fast ["--test", "--no-run-tests"]) .&&.
147-
titled "Test"
148-
(timeout 45 (test Fast Serial .&&. test Fast Parallel)) .&&.
149-
titled "Checking golden test files"
148+
titled "Build"
149+
(build Fast (["--test", "--no-run-tests"] ++ cabalFlags)) .&&.
150+
titled "Test"
151+
(timeout 45 (test Fast Serial cabalFlags .&&. test Fast Parallel cabalFlags)) .&&.
152+
titled "Checking golden test files"
150153
(checkUnclean dryRun "lib/core/test/data")
151154
where
152155
build opt args =
@@ -162,7 +165,7 @@ buildStep dryRun bk nightly =
162165
, args
163166
]
164167

165-
test opt behavior =
168+
test opt behavior args =
166169
run dryRun "stack" $ concat
167170
[ color "always"
168171
, [ "test" ]
@@ -176,6 +179,7 @@ buildStep dryRun bk nightly =
176179
ta (match serialTests ++ jobs 1) ++ jobs 1
177180
Parallel ->
178181
ta (skip serialTests)
182+
, args
179183
]
180184

181185
color arg = ["--color", arg]
@@ -184,6 +188,7 @@ buildStep dryRun bk nightly =
184188
skip arg = ["--skip", arg]
185189
match arg = ["--match", arg]
186190
ta arg = ["--ta", T.unwords arg]
191+
flag name pkg = ["--flag", pkg <> ":" <> name]
187192

188193
serialTests = "SERIAL"
189194

@@ -216,6 +221,17 @@ checkUnclean dryRun dir = do
216221
printf "This build step will fail.\n"
217222
pure res
218223

224+
-- | Find the name of all Cabal packages in this repo.
225+
listLocalPackages :: IO [Text]
226+
listLocalPackages =
227+
find (suffix ".cabal") "."
228+
& onFiles (grepText (invert isBuild))
229+
& fmap basename
230+
& textLines
231+
where
232+
isBuild = contains "./.stack-work" <|> contains "./dist"
233+
textLines shell = fold (format fp <$> shell) Fold.list
234+
219235
----------------------------------------------------------------------------
220236
-- Buildkite
221237
-- https://buildkite.com/docs/pipelines/environment-variables

default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ let
7777
inherit pkgs commonLib src haskellPackages stackNixRegenerate;
7878
inherit (jmPkgs) jormungandr jormungandr-cli;
7979
# expose cardano-node, so daedalus can ship it without needing to pin cardano-node
80-
inherit (pkgs) cardano-node;
80+
inherit (pkgs) cardano-node cardano-cli;
8181
inherit (haskellPackages.cardano-wallet-core.identifier) version;
8282
# expose db-converter, so daedalus can ship it without needing to pin a ouroborus-network rev
8383
inherit (haskellPackages.ouroboros-consensus-byron.components.exes) db-converter;
@@ -133,6 +133,7 @@ let
133133
jormungandr
134134
jormungandr-cli
135135
cardano-node
136+
cardano-cli
136137
]) ++ (with pkgs; [
137138
stack
138139
cabal-install

lib/byron/cardano-wallet-byron.cabal

Lines changed: 76 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ category: Web
1111
build-type: Simple
1212
cabal-version: >=1.10
1313

14-
flag development
15-
description: Disable `-Werror`
14+
flag release
15+
description: Enable optimization and `-Werror`
1616
default: False
1717
manual: True
1818

@@ -26,9 +26,8 @@ library
2626
-Wall
2727
-Wcompat
2828
-fwarn-redundant-constraints
29-
if (!flag(development))
30-
ghc-options:
31-
-Werror
29+
if (flag(release))
30+
ghc-options: -O2 -Werror
3231
build-depends:
3332
base
3433
, aeson
@@ -91,10 +90,8 @@ executable cardano-wallet-byron
9190
ghc-options:
9291
-threaded -rtsopts
9392
-Wall
94-
-O2
95-
if (!flag(development))
96-
ghc-options:
97-
-Werror
93+
if (flag(release))
94+
ghc-options: -O2 -Werror
9895
build-depends:
9996
base
10097
, cardano-wallet-byron
@@ -122,10 +119,8 @@ test-suite unit
122119
ghc-options:
123120
-threaded -rtsopts
124121
-Wall
125-
if (!flag(development))
126-
ghc-options:
127-
-O2
128-
-Werror
122+
if (flag(release))
123+
ghc-options: -O2 -Werror
129124
build-depends:
130125
base
131126
, bytestring
@@ -164,10 +159,8 @@ test-suite integration
164159
ghc-options:
165160
-threaded -rtsopts
166161
-Wall
167-
if (!flag(development))
168-
ghc-options:
169-
-O2
170-
-Werror
162+
if (flag(release))
163+
ghc-options: -O2 -Werror
171164
build-depends:
172165
base
173166
, aeson
@@ -204,94 +197,83 @@ test-suite integration
204197
Test.Integration.Byron.Scenario.CLI.Transactions
205198

206199
benchmark restore
207-
default-language:
208-
Haskell2010
209-
default-extensions:
210-
NoImplicitPrelude
211-
OverloadedStrings
212-
ghc-options:
213-
-threaded -rtsopts
214-
-Wall
215-
-O2
216-
if (!flag(development))
217-
ghc-options:
218-
-Werror
219-
build-depends:
220-
base
221-
, bytestring
222-
, cardano-wallet-core
223-
, optparse-applicative
224-
, cardano-wallet-byron
225-
, cardano-wallet-launcher
226-
, ouroboros-network
227-
, contra-tracer
228-
, containers
229-
, criterion-measurement
230-
, cryptonite
231-
, deepseq
232-
, digest
233-
, filepath
234-
, fmt
235-
, iohk-monitoring
236-
, persistent
237-
, persistent-template
238-
, process
239-
, say
240-
, temporary
241-
, text
242-
, time
243-
, transformers
244-
type:
245-
exitcode-stdio-1.0
246-
hs-source-dirs:
247-
bench
248-
main-is:
249-
Restore.hs
250-
other-modules:
251-
Cardano.Wallet.Primitive.AddressDiscovery.Any
252-
Cardano.Wallet.Primitive.AddressDiscovery.Any.TH
253-
254-
benchmark latency
255-
default-language:
256-
Haskell2010
257-
default-extensions:
258-
NoImplicitPrelude
259-
OverloadedStrings
260-
ghc-options:
261-
-threaded -rtsopts
262-
-Wall
263-
-O2
264-
if (!flag(development))
265-
ghc-options:
266-
-Werror
267-
build-depends:
200+
default-language:
201+
Haskell2010
202+
default-extensions:
203+
NoImplicitPrelude
204+
OverloadedStrings
205+
ghc-options:
206+
-threaded -rtsopts
207+
-Wall
208+
if (flag(release))
209+
ghc-options: -O2 -Werror
210+
build-depends:
268211
base
269-
, aeson
270-
, async
271-
, bech32
272-
, bech32-th
273212
, bytestring
274-
, cardano-wallet-cli
275213
, cardano-wallet-core
276-
, cardano-wallet-core-integration
214+
, optparse-applicative
277215
, cardano-wallet-byron
278216
, cardano-wallet-launcher
279-
, cardano-wallet-test-utils
280-
, command
281-
, directory
217+
, ouroboros-network
218+
, contra-tracer
219+
, containers
220+
, criterion-measurement
221+
, cryptonite
222+
, deepseq
223+
, digest
282224
, filepath
283225
, fmt
284-
, generic-lens
285-
, http-client
286-
, http-types
287-
, hspec
288226
, iohk-monitoring
289-
, memory
290-
, stm
227+
, persistent
228+
, persistent-template
229+
, process
230+
, say
291231
, temporary
292232
, text
293-
, text-class
294233
, time
234+
, transformers
235+
type:
236+
exitcode-stdio-1.0
237+
hs-source-dirs:
238+
bench
239+
main-is:
240+
Restore.hs
241+
other-modules:
242+
Cardano.Wallet.Primitive.AddressDiscovery.Any
243+
Cardano.Wallet.Primitive.AddressDiscovery.Any.TH
244+
245+
benchmark latency
246+
default-language:
247+
Haskell2010
248+
default-extensions:
249+
NoImplicitPrelude
250+
OverloadedStrings
251+
ghc-options:
252+
-threaded -rtsopts
253+
-Wall
254+
if (flag(release))
255+
ghc-options: -O2 -Werror
256+
build-depends:
257+
base
258+
, aeson
259+
, async
260+
, cardano-wallet-cli
261+
, cardano-wallet-core
262+
, cardano-wallet-core-integration
263+
, cardano-wallet-byron
264+
, cardano-wallet-launcher
265+
, cardano-wallet-test-utils
266+
, fmt
267+
, generic-lens
268+
, http-client
269+
, http-types
270+
, hspec
271+
, iohk-monitoring
272+
, stm
273+
, temporary
274+
, text
275+
, text-class
276+
, time
295277
build-tools:
296278
cardano-wallet-byron
297279
type:

lib/byron/src/Cardano/Wallet/Byron.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ import Network.Wai.Handler.Warp
130130
( setBeforeMainLoop )
131131
import Network.Wai.Middleware.Logging
132132
( ApiLog )
133+
import Ouroboros.Network.CodecCBORTerm
134+
( CodecCBORTerm )
133135
import Ouroboros.Network.NodeToClient
134136
( NodeToClientVersionData (..) )
135-
import Ouroboros.Network.Protocol.Handshake.Version
136-
( CodecCBORTerm )
137137
import System.Exit
138138
( ExitCode (..) )
139139
import System.IOManager

lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ import Ouroboros.Network.Block
108108
)
109109
import Ouroboros.Network.ChainFragment
110110
( HasHeader (..) )
111+
import Ouroboros.Network.CodecCBORTerm
112+
( CodecCBORTerm )
111113
import Ouroboros.Network.Magic
112114
( NetworkMagic (..) )
113115
import Ouroboros.Network.NodeToClient
114116
( NodeToClientVersionData (..), nodeToClientCodecCBORTerm )
115117
import Ouroboros.Network.Point
116118
( WithOrigin (..) )
117-
import Ouroboros.Network.Protocol.Handshake.Version
118-
( CodecCBORTerm )
119119

120120
import qualified Cardano.Crypto.Hashing as CC
121121
import qualified Cardano.Wallet.Primitive.Types as W

0 commit comments

Comments
 (0)