File tree 7 files changed +80
-10
lines changed
Cabal/Distribution/Simple/Build/Macros
cabal-testsuite/PackageTests/CabalMacros 7 files changed +80
-10
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ render z_root = execWriter $ do
72
72
tell " */\n "
73
73
tell " \n "
74
74
forM_ (zTools z_root) $ \ z_var1_tool -> do
75
- tell " /* package "
75
+ tell " /* tool "
76
76
tell (ztoolName z_var1_tool)
77
77
tell " -"
78
78
tell (prettyShow (ztoolVersion z_var1_tool))
@@ -85,7 +85,7 @@ render z_root = execWriter $ do
85
85
tell " \" "
86
86
tell (prettyShow (ztoolVersion z_var1_tool))
87
87
tell " \"\n "
88
- tell " #endif /* VERSION_ "
88
+ tell " #endif /* TOOL_VERSION_ "
89
89
tell (zMangleStr z_root (ztoolName z_var1_tool))
90
90
tell " */\n "
91
91
tell " #ifndef MIN_TOOL_VERSION_"
@@ -109,14 +109,14 @@ render z_root = execWriter $ do
109
109
tell " && (minor) <= "
110
110
tell (ztoolZ z_var1_tool)
111
111
tell " )\n "
112
- tell " #endif /* MIN_VERSION_ "
112
+ tell " #endif /* MIN_TOOL_VERSION_ "
113
113
tell (zMangleStr z_root (ztoolName z_var1_tool))
114
114
tell " */\n "
115
115
tell " \n "
116
116
if (zNotNull z_root (zPackageKey z_root))
117
117
then do
118
- tell " #ifndef CURRENT_packageKey \n "
119
- tell " #define CURRENT_packageKey \" "
118
+ tell " #ifndef CURRENT_PACKAGE_KEY \n "
119
+ tell " #define CURRENT_PACKAGE_KEY \" "
120
120
tell (zPackageKey z_root)
121
121
tell " \"\n "
122
122
tell " #endif /* CURRENT_packageKey */\n "
Original file line number Diff line number Diff line change 14
14
{% endfor %}
15
15
16
16
{% for tool in tools %}
17
- /* package {{ tool.name }}-{{ tool.version }} */
17
+ /* tool {{ tool.name }}-{{ tool.version }} */
18
18
#ifndef TOOL_VERSION_ {{ mangleStr tool .name }}
19
19
#define TOOL_VERSION_ {{ mangleStr tool.name }} "{{ tool.version }}"
20
- #endif /* VERSION_ {{ mangleStr tool.name }} */
20
+ #endif /* TOOL_VERSION_ {{ mangleStr tool.name }} */
21
21
#ifndef MIN_TOOL_VERSION_ {{ mangleStr tool .name }}
22
22
#define MIN_TOOL_VERSION_ {{ mangleStr tool.name }}(major1,major2,minor) (\
23
23
(major1) < {{ tool.x }} || \
24
24
(major1) == {{ tool.x }} && (major2) < {{ tool.y }} || \
25
25
(major1) == {{ tool.x }} && (major2) == {{ tool.y }} && (minor) <= {{ tool.z }})
26
- #endif /* MIN_VERSION_ {{ mangleStr tool.name }} */
26
+ #endif /* MIN_TOOL_VERSION_ {{ mangleStr tool.name }} */
27
27
{% endfor %}
28
28
29
29
{% if notNull packageKey %}
30
- #ifndef CURRENT_packageKey
31
- #define CURRENT_packageKey "{{ packageKey }}"
30
+ #ifndef CURRENT_PACKAGE_KEY
31
+ #define CURRENT_PACKAGE_KEY "{{ packageKey }}"
32
32
#endif /* CURRENT_packageKey */
33
33
{% endif %}
34
34
{% if notNull componentId %}
Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE CPP #-}
2
+ module Mdl where
3
+
4
+ answer :: Int
5
+ answer = 42
Original file line number Diff line number Diff line change
1
+ cabal-version : 2.1
2
+ name : CabalMacros
3
+ version : 0.1
4
+ license : BSD-3-Clause
5
+ author : Oleg Grenrus
6
+ stability : stable
7
+ category : PackageTests
8
+ build-type : Simple
9
+
10
+ description :
11
+ Check that the generated cabal_macros.h is intact.
12
+
13
+ Library
14
+ exposed-modules : Mdl
15
+ build-depends : base
16
+ default-language : Haskell2010
Original file line number Diff line number Diff line change
1
+ # Setup configure
2
+ Resolving dependencies...
3
+ Configuring CabalMacros-0.1...
4
+ # Setup build
5
+ Preprocessing library for CabalMacros-0.1..
6
+ Building library for CabalMacros-0.1..
7
+ # cabal_macros.h
8
+ #ifndef CURRENT_PACKAGE_KEY
9
+ #define CURRENT_PACKAGE_KEY "CabalMacros-0.1"
10
+ #endif /* CURRENT_packageKey */
11
+ #ifndef CURRENT_COMPONENT_ID
12
+ #define CURRENT_COMPONENT_ID "CabalMacros-0.1"
13
+ #endif /* CURRENT_COMPONENT_ID */
14
+ #ifndef CURRENT_PACKAGE_VERSION
15
+ #define CURRENT_PACKAGE_VERSION "0.1"
16
+ #endif /* CURRENT_PACKAGE_VERSION */
Original file line number Diff line number Diff line change
1
+ # Setup configure
2
+ Configuring CabalMacros-0.1...
3
+ # Setup build
4
+ Preprocessing library for CabalMacros-0.1..
5
+ Building library for CabalMacros-0.1..
6
+ # cabal_macros.h
7
+ #ifndef CURRENT_PACKAGE_KEY
8
+ #define CURRENT_PACKAGE_KEY "CabalMacros-0.1"
9
+ #endif /* CURRENT_packageKey */
10
+ #ifndef CURRENT_COMPONENT_ID
11
+ #define CURRENT_COMPONENT_ID "CabalMacros-0.1"
12
+ #endif /* CURRENT_COMPONENT_ID */
13
+ #ifndef CURRENT_PACKAGE_VERSION
14
+ #define CURRENT_PACKAGE_VERSION "0.1"
15
+ #endif /* CURRENT_PACKAGE_VERSION */
Original file line number Diff line number Diff line change
1
+ import Test.Cabal.Prelude
2
+ import qualified Data.ByteString.Char8 as BS8
3
+
4
+ main = setupAndCabalTest $ do
5
+ env <- getTestEnv
6
+ let mode = testRecordMode env
7
+
8
+ setup_build []
9
+ let autogenDir = testDistDir env </> " build" </> " autogen"
10
+
11
+ defaultRecordMode RecordAll $ recordHeader [" cabal_macros.h" ]
12
+ contents <- liftIO $ BS8. readFile $ autogenDir </> " cabal_macros.h"
13
+ -- we are only interested in CURRENT_ lines
14
+ -- others change a lot based on available tools in the environment
15
+ let contents' = BS8. unlines
16
+ $ filter (BS8. isInfixOf $ BS8. pack " CURRENT" )
17
+ $ BS8. lines contents
18
+ liftIO $ BS8. appendFile (testActualFile env) contents'
You can’t perform that action at this time.
0 commit comments