Quellcode durchsuchen

adding coveralls

Jonas Budelmann vor 12 Jahren
Ursprung
Commit
f6be2a3b74
4 geänderte Dateien mit 68 neuen und 7 gelöschten Zeilen
  1. 11 7
      .travis.yml
  2. 16 0
      Masonry.xcodeproj/project.pbxproj
  3. 40 0
      script/coveralls.sh
  4. 1 0
      script/exportenv.sh

+ 11 - 7
.travis.yml

@@ -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 - 0
Masonry.xcodeproj/project.pbxproj

@@ -403,6 +403,7 @@
 				DDA4D6E717C0253B0076BD87 /* Frameworks */,
 				DDA4D6E817C0253B0076BD87 /* Headers */,
 				DDA4D6E917C0253B0076BD87 /* Resources */,
+				DDCD4D0517CD6A3F00927D72 /* ShellScript */,
 			);
 			buildRules = (
 			);
@@ -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 */
@@ -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;

+ 40 - 0
script/coveralls.sh

@@ -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 - 0
script/exportenv.sh

@@ -0,0 +1 @@
+export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > script/env.sh