diff --git a/src/Stack/Build.hs b/src/Stack/Build.hs index 19602c2bee..affc01e685 100644 --- a/src/Stack/Build.hs +++ b/src/Stack/Build.hs @@ -187,7 +187,7 @@ build msetLocalFiles = do warnAboutSplitObjs bopts warnIfExecutablesWithSameNameCouldBeOverwritten locals plan - when bopts.boptsPreFetch $ + when bopts.preFetch $ preFetch plan if boptsCli.boptsCLIDryrun @@ -308,7 +308,7 @@ warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do collect = Map.mapMaybe nonEmpty . Map.fromDistinctAscList . groupSort warnAboutSplitObjs :: HasTerm env => BuildOpts -> RIO env () -warnAboutSplitObjs bopts | bopts.boptsSplitObjs = +warnAboutSplitObjs bopts | bopts.splitObjs = prettyWarnL [ flow "Building with" , style Shell "--split-objs" diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 5805b0f1c8..5b892c14ac 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -179,8 +179,8 @@ constructPlan , planUnregisterLocal = mkUnregisterLocal tasks dirtyReason localDumpPkgs initialBuildSteps , planInstallExes = - if baseConfigOpts0.bcoBuildOpts.boptsInstallExes - || baseConfigOpts0.bcoBuildOpts.boptsInstallCompilerTool + if baseConfigOpts0.bcoBuildOpts.installExes + || baseConfigOpts0.bcoBuildOpts.installCompilerTool then installExes else Map.empty } diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index e67dd90f6b..fc5a85335b 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -552,7 +552,7 @@ withExecuteEnv bopts boptsCli baseConfigOpts locals globalPackages snapshotPacka toDumpPackagesByGhcPkgId = Map.fromList . map (\dp -> (dp.ghcPkgId, dp)) createTempDirFunction - | bopts.boptsKeepTmpFiles = withKeepSystemTempDir + | bopts.keepTmpFiles = withKeepSystemTempDir | otherwise = withSystemTempDir dumpLogs :: TChan (Path Abs Dir, Path Abs File) -> Int -> RIO env () @@ -722,7 +722,7 @@ copyExecutables exes | Map.null exes = pure () copyExecutables exes = do snapBin <- ( bindirSuffix) <$> installationRootDeps localBin <- ( bindirSuffix) <$> installationRootLocal - compilerSpecific <- (.boptsInstallCompilerTool) <$> view buildOptsL + compilerSpecific <- (.installCompilerTool) <$> view buildOptsL destDir <- if compilerSpecific then bindirCompilerTools else view $ configL . to (.localBin) @@ -800,7 +800,7 @@ executePlan' :: HasEnvConfig env -> ExecuteEnv -> RIO env () executePlan' installedMap0 targets plan ee = do - when ee.eeBuildOpts.boptsTestOpts.toCoverage deleteHpcReports + when ee.eeBuildOpts.testOpts.toCoverage deleteHpcReports cv <- view actualCompilerVersionL case nonEmpty $ Map.toList plan.planUnregisterLocal of Nothing -> pure () @@ -830,7 +830,7 @@ executePlan' installedMap0 targets plan ee = do threads <- view $ configL . to (.jobs) let keepGoing = fromMaybe (not (Map.null plan.planFinals)) - ee.eeBuildOpts.boptsKeepGoing + ee.eeBuildOpts.keepGoing terminal <- view terminalL terminalWidth <- view termWidthL errs <- liftIO $ runActions threads keepGoing actions $ @@ -850,7 +850,7 @@ executePlan' installedMap0 targets plan ee = do nowBuilding names = mconcat $ ": " : L.intersperse ", " (map fromPackageName names) - progressFormat = ee.eeBuildOpts.boptsProgressBar + progressFormat = ee.eeBuildOpts.progressBar progressLine prev' total' = "Progress " <> display prev' <> "/" <> display total' @@ -870,13 +870,13 @@ executePlan' installedMap0 targets plan ee = do pure done loop done when (total > 1) $ loop 0 - when ee.eeBuildOpts.boptsTestOpts.toCoverage $ do + when ee.eeBuildOpts.testOpts.toCoverage $ do generateHpcUnifiedReport generateHpcMarkupIndex unless (null errs) $ prettyThrowM $ ExecutionFailure errs - when ee.eeBuildOpts.boptsHaddock $ do - if ee.eeBuildOpts.boptsHaddockForHackage + when ee.eeBuildOpts.haddock $ do + if ee.eeBuildOpts.haddockForHackage then generateLocalHaddockForHackageArchives ee.eeLocals else do @@ -893,7 +893,7 @@ executePlan' installedMap0 targets plan ee = do ee.eeBaseConfigOpts ee.eeGlobalDumpPkgs snapshotDumpPkgs - when ee.eeBuildOpts.boptsOpenHaddocks $ do + when ee.eeBuildOpts.openHaddocks $ do let planPkgs, localPkgs, installedPkgs, availablePkgs :: Map PackageName (PackageIdentifier, InstallLocation) planPkgs = @@ -1046,8 +1046,8 @@ toActions installedMap mtestLock runInBase ee (mbuild, mfinal) = withLock Nothing f = f withLock (Just lock) f = withMVar lock $ \() -> f bopts = ee.eeBuildOpts - topts = bopts.boptsTestOpts - beopts = bopts.boptsBenchmarkOpts + topts = bopts.testOpts + beopts = bopts.benchmarkOpts -- | Generate the ConfigCache getConfigCache :: @@ -1135,7 +1135,7 @@ ensureConfig newConfigCache pkgDir ee announce cabal cabalfp task = do taskAnyMissingHackEnabled <- view $ actualCompilerVersionL . to getGhcVersion . to (< mkVersion [8, 4]) needConfig <- - if ee.eeBuildOpts.boptsReconfigure + if ee.eeBuildOpts.reconfigure -- The reason 'taskAnyMissing' is necessary is a bug in Cabal. See: -- . -- The problem is that Cabal may end up generating the same package ID @@ -1401,7 +1401,7 @@ withSingleContext -- If the user requested interleaved output, dump to the console with a -- prefix. - | ee.eeBuildOpts.boptsInterleavedOutput = inner $ + | ee.eeBuildOpts.interleavedOutput = inner $ OTConsole $ Just $ fromString (packageNamePrefix ee package.name) -- Neither condition applies, dump to a file. @@ -1677,7 +1677,7 @@ withSingleContext (Set.insert package.name oldCustomBuilt, ()) pure outputFile let cabalVerboseArg = - let CabalVerbosity cv = ee.eeBuildOpts.boptsCabalVerbose + let CabalVerbosity cv = ee.eeBuildOpts.cabalVerbose in "--verbose=" <> showForCabal cv runExe exeName $ cabalVerboseArg:setupArgs @@ -1740,7 +1740,7 @@ singleBuild && maybe True (Set.notMember pname . (.curatorSkipHaddock)) mcurator expectHaddockFailure = maybe False (Set.member pname . (.curatorExpectHaddockFailure)) - isHaddockForHackage = ee.eeBuildOpts.boptsHaddockForHackage + isHaddockForHackage = ee.eeBuildOpts.haddockForHackage fulfillHaddockExpectations mcurator action | expectHaddockFailure mcurator = do eres <- tryAny $ action KeepOpen @@ -2046,13 +2046,13 @@ singleBuild , "--html-location=../$pkg-$version/" ] , [ "--haddock-option=--hyperlinked-source" - | ee.eeBuildOpts.boptsHaddockHyperlinkSource + | ee.eeBuildOpts.haddockHyperlinkSource ] - , [ "--internal" | ee.eeBuildOpts.boptsHaddockInternal ] + , [ "--internal" | ee.eeBuildOpts.haddockInternal ] , quickjump ] <> [ [ "--haddock-option=" <> opt - | opt <- ee.eeBuildOpts.boptsHaddockOpts.hoAdditionalArgs + | opt <- ee.eeBuildOpts.haddockOpts.hoAdditionalArgs ] ] ) @@ -2077,7 +2077,7 @@ singleBuild when (hasLibrary || hasSubLibraries) $ cabal KeepTHLoading ["register"] -- copy ddump-* files - case T.unpack <$> ee.eeBuildOpts.boptsDdumpDir of + case T.unpack <$> ee.eeBuildOpts.ddumpDir of Just ddumpPath | buildingFinals && not (null ddumpPath) -> do distDir <- distRelativeDir ddumpDir <- parseRelDir ddumpPath @@ -2703,7 +2703,7 @@ extraBuildOptions wc bopts = do colorOpt <- appropriateGhcColorFlag let optsFlag = compilerOptionsCabalFlag wc baseOpts = maybe "" (" " ++) colorOpt - if bopts.boptsTestOpts.toCoverage + if bopts.testOpts.toCoverage then do hpcIndexDir <- toFilePathNoTrailingSep <$> hpcRelativeDir pure [optsFlag, "-hpcdir " ++ hpcIndexDir ++ baseOpts] diff --git a/src/Stack/Build/Haddock.hs b/src/Stack/Build/Haddock.hs index 13ca3e318c..520a66b3b0 100644 --- a/src/Stack/Build/Haddock.hs +++ b/src/Stack/Build/Haddock.hs @@ -110,12 +110,12 @@ shouldHaddockPackage :: -> Bool shouldHaddockPackage bopts wanted name = if Set.member name wanted - then bopts.boptsHaddock + then bopts.haddock else shouldHaddockDeps bopts -- | Determine whether to build haddocks for dependencies. shouldHaddockDeps :: BuildOpts -> Bool -shouldHaddockDeps bopts = fromMaybe bopts.boptsHaddock bopts.boptsHaddockDeps +shouldHaddockDeps bopts = fromMaybe bopts.haddock bopts.haddockDeps -- | Generate Haddock index and contents for local packages. generateLocalHaddockIndex :: @@ -242,7 +242,7 @@ generateHaddockIndex descr bco dumpPackages docRelFP destDir = do ( map (("--optghc=-package-db=" ++ ) . toFilePathNoTrailingSep) [bco.bcoSnapDB, bco.bcoLocalDB] - ++ bco.bcoBuildOpts.boptsHaddockOpts.hoAdditionalArgs + ++ bco.bcoBuildOpts.haddockOpts.hoAdditionalArgs ++ ["--gen-contents", "--gen-index"] ++ [x | (xs, _, _, _) <- interfaceOpts, x <- xs] ) diff --git a/src/Stack/Build/Source.hs b/src/Stack/Build/Source.hs index 4cea364375..ac4eeae4d5 100644 --- a/src/Stack/Build/Source.hs +++ b/src/Stack/Build/Source.hs @@ -126,7 +126,7 @@ loadSourceMap smt boptsCli sma = do cabalConfigOpts ++ common.cpCabalConfigOpts , cpHaddocks = if isTarget - then bopts.boptsHaddock + then bopts.haddock else shouldHaddockDeps bopts } packageCliFlags = Map.fromList $ @@ -261,11 +261,11 @@ generalGhcOptions bconfig boptsCli isTarget isLocal = concat , if isTarget then Map.findWithDefault [] AGOTargets config.ghcOptionsByCat else [] - , concat [["-fhpc"] | isLocal && bopts.boptsTestOpts.toCoverage] - , if bopts.boptsLibProfile || bopts.boptsExeProfile + , concat [["-fhpc"] | isLocal && bopts.testOpts.toCoverage] + , if bopts.libProfile || bopts.exeProfile then ["-fprof-auto", "-fprof-cafs"] else [] - , [ "-g" | not $ bopts.boptsLibStrip || bopts.boptsExeStrip ] + , [ "-g" | not $ bopts.libStrip || bopts.exeStrip ] , if includeExtraOptions then boptsCli.boptsCLIGhcOptions else [] @@ -319,11 +319,11 @@ loadLocalPackage pp = do in (e, t, b) Just (TargetAll _packageType) -> ( buildableExes pkg - , if bopts.boptsTests + , if bopts.tests && maybe True (Set.notMember name . (.curatorSkipTest)) mcurator then buildableTestSuites pkg else Set.empty - , if bopts.boptsBenchmarks + , if bopts.benchmarks && maybe True (Set.notMember name . (.curatorSkipBenchmark)) @@ -345,7 +345,7 @@ loadLocalPackage pp = do || not (null pkg.subLibraries) filterSkippedComponents = - Set.filter (not . (`elem` bopts.boptsSkipComponents)) + Set.filter (not . (`elem` bopts.skipComponents)) (exes, tests, benches) = ( filterSkippedComponents exeCandidates , filterSkippedComponents testCandidates @@ -410,7 +410,7 @@ loadLocalPackage pp = do , testBench = btpkg , componentFiles = componentFiles , buildHaddocks = pp.ppCommon.cpHaddocks - , forceDirty = bopts.boptsForceDirty + , forceDirty = bopts.forceDirty , dirtyFiles = dirtyFiles , newBuildCaches = newBuildCaches , cabalFile = pp.ppCabalFP diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 2f2bda13c4..32c859f029 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -858,7 +858,7 @@ fillProjectWanted stackYamlFP config project locCache snapCompiler snapPackages packages0 <- for project.projectPackages $ \fp@(RelFilePath t) -> do abs' <- resolveDir (parent stackYamlFP) (T.unpack t) let resolved = ResolvedPath fp abs' - pp <- mkProjectPackage YesPrintWarnings resolved bopts.boptsHaddock + pp <- mkProjectPackage YesPrintWarnings resolved bopts.haddock pure (pp.ppCommon.cpName, pp) -- prefetch git repos to avoid cloning per subdirectory diff --git a/src/Stack/Config/Build.hs b/src/Stack/Config/Build.hs index 07351e9fc0..044083f108 100644 --- a/src/Stack/Config/Build.hs +++ b/src/Stack/Config/Build.hs @@ -22,58 +22,57 @@ import Stack.Types.BuildOpts -- | Interprets BuildOptsMonoid options. buildOptsFromMonoid :: BuildOptsMonoid -> BuildOpts buildOptsFromMonoid buildMonoid = BuildOpts - { boptsLibProfile = fromFirstFalse + { libProfile = fromFirstFalse (buildMonoid.buildMonoidLibProfile <> FirstFalse (if tracing || profiling then Just True else Nothing)) - , boptsExeProfile = fromFirstFalse + , exeProfile = fromFirstFalse (buildMonoid.buildMonoidExeProfile <> FirstFalse (if tracing || profiling then Just True else Nothing)) - , boptsLibStrip = fromFirstTrue + , libStrip = fromFirstTrue (buildMonoid.buildMonoidLibStrip <> FirstTrue (if noStripping then Just False else Nothing)) - , boptsExeStrip = fromFirstTrue + , exeStrip = fromFirstTrue (buildMonoid.buildMonoidExeStrip <> FirstTrue (if noStripping then Just False else Nothing)) - , boptsHaddock = fromFirstFalse buildMonoid.buildMonoidHaddock - , boptsHaddockOpts = haddockOptsFromMonoid buildMonoid.buildMonoidHaddockOpts - , boptsOpenHaddocks = + , haddock = fromFirstFalse buildMonoid.buildMonoidHaddock + , haddockOpts = haddockOptsFromMonoid buildMonoid.buildMonoidHaddockOpts + , openHaddocks = not isHaddockFromHackage && fromFirstFalse buildMonoid.buildMonoidOpenHaddocks - , boptsHaddockDeps = if isHaddockFromHackage + , haddockDeps = if isHaddockFromHackage then Nothing else getFirst buildMonoid.buildMonoidHaddockDeps - , boptsHaddockInternal = + , haddockInternal = not isHaddockFromHackage && fromFirstFalse buildMonoid.buildMonoidHaddockInternal - , boptsHaddockHyperlinkSource = + , haddockHyperlinkSource = isHaddockFromHackage || fromFirstTrue buildMonoid.buildMonoidHaddockHyperlinkSource - , boptsHaddockForHackage = isHaddockFromHackage - , boptsInstallExes = fromFirstFalse buildMonoid.buildMonoidInstallExes - , boptsInstallCompilerTool = + , haddockForHackage = isHaddockFromHackage + , installExes = fromFirstFalse buildMonoid.buildMonoidInstallExes + , installCompilerTool = fromFirstFalse buildMonoid.buildMonoidInstallCompilerTool - , boptsPreFetch = fromFirstFalse buildMonoid.buildMonoidPreFetch - , boptsKeepGoing = getFirst buildMonoid.buildMonoidKeepGoing - , boptsKeepTmpFiles = fromFirstFalse buildMonoid.buildMonoidKeepTmpFiles - , boptsForceDirty = + , preFetch = fromFirstFalse buildMonoid.buildMonoidPreFetch + , keepGoing = getFirst buildMonoid.buildMonoidKeepGoing + , keepTmpFiles = fromFirstFalse buildMonoid.buildMonoidKeepTmpFiles + , forceDirty = isHaddockFromHackage || fromFirstFalse buildMonoid.buildMonoidForceDirty - , boptsTests = fromFirstFalse buildMonoid.buildMonoidTests - , boptsTestOpts = + , tests = fromFirstFalse buildMonoid.buildMonoidTests + , testOpts = testOptsFromMonoid buildMonoid.buildMonoidTestOpts additionalArgs - , boptsBenchmarks = fromFirstFalse buildMonoid.buildMonoidBenchmarks - , boptsBenchmarkOpts = + , benchmarks = fromFirstFalse buildMonoid.buildMonoidBenchmarks + , benchmarkOpts = benchmarkOptsFromMonoid buildMonoid.buildMonoidBenchmarkOpts additionalArgs - , boptsReconfigure = fromFirstFalse buildMonoid.buildMonoidReconfigure - , boptsCabalVerbose = + , reconfigure = fromFirstFalse buildMonoid.buildMonoidReconfigure + , cabalVerbose = fromFirst (CabalVerbosity normal) buildMonoid.buildMonoidCabalVerbose - , boptsSplitObjs = fromFirstFalse buildMonoid.buildMonoidSplitObjs - , boptsSkipComponents = buildMonoid.buildMonoidSkipComponents - , boptsInterleavedOutput = - fromFirstTrue buildMonoid.buildMonoidInterleavedOutput - , boptsProgressBar = fromFirst CappedBar buildMonoid.buildMonoidProgressBar - , boptsDdumpDir = getFirst buildMonoid.buildMonoidDdumpDir + , splitObjs = fromFirstFalse buildMonoid.buildMonoidSplitObjs + , skipComponents = buildMonoid.buildMonoidSkipComponents + , interleavedOutput = fromFirstTrue buildMonoid.buildMonoidInterleavedOutput + , progressBar = fromFirst CappedBar buildMonoid.buildMonoidProgressBar + , ddumpDir = getFirst buildMonoid.buildMonoidDdumpDir } where isHaddockFromHackage = fromFirstFalse buildMonoid.buildMonoidHaddockForHackage diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index 7ae0ed4b7a..433abd8aec 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -210,9 +210,8 @@ ghciCmd ghciOpts = bopts <- view buildOptsL -- override env so running of tests and benchmarks is disabled let boptsLocal = bopts - { boptsTestOpts = bopts.boptsTestOpts { toDisableRun = True } - , boptsBenchmarkOpts = - bopts.boptsBenchmarkOpts { beoDisableRun = True } + { testOpts = bopts.testOpts { toDisableRun = True } + , benchmarkOpts = bopts.benchmarkOpts { beoDisableRun = True } } local (set buildOptsL boptsLocal) (ghci ghciOpts) @@ -959,8 +958,8 @@ wantedPackageComponents bopts (TargetAll PTProject) pkg = S.fromList $ ) <> map CExe buildableExes' <> map CSubLib buildableSubLibs - <> (if bopts.boptsTests then map CTest buildableTestSuites else []) - <> (if bopts.boptsBenchmarks then map CBench buildableBenchmarks else []) + <> (if bopts.tests then map CTest buildableTestSuites else []) + <> (if bopts.benchmarks then map CBench buildableBenchmarks else []) where buildableForeignLibs' = S.toList $ buildableForeignLibs pkg buildableSubLibs = getBuildableListText pkg.subLibraries diff --git a/src/Stack/SDist.hs b/src/Stack/SDist.hs index 19c96f9b3d..578c7472cb 100644 --- a/src/Stack/SDist.hs +++ b/src/Stack/SDist.hs @@ -624,8 +624,7 @@ buildExtractedTarball pkgDir = do updateBuildConfig envConfig.envConfigBuildConfig } updateBuildConfig bc = bc - { config = bc.config - { build = defaultBuildOpts { boptsTests = True } } + { config = bc.config { build = defaultBuildOpts { tests = True } } } in set envConfigL updatedEnvConfig env updatePackagesInSourceMap sm = diff --git a/src/Stack/Types/BuildOpts.hs b/src/Stack/Types/BuildOpts.hs index 2ce3cd08a5..0a147d471d 100644 --- a/src/Stack/Types/BuildOpts.hs +++ b/src/Stack/Types/BuildOpts.hs @@ -1,4 +1,5 @@ {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE NoFieldSelectors #-} {-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE OverloadedStrings #-} @@ -51,101 +52,101 @@ import Stack.Prelude -- | Build options that is interpreted by the build command. This is built up -- from BuildOptsCLI and BuildOptsMonoid data BuildOpts = BuildOpts - { boptsLibProfile :: !Bool - , boptsExeProfile :: !Bool - , boptsLibStrip :: !Bool - , boptsExeStrip :: !Bool - , boptsHaddock :: !Bool + { libProfile :: !Bool + , exeProfile :: !Bool + , libStrip :: !Bool + , exeStrip :: !Bool + , haddock :: !Bool -- ^ Build haddocks? - , boptsHaddockOpts :: !HaddockOpts + , haddockOpts :: !HaddockOpts -- ^ Options to pass to haddock - , boptsOpenHaddocks :: !Bool + , openHaddocks :: !Bool -- ^ Open haddocks in the browser? - , boptsHaddockDeps :: !(Maybe Bool) + , haddockDeps :: !(Maybe Bool) -- ^ Build haddocks for dependencies? - , boptsHaddockInternal :: !Bool + , haddockInternal :: !Bool -- ^ Build haddocks for all symbols and packages, like -- @cabal haddock --internal@ - , boptsHaddockHyperlinkSource :: !Bool + , haddockHyperlinkSource :: !Bool -- ^ Build hyperlinked source. Disable for no sources. - , boptsHaddockForHackage :: !Bool + , haddockForHackage :: !Bool -- ^ Build with flags to generate Haddock documentation suitable to upload -- to Hackage. - , boptsInstallExes :: !Bool + , installExes :: !Bool -- ^ Install executables to user path after building? - , boptsInstallCompilerTool :: !Bool + , installCompilerTool :: !Bool -- ^ Install executables to compiler tools path after building? - , boptsPreFetch :: !Bool + , preFetch :: !Bool -- ^ Fetch all packages immediately -- ^ Watch files for changes and automatically rebuild - , boptsKeepGoing :: !(Maybe Bool) + , keepGoing :: !(Maybe Bool) -- ^ Keep building/running after failure - , boptsKeepTmpFiles :: !Bool + , keepTmpFiles :: !Bool -- ^ Keep intermediate files and build directories - , boptsForceDirty :: !Bool + , forceDirty :: !Bool -- ^ Force treating all local packages as having dirty files - , boptsTests :: !Bool + , tests :: !Bool -- ^ Turn on tests for local targets - , boptsTestOpts :: !TestOpts + , testOpts :: !TestOpts -- ^ Additional test arguments - , boptsBenchmarks :: !Bool + , benchmarks :: !Bool -- ^ Turn on benchmarks for local targets - , boptsBenchmarkOpts :: !BenchmarkOpts + , benchmarkOpts :: !BenchmarkOpts -- ^ Additional test arguments -- ^ Commands (with arguments) to run after a successful build -- ^ Only perform the configure step when building - , boptsReconfigure :: !Bool + , reconfigure :: !Bool -- ^ Perform the configure step even if already configured - , boptsCabalVerbose :: !CabalVerbosity + , cabalVerbose :: !CabalVerbosity -- ^ Ask Cabal to be verbose in its builds - , boptsSplitObjs :: !Bool + , splitObjs :: !Bool -- ^ Whether to enable split-objs. - , boptsSkipComponents :: ![Text] + , skipComponents :: ![Text] -- ^ Which components to skip when building - , boptsInterleavedOutput :: !Bool + , interleavedOutput :: !Bool -- ^ Should we use the interleaved GHC output when building -- multiple packages? - , boptsProgressBar :: !ProgressBarFormat + , progressBar :: !ProgressBarFormat -- ^ Format of the progress bar - , boptsDdumpDir :: !(Maybe Text) + , ddumpDir :: !(Maybe Text) } deriving Show defaultBuildOpts :: BuildOpts defaultBuildOpts = BuildOpts - { boptsLibProfile = defaultFirstFalse buildMonoid.buildMonoidLibProfile - , boptsExeProfile = defaultFirstFalse buildMonoid.buildMonoidExeProfile - , boptsLibStrip = defaultFirstTrue buildMonoid.buildMonoidLibStrip - , boptsExeStrip = defaultFirstTrue buildMonoid.buildMonoidExeStrip - , boptsHaddock = False - , boptsHaddockOpts = defaultHaddockOpts - , boptsOpenHaddocks = defaultFirstFalse buildMonoid.buildMonoidOpenHaddocks - , boptsHaddockDeps = Nothing - , boptsHaddockInternal = + { libProfile = defaultFirstFalse buildMonoid.buildMonoidLibProfile + , exeProfile = defaultFirstFalse buildMonoid.buildMonoidExeProfile + , libStrip = defaultFirstTrue buildMonoid.buildMonoidLibStrip + , exeStrip = defaultFirstTrue buildMonoid.buildMonoidExeStrip + , haddock = False + , haddockOpts = defaultHaddockOpts + , openHaddocks = defaultFirstFalse buildMonoid.buildMonoidOpenHaddocks + , haddockDeps = Nothing + , haddockInternal = defaultFirstFalse buildMonoid.buildMonoidHaddockInternal - , boptsHaddockHyperlinkSource = + , haddockHyperlinkSource = defaultFirstTrue buildMonoid.buildMonoidHaddockHyperlinkSource - , boptsHaddockForHackage = + , haddockForHackage = defaultFirstFalse buildMonoid.buildMonoidHaddockForHackage - , boptsInstallExes = defaultFirstFalse buildMonoid.buildMonoidInstallExes - , boptsInstallCompilerTool = + , installExes = defaultFirstFalse buildMonoid.buildMonoidInstallExes + , installCompilerTool = defaultFirstFalse buildMonoid.buildMonoidInstallCompilerTool - , boptsPreFetch = defaultFirstFalse buildMonoid.buildMonoidPreFetch - , boptsKeepGoing = Nothing - , boptsKeepTmpFiles = defaultFirstFalse buildMonoid.buildMonoidKeepTmpFiles - , boptsForceDirty = defaultFirstFalse buildMonoid.buildMonoidForceDirty - , boptsTests = defaultFirstFalse buildMonoid.buildMonoidTests - , boptsTestOpts = defaultTestOpts - , boptsBenchmarks = defaultFirstFalse buildMonoid.buildMonoidBenchmarks - , boptsBenchmarkOpts = defaultBenchmarkOpts - , boptsReconfigure = defaultFirstFalse buildMonoid.buildMonoidReconfigure - , boptsCabalVerbose = CabalVerbosity normal - , boptsSplitObjs = defaultFirstFalse buildMonoid.buildMonoidSplitObjs - , boptsSkipComponents = [] - , boptsInterleavedOutput = + , preFetch = defaultFirstFalse buildMonoid.buildMonoidPreFetch + , keepGoing = Nothing + , keepTmpFiles = defaultFirstFalse buildMonoid.buildMonoidKeepTmpFiles + , forceDirty = defaultFirstFalse buildMonoid.buildMonoidForceDirty + , tests = defaultFirstFalse buildMonoid.buildMonoidTests + , testOpts = defaultTestOpts + , benchmarks = defaultFirstFalse buildMonoid.buildMonoidBenchmarks + , benchmarkOpts = defaultBenchmarkOpts + , reconfigure = defaultFirstFalse buildMonoid.buildMonoidReconfigure + , cabalVerbose = CabalVerbosity normal + , splitObjs = defaultFirstFalse buildMonoid.buildMonoidSplitObjs + , skipComponents = [] + , interleavedOutput = defaultFirstTrue buildMonoid.buildMonoidInterleavedOutput - , boptsProgressBar = CappedBar - , boptsDdumpDir = Nothing + , progressBar = CappedBar + , ddumpDir = Nothing } where buildMonoid = undefined :: BuildOptsMonoid @@ -652,14 +653,12 @@ buildOptsMonoidInstallExesL = (\buildMonoid t -> buildMonoid {buildMonoidInstallExes = FirstFalse t}) buildOptsInstallExesL :: Lens' BuildOpts Bool -buildOptsInstallExesL = - lens (.boptsInstallExes) - (\bopts t -> bopts {boptsInstallExes = t}) +buildOptsInstallExesL = lens + (.installExes) + (\bopts t -> bopts {installExes = t}) buildOptsHaddockL :: Lens' BuildOpts Bool -buildOptsHaddockL = - lens (.boptsHaddock) - (\bopts t -> bopts {boptsHaddock = t}) +buildOptsHaddockL = lens (.haddock) (\bopts t -> bopts {haddock = t}) -- Type representing formats of Stack's progress bar when building. data ProgressBarFormat diff --git a/src/Stack/Types/ConfigureOpts.hs b/src/Stack/Types/ConfigureOpts.hs index 4f865b7690..cd9d7b345e 100644 --- a/src/Stack/Types/ConfigureOpts.hs +++ b/src/Stack/Types/ConfigureOpts.hs @@ -105,14 +105,14 @@ configureOptsNoDir :: configureOptsNoDir econfig bco deps isLocal package = concat [ depOptions , [ "--enable-library-profiling" - | bopts.boptsLibProfile || bopts.boptsExeProfile + | bopts.libProfile || bopts.exeProfile ] - , ["--enable-profiling" | bopts.boptsExeProfile && isLocal] - , ["--enable-split-objs" | bopts.boptsSplitObjs] + , ["--enable-profiling" | bopts.exeProfile && isLocal] + , ["--enable-split-objs" | bopts.splitObjs] , [ "--disable-library-stripping" - | not $ bopts.boptsLibStrip || bopts.boptsExeStrip + | not $ bopts.libStrip || bopts.exeStrip ] - , ["--disable-executable-stripping" | not bopts.boptsExeStrip && isLocal] + , ["--disable-executable-stripping" | not bopts.exeStrip && isLocal] , map (\(name,enabled) -> "-f" <> (if enabled diff --git a/tests/unit/Stack/ConfigSpec.hs b/tests/unit/Stack/ConfigSpec.hs index 2dff7b8a8a..effbb6793c 100644 --- a/tests/unit/Stack/ConfigSpec.hs +++ b/tests/unit/Stack/ConfigSpec.hs @@ -191,17 +191,17 @@ spec = beforeAll setup $ do writeFile (toFilePath stackDotYaml) buildOptsConfig loadConfig' $ \config -> liftIO $ do let bopts = config.build - bopts.boptsLibProfile `shouldBe` True - bopts.boptsExeProfile `shouldBe` True - bopts.boptsHaddock `shouldBe` True - bopts.boptsHaddockDeps `shouldBe` Just True - bopts.boptsInstallExes `shouldBe` True - bopts.boptsPreFetch `shouldBe` True - bopts.boptsKeepGoing `shouldBe` Just True - bopts.boptsKeepTmpFiles `shouldBe` True - bopts.boptsForceDirty `shouldBe` True - bopts.boptsTests `shouldBe` True - bopts.boptsTestOpts `shouldBe` TestOpts + bopts.libProfile `shouldBe` True + bopts.exeProfile `shouldBe` True + bopts.haddock `shouldBe` True + bopts.haddockDeps `shouldBe` Just True + bopts.installExes `shouldBe` True + bopts.preFetch `shouldBe` True + bopts.keepGoing `shouldBe` Just True + bopts.keepTmpFiles `shouldBe` True + bopts.forceDirty `shouldBe` True + bopts.tests `shouldBe` True + bopts.testOpts `shouldBe` TestOpts { toRerunTests = True , toAdditionalArgs = ["-fprof"] , toCoverage = True @@ -209,13 +209,13 @@ spec = beforeAll setup $ do , toMaximumTimeSeconds = Nothing , toAllowStdin = True } - bopts.boptsBenchmarks `shouldBe` True - bopts.boptsBenchmarkOpts `shouldBe` BenchmarkOpts + bopts.benchmarks `shouldBe` True + bopts.benchmarkOpts `shouldBe` BenchmarkOpts { beoAdditionalArgs = Just "-O2" , beoDisableRun = True } - bopts.boptsReconfigure `shouldBe` True - bopts.boptsCabalVerbose `shouldBe` CabalVerbosity verbose + bopts.reconfigure `shouldBe` True + bopts.cabalVerbose `shouldBe` CabalVerbosity verbose it "finds the config file in a parent directory" $ inTempDir $ do writeFile "package.yaml" "name: foo"