Skip to content
Snippets Groups Projects
Commit 1624e53d authored by Oleg Grenrus's avatar Oleg Grenrus
Browse files

Correct casing of CURRENT_PACKAGE_KEY

Fixes #6533
parent 202a1787
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ render z_root = execWriter $ do
tell " */\n"
tell "\n"
forM_ (zTools z_root) $ \z_var1_tool -> do
tell "/* package "
tell "/* tool "
tell (ztoolName z_var1_tool)
tell "-"
tell (prettyShow (ztoolVersion z_var1_tool))
......@@ -85,7 +85,7 @@ render z_root = execWriter $ do
tell " \""
tell (prettyShow (ztoolVersion z_var1_tool))
tell "\"\n"
tell "#endif /* VERSION_"
tell "#endif /* TOOL_VERSION_"
tell (zMangleStr z_root (ztoolName z_var1_tool))
tell " */\n"
tell "#ifndef MIN_TOOL_VERSION_"
......@@ -109,14 +109,14 @@ render z_root = execWriter $ do
tell " && (minor) <= "
tell (ztoolZ z_var1_tool)
tell ")\n"
tell "#endif /* MIN_VERSION_"
tell "#endif /* MIN_TOOL_VERSION_"
tell (zMangleStr z_root (ztoolName z_var1_tool))
tell " */\n"
tell "\n"
if (zNotNull z_root (zPackageKey z_root))
then do
tell "#ifndef CURRENT_packageKey\n"
tell "#define CURRENT_packageKey \""
tell "#ifndef CURRENT_PACKAGE_KEY\n"
tell "#define CURRENT_PACKAGE_KEY \""
tell (zPackageKey z_root)
tell "\"\n"
tell "#endif /* CURRENT_packageKey */\n"
......
......@@ -14,21 +14,21 @@
{% endfor %}
{% for tool in tools %}
/* package {{ tool.name }}-{{ tool.version }} */
/* tool {{ tool.name }}-{{ tool.version }} */
#ifndef TOOL_VERSION_{{ mangleStr tool.name }}
#define TOOL_VERSION_{{ mangleStr tool.name }} "{{ tool.version }}"
#endif /* VERSION_{{ mangleStr tool.name }} */
#endif /* TOOL_VERSION_{{ mangleStr tool.name }} */
#ifndef MIN_TOOL_VERSION_{{ mangleStr tool.name }}
#define MIN_TOOL_VERSION_{{ mangleStr tool.name }}(major1,major2,minor) (\
(major1) < {{ tool.x }} || \
(major1) == {{ tool.x }} && (major2) < {{ tool.y }} || \
(major1) == {{ tool.x }} && (major2) == {{ tool.y }} && (minor) <= {{ tool.z }})
#endif /* MIN_VERSION_{{ mangleStr tool.name }} */
#endif /* MIN_TOOL_VERSION_{{ mangleStr tool.name }} */
{% endfor %}
{% if notNull packageKey %}
#ifndef CURRENT_packageKey
#define CURRENT_packageKey "{{ packageKey }}"
#ifndef CURRENT_PACKAGE_KEY
#define CURRENT_PACKAGE_KEY "{{ packageKey }}"
#endif /* CURRENT_packageKey */
{% endif %}
{% if notNull componentId %}
......
{-# LANGUAGE CPP #-}
module Mdl where
answer :: Int
answer = 42
cabal-version: 2.1
name: CabalMacros
version: 0.1
license: BSD-3-Clause
author: Oleg Grenrus
stability: stable
category: PackageTests
build-type: Simple
description:
Check that the generated cabal_macros.h is intact.
Library
exposed-modules: Mdl
build-depends: base
default-language: Haskell2010
# Setup configure
Resolving dependencies...
Configuring CabalMacros-0.1...
# Setup build
Preprocessing library for CabalMacros-0.1..
Building library for CabalMacros-0.1..
# cabal_macros.h
#ifndef CURRENT_PACKAGE_KEY
#define CURRENT_PACKAGE_KEY "CabalMacros-0.1"
#endif /* CURRENT_packageKey */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "CabalMacros-0.1"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */
# Setup configure
Configuring CabalMacros-0.1...
# Setup build
Preprocessing library for CabalMacros-0.1..
Building library for CabalMacros-0.1..
# cabal_macros.h
#ifndef CURRENT_PACKAGE_KEY
#define CURRENT_PACKAGE_KEY "CabalMacros-0.1"
#endif /* CURRENT_packageKey */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "CabalMacros-0.1"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1"
#endif /* CURRENT_PACKAGE_VERSION */
import Test.Cabal.Prelude
import qualified Data.ByteString.Char8 as BS8
main = setupAndCabalTest $ do
env <- getTestEnv
let mode = testRecordMode env
setup_build []
let autogenDir = testDistDir env </> "build" </> "autogen"
defaultRecordMode RecordAll $ recordHeader ["cabal_macros.h"]
contents <- liftIO $ BS8.readFile $ autogenDir </> "cabal_macros.h"
-- we are only interested in CURRENT_ lines
-- others change a lot based on available tools in the environment
let contents' = BS8.unlines
$ filter (BS8.isInfixOf $ BS8.pack "CURRENT")
$ BS8.lines contents
liftIO $ BS8.appendFile (testActualFile env) contents'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment