;shake: cabalfiles: cleanups, build fast and show progress
This commit is contained in:
		
							parent
							
								
									95de5a878a
								
							
						
					
					
						commit
						ff76db9fb2
					
				
							
								
								
									
										22
									
								
								Shake.hs
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								Shake.hs
									
									
									
									
									
								
							| @ -258,16 +258,16 @@ main = do | |||||||
| 
 | 
 | ||||||
|       -- VERSION NUMBERS |       -- VERSION NUMBERS | ||||||
| 
 | 
 | ||||||
|       -- Regenerate .cabal files from package.yaml files, using stack build --dry-run. |       -- Regenerate .cabal files from package.yaml files. | ||||||
|       -- (used by "cabalfiles" and "setversion") |       -- (used by "cabalfiles" and "setversion") | ||||||
|       let docabalfiles = do |       let gencabalfiles = do | ||||||
|           -- stack can fail to update cabal files with zero exit status, |           -- stack 1.7+ no longer updates cabal files with --dry-run, we must do a full build. | ||||||
|           -- so we need to to check stderr, and specifically for the error message  |           -- stack can fail to update cabal files while returning zero exit code, | ||||||
|           -- since all output goes there |           -- we need to check for the error message (specifically) on stderr. | ||||||
|           err <- fromStderr <$> |           err <- fromStdouterr <$> | ||||||
|             -- stack 1.7 no longer updates cabal files with --dry-run, must do a full build |             (cmd (EchoStdout True) (EchoStderr True) Shell "stack build --fast" :: Action (Stdouterr String)) | ||||||
|             -- (or use hpack, of similar version) |           -- Or use hpack directly. It should be the same version that's in current stack. | ||||||
|             (cmd Shell "stack build" :: Action (Stderr String)) |           -- (cmd Shell "hpack" :: Action (Stderr String)) | ||||||
|           when ("was generated with a newer version of hpack" `isInfixOf` err) $ |           when ("was generated with a newer version of hpack" `isInfixOf` err) $ | ||||||
|             liftIO $ putStr err >> exitFailure |             liftIO $ putStr err >> exitFailure | ||||||
|           when commit $ do |           when commit $ do | ||||||
| @ -312,7 +312,7 @@ main = do | |||||||
|                 ] |                 ] | ||||||
|           cmd Shell gitcommit ("-m '"++msg++"' --") specifiedversionfiles dependents |           cmd Shell gitcommit ("-m '"++msg++"' --") specifiedversionfiles dependents | ||||||
| 
 | 
 | ||||||
|         docabalfiles |         gencabalfiles | ||||||
| 
 | 
 | ||||||
|       -- PKG/.version.m4 <- PKG/.version, just updates the _version_ macro |       -- PKG/.version.m4 <- PKG/.version, just updates the _version_ macro | ||||||
|       "hledger*/.version.m4" %> \out -> do |       "hledger*/.version.m4" %> \out -> do | ||||||
| @ -388,7 +388,7 @@ main = do | |||||||
|           cmd_ Shell grep "'^ *- +hledger.*[<>=]'" out  |           cmd_ Shell grep "'^ *- +hledger.*[<>=]'" out  | ||||||
|             " || [[ $? == 1 ]]"  -- ignore no matches, https://unix.stackexchange.com/a/427598 |             " || [[ $? == 1 ]]"  -- ignore no matches, https://unix.stackexchange.com/a/427598 | ||||||
| 
 | 
 | ||||||
|       phony "cabalfiles" $ docabalfiles |       phony "cabalfiles" $ gencabalfiles | ||||||
| 
 | 
 | ||||||
|       -- MANUALS |       -- MANUALS | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user