forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for internal libraries (haskell#269) and separate cabal_macros.h (
haskell#1893) Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
- Loading branch information
Showing
22 changed files
with
255 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Cabal/tests/PackageTests/InternalLibraries/Executable/exe/Main.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Foo | ||
main = print (foo 23) |
18 changes: 18 additions & 0 deletions
18
Cabal/tests/PackageTests/InternalLibraries/Executable/foo.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: foo | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
author: Edward Z. Yang | ||
maintainer: ezyang@cs.stanford.edu | ||
build-type: Simple | ||
cabal-version: >=1.23 | ||
|
||
library foo-internal | ||
exposed-modules: Foo | ||
build-depends: base | ||
hs-source-dirs: src | ||
default-language: Haskell2010 | ||
|
||
executable foo | ||
main-is: Main.hs | ||
build-depends: base, foo-internal | ||
hs-source-dirs: exe |
4 changes: 4 additions & 0 deletions
4
Cabal/tests/PackageTests/InternalLibraries/Executable/src/Foo.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Foo where | ||
{-# NOINLINE foo #-} | ||
foo :: Int -> Int | ||
foo x = x + 23 |
6 changes: 6 additions & 0 deletions
6
Cabal/tests/PackageTests/InternalLibraries/Library/fooexe/Main.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Main where | ||
|
||
import Foo | ||
|
||
main :: IO () | ||
main = print foo |
12 changes: 12 additions & 0 deletions
12
Cabal/tests/PackageTests/InternalLibraries/Library/fooexe/fooexe.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: fooexe | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
author: Edward Z. Yang | ||
maintainer: ezyang@cs.stanford.edu | ||
build-type: Simple | ||
cabal-version: >=1.10 | ||
|
||
executable fooexe | ||
main-is: Main.hs | ||
build-depends: base, foolib | ||
default-language: Haskell2010 |
3 changes: 3 additions & 0 deletions
3
Cabal/tests/PackageTests/InternalLibraries/Library/foolib/Foo.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Foo where | ||
import Internal | ||
foo = internal + 2 |
17 changes: 17 additions & 0 deletions
17
Cabal/tests/PackageTests/InternalLibraries/Library/foolib/foolib.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: foolib | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
author: Edward Z. Yang | ||
maintainer: ezyang@cs.stanford.edu | ||
build-type: Simple | ||
cabal-version: >=1.23 | ||
|
||
library foolib-internal | ||
exposed-modules: Internal | ||
hs-source-dirs: private | ||
build-depends: base | ||
|
||
library | ||
exposed-modules: Foo | ||
build-depends: base, foolib-internal | ||
default-language: Haskell2010 |
4 changes: 4 additions & 0 deletions
4
Cabal/tests/PackageTests/InternalLibraries/Library/foolib/private/Internal.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Internal where | ||
{-# NOINLINE internal #-} | ||
internal :: Int | ||
internal = 23 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{-# LANGUAGE CPP #-} | ||
import C | ||
#ifdef VERSION_filepath | ||
#error "Should not see macro from library" | ||
#endif | ||
#ifdef VERSION_containers | ||
#error "Should not see macro from executable macros-b" | ||
#endif | ||
main = do | ||
putStrLn CURRENT_COMPONENT_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{-# LANGUAGE CPP #-} | ||
import C | ||
#ifdef VERSION_filepath | ||
#error "Should not see macro from library" | ||
#endif | ||
#ifdef VERSION_deepseq | ||
#error "Should not see macro from executable macros-a" | ||
#endif | ||
main = do | ||
putStrLn CURRENT_COMPONENT_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Main where | ||
|
||
main :: IO () | ||
main = putStrLn "Hello, Haskell!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: macros | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
license-file: LICENSE | ||
author: Edward Z. Yang | ||
maintainer: ezyang@cs.stanford.edu | ||
build-type: Simple | ||
cabal-version: >=1.10 | ||
|
||
library macros | ||
exposed-modules: C | ||
hs-source-dirs: src | ||
build-depends: base, filepath | ||
|
||
executable macros-a | ||
main-is: A.hs | ||
build-depends: base, deepseq, macros | ||
default-language: Haskell2010 | ||
|
||
executable macros-b | ||
main-is: B.hs | ||
build-depends: base, containers, macros | ||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{-# LANGUAGE CPP #-} | ||
module C where | ||
#ifdef VERSION_deepseq | ||
#error "Should not see macro from executable macros-a" | ||
#endif | ||
#ifdef VERSION_containers | ||
#error "Should not see macro from executable macros-b" | ||
#endif | ||
c :: String | ||
c = CURRENT_COMPONENT_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.