packages feed

buildwrapper 0.8.1 → 0.8.2

raw patch · 4 files changed

+23/−13 lines, 4 files

Files

README.md view
@@ -14,18 +14,22 @@ You can run `buildwrapper --help` to get a feel for the different options you can call buildwrapper with. You can also run EclipseFP with the debug mode preference on to see the BuildWrapper interaction in an Eclipse console view.
 
 ## Generic options
-These options apply to all commands
+These options are available to all commands.
 
-- tempFolder: the name of the temporary folder, relative to the location of the project cabal file. Usually .dist-buildwrapper
+- tempfolder: the name of the temporary folder, relative to the location of the project cabal file. Usually .dist-buildwrapper
 - cabalpath: the location of the cabal executable
 - cabalfile: the location of the project cabal file
-- cabalFlags: the flags to pass to cabal when configuring
+- cabalflags: the flags to pass to cabal when configuring
+- logcabal: should the call to the cabal executable be logged?
 
 ## synchronize
 Synchronize ensures that all the files in the temporary work folder represent the up to date version of the source files. It returns the list of files actually copied from the main folder to the work folder. 
 
 - force: true/false: copies files even if destination (in temporary folder) is newer
 
+Example: `buildwrapper synchronize --force=false --tempfolder=.dist-buildwrapper --cabalpath=/home/myuser/.cabal/bin/cabal --cabalfile=/home/myuser/myproject/myproject.cabal --cabalflags= --logcabal=true`
+
+
 ## synchronize1
 Synchronizes only one file.
 
@@ -43,15 +47,18 @@ Returns the errors encountered, if any.
 
 - verbosity: the verbosity of Cabal output
-- whichcabal: Source|Target: use the original cabal file or the one in the work folder
+- cabaltarget: Source|Target: use the original cabal file or the one in the work folder
 
 ## build
 Runs cabal build on the project.
 Returns the errors encountered, if any, and the files processed during that build.
 
 - verbosity: the verbosity of Cabal output
-- whichcabal: Source/Target: use the original cabal file or the one in the work folder
-- output: true/false: should we actually run the linker and generates output
+- cabaltarget: Source|Target: use the original cabal file or the one in the work folder
+- output: true|false: should we actually run the linker and generates output
+
+Example: `buildwrapper build --output=true --cabaltarget=Source --tempfolder=.dist-buildwrapper --cabalpath=/home/myuser/.cabal/bin/cabal --cabalfile=/home/myuser/myproject/myproject.cabal --cabalflags= --logcabal=true`
+
 
 ## build1
 Build one file using the GHC API. BuildWrapper takes care of calling the API with the proper flags from the cabal file.
buildwrapper.cabal view
@@ -1,5 +1,5 @@ name:           buildwrapper-version:        0.8.1+version:        0.8.2 cabal-version:  >= 1.8 build-type:     Simple license:        BSD3
src-exe/Language/Haskell/BuildWrapper/CMD.hs view
@@ -162,9 +162,9 @@                 handle c@Synchronize{force=f}=runCmd c (synchronize f)
                 handle c@Synchronize1{force=f,file=fi}=runCmd c (synchronize1 f fi)
                 handle c@Write{file=fi,contents=s}=runCmd c (write fi s)
-                handle c@Configure{cabalTarget=w}=runCmd c (configure w)
+                handle c@Configure{verbosity=ve,cabalTarget=w}=runCmdV ve c (configure w)
                 handle c@Build{verbosity=ve,output=o,cabalTarget=w}=runCmdV ve c (build o w)
-                handle c@Build1{file=fi,component=mcomp}=if longRunning c+                handle c@Build1{file=fi,component=mcomp}= if longRunning c                                 then runCmd c $ build1LongRunning fi mcomp 
                                 else runCmd c $ build1 fi mcomp
                 handle c@GetBuildFlags{file=fi,component=mcomp}=runCmd c (getBuildFlags fi mcomp)
src/Language/Haskell/BuildWrapper/Cabal.hs view
@@ -479,9 +479,9 @@ setOptions dist_dir tgs=do
   let setup_config = DSC.localBuildInfoFile dist_dir
   cv<-DCD.getCabalVersion setup_config
-  let optStr=if cv>=Version [1,15,0] []
-               then "       let opts=renderGhcOptions ((fst $ head $ readP_to_S  parseVersion  \""++VERSION_ghc++"\") :: Version) $ componentGhcOptions V.silent lbi{withOptimization=NoOptimisation} b clbi fp"
-               else "       let opts=ghcOptions lbi{withOptimization=NoOptimisation} b clbi fp"
+  let optStr | cv>=Version [1,19,0] [] ="renderGhcOptions compiler $ componentGhcOptions V.silent lbi{withOptimization=NoOptimisation} b clbi fp"
+             | cv>=Version [1,15,0] [] ="renderGhcOptions ((fst $ head $ readP_to_S  parseVersion  \""++VERSION_ghc++"\") :: Version) $ componentGhcOptions V.silent lbi{withOptimization=NoOptimisation} b clbi fp"
+             | otherwise               ="ghcOptions lbi{withOptimization=NoOptimisation} b clbi fp"
   let withStr=if cv>=Version [1,17,0] []
                 then "withAllComponentsInBuildOrder"
                 else "withComponentsLBI"
@@ -501,6 +501,8 @@                 ,"import Distribution.Version"
                 ,"import Control.Monad"
                 ,"import Distribution.Simple.Compiler(OptimisationLevel(..))"
+                ,"import Distribution.Simple.Program.Db(defaultProgramDb)"
+                ,"import Distribution.Verbosity(normal)"
                 ,"import Data.Maybe"
                 ,""
                 ,"result :: IO (DM.Map String [String])"
@@ -509,11 +511,12 @@                 ,"let pkg=localPkgDescr lbi"
                 ,"r<-newIORef DM.empty"
                 ,"let fmp=DM."++ show fmp 
+                ,"(compiler,_ ,_)<-configure normal Nothing Nothing defaultProgramDb"
                 ,withStr++" pkg lbi (\\c clbi->do"
                 ,"       let b=componentBuildInfo c"
                 ,"       let n=foldComponent (const \"\") exeName testName benchmarkName c"
                 ,"       let fp=fromJust $ DM.lookup n fmp"
-                , optStr
+                ,"       let opts=" ++ optStr
                 ,"       modifyIORef r (DM.insert n opts)"
                 ,"       return ()"
                 ,"       )"