Skip to content

Commit

Permalink
adding coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudkite committed Aug 27, 2013
1 parent af55c70 commit f6be2a3
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
language: objective-c
language: objective-c

before_script:
- brew update
- brew install xctool
before_script:
- sudo easy_install cpp-coveralls
- brew update
- brew install xctool

script:
- xctool -workspace 'Masonry.xcworkspace' -scheme 'Masonry iOS' -configuration Debug -sdk iphonesimulator6.0 clean build test
- xctool -workspace 'Masonry.xcworkspace' -scheme 'Masonry Mac' -configuration Debug -sdk macosx10.7 clean build test
script:
- xctool -workspace 'Masonry.xcworkspace' -scheme 'Masonry iOS' -configuration Debug -sdk iphonesimulator6.0 clean build test
- xctool -workspace 'Masonry.xcworkspace' -scheme 'Masonry Mac' -configuration Debug -sdk macosx10.7 clean build test

after_success:
- ./script/coveralls.sh
16 changes: 16 additions & 0 deletions Masonry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@
DDA4D6E717C0253B0076BD87 /* Frameworks */,
DDA4D6E817C0253B0076BD87 /* Headers */,
DDA4D6E917C0253B0076BD87 /* Resources */,
DDCD4D0517CD6A3F00927D72 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -574,6 +575,19 @@
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
DDCD4D0517CD6A3F00927D72 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = script/exportenv.sh;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -787,6 +801,8 @@
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
FRAMEWORK_VERSION = A;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down
40 changes: 40 additions & 0 deletions script/coveralls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

source env.sh
declare -r gcov_dir="${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/"

## ======

generateGcov()
{
# doesn't set output dir to gcov...
cd "${gcov_dir}"
for file in ${gcov_dir}/*.gcda
do
gcov-4.2 "${file}" -o "${gcov_dir}"
done
cd -
}

copyGcovToProjectDir()
{
cp -r "${gcov_dir}" gcov
}

removeGcov()
{
rm -r gcov
}

main()
{
# generate + copy
generateGcov
copyGcovToProjectDir
# post
coveralls ${@+"$@"}
# clean up
removeGcov
}

main ${@+"$@"}
1 change: 1 addition & 0 deletions script/exportenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > script/env.sh

0 comments on commit f6be2a3

Please sign in to comment.