Fixed broken single header following script change

- fixed the script (was missing #ifdefs)
- also fixed single include (Xcode) test project
- build 16
This commit is contained in:
Phil Nash 2013-12-04 20:25:14 +00:00
parent 87b20e8dab
commit de49ec4d7c
6 changed files with 120 additions and 124 deletions

View File

@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png)
*v1.0 build 15 (master branch)*
*v1.0 build 16 (master branch)*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)

View File

@ -13,7 +13,7 @@
namespace Catch {
// These numbers are maintained by a script
Version libraryVersion( 1, 0, 15, "master" );
Version libraryVersion( 1, 0, 16, "master" );
}
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -14,13 +14,6 @@
#pragma clang diagnostic ignored "-Wweak-vtables"
#endif
#include "internal/catch_text.h"
#include "internal/catch_console_colour.hpp"
#include "internal/catch_commandline.hpp"
#include "internal/catch_test_spec.h"
#include "reporters/catch_reporter_xml.hpp"
template<size_t size>
void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) {
Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();

View File

@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */
4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D515D3956000E20735 /* ApproxTests.cpp */; };
4AB735F815D396ED00F9F7C3 /* catch_self_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894D815D3957500E20735 /* catch_self_test.cpp */; };
4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894E015D3957500E20735 /* TestMain.cpp */; };
4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DA15D3957500E20735 /* ClassTests.cpp */; };
4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A2894DB15D3957500E20735 /* ConditionTests.cpp */; };
@ -33,8 +32,6 @@
/* Begin PBXFileReference section */
4A2894D515D3956000E20735 /* ApproxTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ApproxTests.cpp; path = ../../../SelfTest/ApproxTests.cpp; sourceTree = "<group>"; };
4A2894D815D3957500E20735 /* catch_self_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = catch_self_test.cpp; path = ../../../SelfTest/catch_self_test.cpp; sourceTree = "<group>"; };
4A2894D915D3957500E20735 /* catch_self_test.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = catch_self_test.hpp; path = ../../../SelfTest/catch_self_test.hpp; sourceTree = "<group>"; };
4A2894DA15D3957500E20735 /* ClassTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ClassTests.cpp; path = ../../../SelfTest/ClassTests.cpp; sourceTree = "<group>"; };
4A2894DB15D3957500E20735 /* ConditionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ConditionTests.cpp; path = ../../../SelfTest/ConditionTests.cpp; sourceTree = "<group>"; };
4A2894DC15D3957500E20735 /* ExceptionTests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ExceptionTests.cpp; path = ../../../SelfTest/ExceptionTests.cpp; sourceTree = "<group>"; };
@ -61,8 +58,6 @@
isa = PBXGroup;
children = (
4A2894E015D3957500E20735 /* TestMain.cpp */,
4A2894D815D3957500E20735 /* catch_self_test.cpp */,
4A2894D915D3957500E20735 /* catch_self_test.hpp */,
);
name = "Self Test";
sourceTree = "<group>";
@ -159,7 +154,6 @@
buildActionMask = 2147483647;
files = (
4A2894D615D3956000E20735 /* ApproxTests.cpp in Sources */,
4AB735F815D396ED00F9F7C3 /* catch_self_test.cpp in Sources */,
4AB735FA15D396F400F9F7C3 /* TestMain.cpp in Sources */,
4AB735FB15D3970C00F9F7C3 /* ClassTests.cpp in Sources */,
4AB735FC15D3971100F9F7C3 /* ConditionTests.cpp in Sources */,
@ -224,6 +218,7 @@
4A90B5E115D2E3E900EF71BC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
HEADER_SEARCH_PATHS = "../../../single_include/**";
PRODUCT_NAME = "$(TARGET_NAME)";
};
@ -232,6 +227,7 @@
4A90B5E215D2E3E900EF71BC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
HEADER_SEARCH_PATHS = "../../../single_include/**";
PRODUCT_NAME = "$(TARGET_NAME)";
};

View File

