Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove optimization flags

  • Loading branch information...
commit 144070e978266db6705b3cffdd08e0bf6ac04f2d 1 parent 3693e0d
@JPMoresmau authored
View
2  buildwrapper.cabal
@@ -1,5 +1,5 @@
name: buildwrapper
-version: 0.6.2
+version: 0.6.3
cabal-version: >= 1.8
build-type: Simple
license: BSD3
View
6 src/Language/Haskell/BuildWrapper/GHC.hs
@@ -108,8 +108,10 @@ withASTNotes :: GHCApplyFunction a -- ^ the final action to perform on the resu
-> [String] -- ^ the GHC options
-> IO (OpResult [a])
withASTNotes f ff base_dir contents options=do
- let lflags=map noLoc options
- -- print options
+ -- http://hackage.haskell.org/trac/ghc/ticket/7380#comment:1 : -O2 is removed from the options
+ let cleaned=filter (not . List.isInfixOf "-O") options
+ let lflags=map noLoc cleaned
+ print cleaned
(_leftovers, _) <- parseStaticFlags lflags
runGhc (Just libdir) $ do
flg <- getSessionDynFlags
View
39 test/Language/Haskell/BuildWrapper/Tests.hs
@@ -40,6 +40,7 @@ tests= [
testBuildErrors,
testBuildWarnings,
testBuildOutput,
+ testBuildO2,
testModuleNotInCabal,
testOutline,
testOutlinePreproc,
@@ -406,6 +407,44 @@ testBuildOutput api = TestLabel "testBuildOutput" (TestCase ( do
assertBool ("exe exists after build no output: "++exeF) (not exeE3)
))
+-- | http://hackage.haskell.org/trac/ghc/ticket/7380#comment:1 : -O2 is removed from the options
+testBuildO2 :: (APIFacade a)=> a -> Test
+testBuildO2 api = TestLabel "testBuildO2" (TestCase ( do
+ root<-createTestProject
+ write api root (testProjectName <.> ".cabal") $ unlines ["name: "++testProjectName,
+ "version:0.1",
+ "cabal-version: >= 1.8",
+ "build-type: Simple",
+ "",
+ "library",
+ " hs-source-dirs: src",
+ " exposed-modules: A",
+ " other-modules: B.C",
+ " build-depends: base",
+ "",
+ "executable BWTest",
+ " hs-source-dirs: src",
+ " main-is: Main.hs",
+ " other-modules: B.D",
+ " build-depends: base",
+ " ghc-options: -O2",
+ "",
+ "test-suite BWTest-test",
+ " type: exitcode-stdio-1.0",
+ " hs-source-dirs: test",
+ " main-is: Main.hs",
+ " other-modules: TestA",
+ " build-depends: base",
+ ""
+ ]
+ configure api root Target
+ let rel="src"</>"Main.hs"
+ writeFile (root </> rel) $ unlines ["module Main where","main :: IO()","main= putStrLn \"Hello World\""]
+ synchronize api root False
+ (ns, nsErrors2)<-build1 api root rel
+ assertBool ("returned nothing on ns: " ++ show nsErrors2) (isJust ns)
+ ))
+
testModuleNotInCabal :: (APIFacade a)=> a -> Test
testModuleNotInCabal api = TestLabel "testModuleNotInCabal" (TestCase ( do
root<-createTestProject
View
2  test/Main.hs
@@ -26,7 +26,7 @@ tests :: [Test]
tests = [
testGroup "Unit Tests" (concatMap hUnitTestToTests unitTests),
testGroup "GHC Tests" (concatMap hUnitTestToTests ghcTests),
- testGroup "Command Tests" (concatMap hUnitTestToTests cmdTests) ,
+ testGroup "Command Tests" (concatMap hUnitTestToTests cmdTests),
testGroup "Usages Tests" (concatMap hUnitTestToTests usageTests)
]
Please sign in to comment.
Something went wrong with that request. Please try again.