@ -26,125 +26,126 @@ bumpVersion = True
includeImpl = True
for arg in sys.argv[1:]:
arg = string.lower(arg)
if arg == "nobump":
bumpVersion = False
print "Not bumping version number"
elif arg == "noimpl":
includeImpl = False
bumpVersion = False
print "Not including impl code (and not bumping version)"
else:
print "\n** Unrecognised argument: " + arg + " **\n"
exit(1)
arg = string.lower(arg)
if arg == "nobump":
bumpVersion = False
print "Not bumping version number"
elif arg == "noimpl":
includeImpl = False
bumpVersion = False
print "Not including impl code (and not bumping version)"
else:
print "\n** Unrecognised argument: " + arg + " **\n"
exit(1)
out = open( outputPath, 'w' )
ifdefs = 0
implIfDefs = -1
def write( line ):
if includeImpl or implIfDefs == -1:
out.write( line )
if includeImpl or implIfDefs == -1:
out.write( line )
def parseFile( path, filename ):
global ifdefs
global implIfDefs
global ifdefs
global implIfDefs
f = open( path + filename, 'r' )
blanks = 0
for line in f:
if ifParser.match( line ):
ifdefs = ifdefs + 1
elif endIfParser.match( line ):
ifdefs = ifdefs - 1
m = includesParser.match( line )
if m:
header = m.group(1)
headerPath, sep, headerFile = header.rpartition( "/" )
if not headerFile in seenHeaders:
seenHeaders.add( headerFile )
write( "// #included from: {0}\n".format( header ) )
if( headerPath == "internal" and path.endswith( "internal/" ) ):
headerPath = ""
sep = ""
if os.path.exists( path + headerPath + sep + headerFile ):
parseFile( path + headerPath + sep, headerFile )
else:
parseFile( rootPath + headerPath + sep, headerFile )
elif ifImplParser.match(line):
implIfDefs = ifdefs
elif (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
if blankParser.match( line ):
blanks = blanks + 1
else:
blanks = 0
if blanks < 2:
write( line.rstrip() + "\n" )
f = open( path + filename, 'r' )
blanks = 0
for line in f:
if ifParser.match( line ):
ifdefs = ifdefs + 1
elif endIfParser.match( line ):
ifdefs = ifdefs - 1
m = includesParser.match( line )
if m:
header = m.group(1)
headerPath, sep, headerFile = header.rpartition( "/" )
if not headerFile in seenHeaders:
seenHeaders.add( headerFile )
write( "// #included from: {0}\n".format( header ) )
if( headerPath == "internal" and path.endswith( "internal/" ) ):
headerPath = ""
sep = ""
if os.path.exists( path + headerPath + sep + headerFile ):
parseFile( path + headerPath + sep, headerFile )
else:
parseFile( rootPath + headerPath + sep, headerFile )
else:
if ifImplParser.match(line):
implIfDefs = ifdefs
if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
if blankParser.match( line ):
blanks = blanks + 1
else:
blanks = 0
if blanks < 2:
write( line.rstrip() + "\n" )
class Version:
def __init__(self):
f = open( versionPath, 'r' )
for line in f:
m = versionParser.match( line )
if m:
self.variableDecl = m.group(1)
self.majorVersion = int(m.group(2))
self.minorVersion = int(m.group(3))
self.buildNumber = int(m.group(4))
self.branchName = m.group(5)
f.close()
def __init__(self):
f = open( versionPath, 'r' )
for line in f:
m = versionParser.match( line )
if m:
self.variableDecl = m.group(1)
self.majorVersion = int(m.group(2))
self.minorVersion = int(m.group(3))
self.buildNumber = int(m.group(4))
self.branchName = m.group(5)
f.close()
def incrementBuildNumber(self):
self.buildNumber = self.buildNumber+1
def incrementBuildNumber(self):
self.buildNumber = self.buildNumber+1
def updateVersionFile(self):
f = open( versionPath, 'r' )
lines = []
for line in f:
m = versionParser.match( line )
if m:
lines.append( '{0}( {1}, {2}, {3}, "{4}" );'.format( self.variableDecl, self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) )
else:
lines.append( line.rstrip() )
f.close()
f = open( versionPath, 'w' )
for line in lines:
f.write( line + "\n" )
def updateVersionFile(self):
f = open( versionPath, 'r' )
lines = []
for line in f:
m = versionParser.match( line )
if m:
lines.append( '{0}( {1}, {2}, {3}, "{4}" );'.format( self.variableDecl, self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) )
else:
lines.append( line.rstrip() )
f.close()
f = open( versionPath, 'w' )
for line in lines:
f.write( line + "\n" )
def updateReadmeFile(self):
f = open( readmePath, 'r' )
lines = []
for line in f:
lines.append( line.rstrip() )
f.close()
f = open( readmePath, 'w' )
for line in lines:
if line.startswith( "*v" ):
f.write( '*v{0}.{1} build {2} ({3} branch)*\n'.format( self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) )
else:
f.write( line + "\n" )
def updateReadmeFile(self):
f = open( readmePath, 'r' )
lines = []
for line in f:
lines.append( line.rstrip() )
f.close()
f = open( readmePath, 'w' )
for line in lines:
if line.startswith( "*v" ):
f.write( '*v{0}.{1} build {2} ({3} branch)*\n'.format( self.majorVersion, self.minorVersion, self.buildNumber, self.branchName ) )
else:
f.write( line + "\n" )
def generateSingleInclude():
v = Version()
if bumpVersion:
v.incrementBuildNumber()
v.updateVersionFile()
v.updateReadmeFile()
out.write( "/*\n" )
out.write( " * CATCH v{0}.{1} build {2} ({3} branch)\n".format( v.majorVersion, v.minorVersion, v.buildNumber, v.branchName ) )
out.write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
out.write( " * ----------------------------------------------------------\n" )
out.write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
out.write( " * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.\n" )
out.write( " *\n" )
out.write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
out.write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
out.write( " */\n" )
out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
parseFile( rootPath, 'catch.hpp' )
out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
v = Version()
if bumpVersion:
v.incrementBuildNumber()
v.updateVersionFile()
v.updateReadmeFile()
out.write( "/*\n" )
out.write( " * CATCH v{0}.{1} build {2} ({3} branch)\n".format( v.majorVersion, v.minorVersion, v.buildNumber, v.branchName ) )
out.write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
out.write( " * ----------------------------------------------------------\n" )
out.write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
out.write( " * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.\n" )
out.write( " *\n" )
out.write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
out.write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
out.write( " */\n" )
out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
parseFile( rootPath, 'catch.hpp' )
out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
generateSingleInclude()

View File

@ -1,6 +1,6 @@
/*
* CATCH v1.0 build 15 (master branch)
* Generated: 2013-12-03 18:52:51.480072
* CATCH v1.0 build 16 (master branch)
* Generated: 2013-12-04 20:23:35.145591
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -178,7 +178,7 @@ namespace Catch {
struct SourceLineInfo {
SourceLineInfo();
SourceLineInfo( std::string const& _file, std::size_t _line );
SourceLineInfo( char const* _file, std::size_t _line );
SourceLineInfo( SourceLineInfo const& other );
bool empty() const;
bool operator == ( SourceLineInfo const& other ) const;
@ -2591,6 +2591,7 @@ return @ desc; \
#endif
#if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER )
// #included from: internal/catch_impl.hpp
#define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
@ -5786,6 +5787,10 @@ namespace Catch {
if( tags.find( "hide" ) != tags.end() || tags.find( "." ) != tags.end() )
isHidden = true;
if( isHidden ) {
tags.insert( "hide" );
tags.insert( "." );
}
TestCaseInfo info( _name, _className, desc, tags, isHidden, _lineInfo );
return TestCase( _testCase, info );
}
@ -6134,7 +6139,7 @@ namespace Catch {
namespace Catch {
// These numbers are maintained by a script
Version libraryVersion( 1, 0, 15, "master" );
Version libraryVersion( 1, 0, 16, "master" );
}
// #included from: catch_text.hpp
@ -6473,7 +6478,7 @@ namespace Catch {
}
SourceLineInfo::SourceLineInfo() : line( 0 ){}
SourceLineInfo::SourceLineInfo( std::string const& _file, std::size_t _line )
SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line )
: file( _file ),
line( _line )
{}
@ -7866,6 +7871,7 @@ namespace Catch {
#endif // CATCH_CONFIG_MAIN || CATCH_CONFIG_RUNNER
#ifdef CATCH_CONFIG_MAIN
// #included from: internal/catch_default_main.hpp
#define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED