xcodebuild-helper 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +4 -220
- data/.codeclimate.yml +0 -20
- data/.gitignore +0 -1
- data/.rspec +0 -2
- data/.travis.yml +0 -7
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -114
- data/Guardfile +0 -18
- data/README.md +0 -7
- data/Rakefile +0 -7
- data/assets/style.css +0 -110
- data/bin/oclint +0 -5
- data/bin/oclint-0.8 +0 -5
- data/bin/oclint-json-compilation-database +0 -5
- data/bin/oclint-xcodebuild +0 -5
- data/externals/oclint/LICENSE +0 -69
- data/externals/oclint/bin/oclint +0 -0
- data/externals/oclint/bin/oclint-0.10.2 +0 -0
- data/externals/oclint/bin/oclint-json-compilation-database +0 -88
- data/externals/oclint/bin/oclint-xcodebuild +0 -218
- data/externals/oclint/lib/clang/3.7.0/asan_blacklist.txt +0 -13
- data/externals/oclint/lib/clang/3.7.0/include/Intrin.h +0 -958
- data/externals/oclint/lib/clang/3.7.0/include/__stddef_max_align_t.h +0 -43
- data/externals/oclint/lib/clang/3.7.0/include/__wmmintrin_aes.h +0 -72
- data/externals/oclint/lib/clang/3.7.0/include/__wmmintrin_pclmul.h +0 -34
- data/externals/oclint/lib/clang/3.7.0/include/adxintrin.h +0 -88
- data/externals/oclint/lib/clang/3.7.0/include/altivec.h +0 -13528
- data/externals/oclint/lib/clang/3.7.0/include/ammintrin.h +0 -215
- data/externals/oclint/lib/clang/3.7.0/include/arm_acle.h +0 -304
- data/externals/oclint/lib/clang/3.7.0/include/arm_neon.h +0 -68419
- data/externals/oclint/lib/clang/3.7.0/include/avx2intrin.h +0 -1256
- data/externals/oclint/lib/clang/3.7.0/include/avx512bwintrin.h +0 -1250
- data/externals/oclint/lib/clang/3.7.0/include/avx512cdintrin.h +0 -131
- data/externals/oclint/lib/clang/3.7.0/include/avx512dqintrin.h +0 -242
- data/externals/oclint/lib/clang/3.7.0/include/avx512erintrin.h +0 -285
- data/externals/oclint/lib/clang/3.7.0/include/avx512fintrin.h +0 -2457
- data/externals/oclint/lib/clang/3.7.0/include/avx512vlbwintrin.h +0 -1907
- data/externals/oclint/lib/clang/3.7.0/include/avx512vldqintrin.h +0 -353
- data/externals/oclint/lib/clang/3.7.0/include/avx512vlintrin.h +0 -1982
- data/externals/oclint/lib/clang/3.7.0/include/avxintrin.h +0 -1308
- data/externals/oclint/lib/clang/3.7.0/include/bmi2intrin.h +0 -99
- data/externals/oclint/lib/clang/3.7.0/include/bmiintrin.h +0 -153
- data/externals/oclint/lib/clang/3.7.0/include/cpuid.h +0 -209
- data/externals/oclint/lib/clang/3.7.0/include/cuda_builtin_vars.h +0 -110
- data/externals/oclint/lib/clang/3.7.0/include/emmintrin.h +0 -1480
- data/externals/oclint/lib/clang/3.7.0/include/f16cintrin.h +0 -63
- data/externals/oclint/lib/clang/3.7.0/include/float.h +0 -124
- data/externals/oclint/lib/clang/3.7.0/include/fma4intrin.h +0 -236
- data/externals/oclint/lib/clang/3.7.0/include/fmaintrin.h +0 -234
- data/externals/oclint/lib/clang/3.7.0/include/fxsrintrin.h +0 -55
- data/externals/oclint/lib/clang/3.7.0/include/htmintrin.h +0 -226
- data/externals/oclint/lib/clang/3.7.0/include/htmxlintrin.h +0 -363
- data/externals/oclint/lib/clang/3.7.0/include/ia32intrin.h +0 -101
- data/externals/oclint/lib/clang/3.7.0/include/immintrin.h +0 -203
- data/externals/oclint/lib/clang/3.7.0/include/inttypes.h +0 -102
- data/externals/oclint/lib/clang/3.7.0/include/iso646.h +0 -43
- data/externals/oclint/lib/clang/3.7.0/include/limits.h +0 -118
- data/externals/oclint/lib/clang/3.7.0/include/lzcntintrin.h +0 -72
- data/externals/oclint/lib/clang/3.7.0/include/mm3dnow.h +0 -167
- data/externals/oclint/lib/clang/3.7.0/include/mm_malloc.h +0 -75
- data/externals/oclint/lib/clang/3.7.0/include/mmintrin.h +0 -507
- data/externals/oclint/lib/clang/3.7.0/include/module.modulemap +0 -196
- data/externals/oclint/lib/clang/3.7.0/include/nmmintrin.h +0 -35
- data/externals/oclint/lib/clang/3.7.0/include/pmmintrin.h +0 -122
- data/externals/oclint/lib/clang/3.7.0/include/popcntintrin.h +0 -50
- data/externals/oclint/lib/clang/3.7.0/include/prfchwintrin.h +0 -39
- data/externals/oclint/lib/clang/3.7.0/include/rdseedintrin.h +0 -59
- data/externals/oclint/lib/clang/3.7.0/include/rtmintrin.h +0 -59
- data/externals/oclint/lib/clang/3.7.0/include/s390intrin.h +0 -39
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/allocator_interface.h +0 -66
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/asan_interface.h +0 -155
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/common_interface_defs.h +0 -118
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/coverage_interface.h +0 -63
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/dfsan_interface.h +0 -114
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/linux_syscall_hooks.h +0 -3070
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/lsan_interface.h +0 -84
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/msan_interface.h +0 -107
- data/externals/oclint/lib/clang/3.7.0/include/sanitizer/tsan_interface_atomic.h +0 -222
- data/externals/oclint/lib/clang/3.7.0/include/shaintrin.h +0 -79
- data/externals/oclint/lib/clang/3.7.0/include/smmintrin.h +0 -487
- data/externals/oclint/lib/clang/3.7.0/include/stdalign.h +0 -35
- data/externals/oclint/lib/clang/3.7.0/include/stdarg.h +0 -52
- data/externals/oclint/lib/clang/3.7.0/include/stdatomic.h +0 -190
- data/externals/oclint/lib/clang/3.7.0/include/stdbool.h +0 -44
- data/externals/oclint/lib/clang/3.7.0/include/stddef.h +0 -137
- data/externals/oclint/lib/clang/3.7.0/include/stdint.h +0 -707
- data/externals/oclint/lib/clang/3.7.0/include/stdnoreturn.h +0 -30
- data/externals/oclint/lib/clang/3.7.0/include/tbmintrin.h +0 -154
- data/externals/oclint/lib/clang/3.7.0/include/tgmath.h +0 -1374
- data/externals/oclint/lib/clang/3.7.0/include/tmmintrin.h +0 -230
- data/externals/oclint/lib/clang/3.7.0/include/unwind.h +0 -282
- data/externals/oclint/lib/clang/3.7.0/include/vadefs.h +0 -65
- data/externals/oclint/lib/clang/3.7.0/include/varargs.h +0 -26
- data/externals/oclint/lib/clang/3.7.0/include/vecintrin.h +0 -8946
- data/externals/oclint/lib/clang/3.7.0/include/wmmintrin.h +0 -42
- data/externals/oclint/lib/clang/3.7.0/include/x86intrin.h +0 -81
- data/externals/oclint/lib/clang/3.7.0/include/xmmintrin.h +0 -1008
- data/externals/oclint/lib/clang/3.7.0/include/xopintrin.h +0 -809
- data/externals/oclint/lib/clang/3.7.0/include/xtestintrin.h +0 -41
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib +0 -0
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib +0 -0
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.builtins-i386.a +0 -0
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.builtins-x86_64.a +0 -0
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.profile_osx.a +0 -0
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.safestack_osx.a +0 -0
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.ubsan_iossim_dynamic.dylib +0 -0
- data/externals/oclint/lib/clang/3.7.0/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib +0 -0
- data/externals/oclint/lib/oclint/reporters/libHTMLReporter.dylib +0 -0
- data/externals/oclint/lib/oclint/reporters/libJSONReporter.dylib +0 -0
- data/externals/oclint/lib/oclint/reporters/libPMDReporter.dylib +0 -0
- data/externals/oclint/lib/oclint/reporters/libTextReporter.dylib +0 -0
- data/externals/oclint/lib/oclint/reporters/libXMLReporter.dylib +0 -0
- data/externals/oclint/lib/oclint/reporters/libXcodeReporter.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libAvoidBranchingStatementAsLastInLoopRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libAvoidDefaultArgumentsOnVirtualMethodsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libAvoidPrivateStaticMembersRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libBaseClassDestructorShouldBeVirtualOrProtectedRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libBitwiseOperatorInConditionalRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libBrokenNullCheckRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libBrokenOddnessCheckRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libCollapsibleIfStatementsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libConstantConditionalOperatorRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libConstantIfExpressionRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libCoveredSwitchStatementsDontNeedDefaultRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libCyclomaticComplexityRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libDeadCodeRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libDefaultLabelNotLastInSwitchStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libDestructorOfVirtualClassRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libDoubleNegativeRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyCatchStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyDoWhileStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyElseBlockRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyFinallyStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyForStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyIfStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptySwitchStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyTryStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libEmptyWhileStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libForLoopShouldBeWhileLoopRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libGotoStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libInvertedLogicRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libJumbledIncrementerRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libLongClassRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libLongLineRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libLongMethodRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libLongVariableNameRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libMisplacedNullCheckRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libMissingBreakInSwitchStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libMultipleUnaryOperatorRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libNPathComplexityRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libNcssMethodCountRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libNestedBlockDepthRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libNonCaseLabelInSwitchStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCAssignIvarOutsideAccessorsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCBoxedExpressionsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCContainerLiteralsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCNSNumberLiteralsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCObjectSubscriptingRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCVerifyIsEqualHashRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCVerifyMustCallSuperRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCVerifyProhibitedCallRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCVerifyProtectedMethodRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libObjCVerifySubclassMustImplementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libParameterReassignmentRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libPreferEarlyExitRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libRedundantConditionalOperatorRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libRedundantIfStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libRedundantLocalVariableRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libRedundantNilCheckRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libReturnFromFinallyBlockRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libShortVariableNameRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libSwitchStatementsShouldHaveDefaultRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libThrowExceptionFromFinallyBlockRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libTooFewBranchesInSwitchStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libTooManyFieldsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libTooManyMethodsRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libTooManyParametersRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libUnnecessaryElseStatementRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libUnnecessaryNullCheckForCXXDeallocRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libUnusedLocalVariableRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libUnusedMethodParameterRule.dylib +0 -0
- data/externals/oclint/lib/oclint/rules/libUselessParenthesesRule.dylib +0 -0
- data/lib/coverage_html_converter.rb +0 -141
- data/lib/coverage_plan.rb +0 -27
- data/lib/device.rb +0 -27
- data/lib/execute.rb +0 -7
- data/lib/lint_plan.rb +0 -41
- data/lib/rules.rb +0 -23
- data/lib/test_plan.rb +0 -11
- data/lib/version.rb +0 -3
- data/lib/xcode.rb +0 -128
- data/lib/xcodebuild-helper.rb +0 -135
- data/spec/coverage_html_coverter_spec.rb +0 -55
- data/spec/coverage_plan_spec.rb +0 -23
- data/spec/device_spec.rb +0 -24
- data/spec/lint_plan_spec.rb +0 -35
- data/spec/rule_spec.rb +0 -37
- data/spec/spec_helper.rb +0 -17
- data/spec/test_plan_spec.rb +0 -11
- data/spec/xcode_dsl_actions_spec.rb +0 -227
- data/spec/xcode_dsl_spec.rb +0 -176
- data/spec/xcode_spec.rb +0 -85
- data/xcodebuild-helper.gemspec +0 -27
@@ -1,88 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
|
3
|
-
import os
|
4
|
-
import platform
|
5
|
-
import json
|
6
|
-
import argparse
|
7
|
-
import re
|
8
|
-
import subprocess
|
9
|
-
import sys
|
10
|
-
|
11
|
-
OCLINT_BIN_FOLDER = os.path.dirname(os.path.abspath(__file__))
|
12
|
-
OCLINT_BIN = OCLINT_BIN_FOLDER + os.sep + "oclint"
|
13
|
-
if platform.system() == "Windows":
|
14
|
-
OCLINT_BIN += ".exe"
|
15
|
-
CURRENT_WORKING_DIRECTORY = os.getcwd()
|
16
|
-
JSON_COMPILATION_DATABASE = CURRENT_WORKING_DIRECTORY + os.sep + "compile_commands.json"
|
17
|
-
|
18
|
-
arg_parser = argparse.ArgumentParser(description='OCLint for JSON Compilation Database (compile_commands.json)')
|
19
|
-
arg_parser.add_argument("-v", action="store_true", dest="invocation", help="show invocation command with arguments")
|
20
|
-
arg_parser.add_argument('-debug', '--debug', action="store_true", dest="debug", help="invoke OCLint in debug mode")
|
21
|
-
arg_parser.add_argument('-i', '-include', '--include', action='append', dest='includes', help="extract files matching pattern")
|
22
|
-
arg_parser.add_argument('-e', '-exclude', '--exclude', action='append', dest='excludes', help="remove files matching pattern")
|
23
|
-
arg_parser.add_argument('oclint_args', nargs='*', help="arguments that are passed to OCLint invocation")
|
24
|
-
args = arg_parser.parse_args()
|
25
|
-
|
26
|
-
def get_source_path(file_attr, dir_attr):
|
27
|
-
if file_attr.startswith(os.sep):
|
28
|
-
return file_attr
|
29
|
-
elif dir_attr.endswith(os.sep):
|
30
|
-
return dir_attr + file_attr
|
31
|
-
else:
|
32
|
-
return dir_attr + os.sep + file_attr
|
33
|
-
|
34
|
-
def source_exist_at(path):
|
35
|
-
return os.path.isfile(path)
|
36
|
-
|
37
|
-
def source_list_inclusion_filter(source_list, inclusion_filter):
|
38
|
-
filtered_list = []
|
39
|
-
for path in source_list:
|
40
|
-
if re.search(inclusion_filter, path):
|
41
|
-
filtered_list.append(path)
|
42
|
-
return filtered_list
|
43
|
-
|
44
|
-
def source_list_exclusion_filter(source_list, exclusion_filter):
|
45
|
-
filtered_list = []
|
46
|
-
for path in source_list:
|
47
|
-
if not re.search(exclusion_filter, path):
|
48
|
-
filtered_list.append(path)
|
49
|
-
return filtered_list
|
50
|
-
|
51
|
-
if not source_exist_at(OCLINT_BIN):
|
52
|
-
print "Error: OCLint executable file not found."
|
53
|
-
sys.exit(99)
|
54
|
-
|
55
|
-
if not source_exist_at(JSON_COMPILATION_DATABASE):
|
56
|
-
print "Error: compile_commands.json not found at current location."
|
57
|
-
sys.exit(98)
|
58
|
-
|
59
|
-
compilation_database = json.load(open(JSON_COMPILATION_DATABASE))
|
60
|
-
source_list = []
|
61
|
-
for file_item in compilation_database:
|
62
|
-
file_path = file_item["file"]
|
63
|
-
if not platform.system() == "Windows":
|
64
|
-
file_path = get_source_path(file_item["file"], file_item["directory"])
|
65
|
-
if source_exist_at(file_path) and not file_path in source_list:
|
66
|
-
source_list.append(file_path)
|
67
|
-
if args.includes:
|
68
|
-
matched_list = []
|
69
|
-
for inclusion_filter in args.includes:
|
70
|
-
matched_list.extend( source_list_inclusion_filter(source_list, inclusion_filter) )
|
71
|
-
source_list = matched_list
|
72
|
-
if args.excludes:
|
73
|
-
for exclusion_filter in args.excludes:
|
74
|
-
source_list = source_list_exclusion_filter(source_list, exclusion_filter)
|
75
|
-
source_paths = '"' + '" "'.join(source_list) + '"'
|
76
|
-
oclint_arguments = ''
|
77
|
-
if args.oclint_args:
|
78
|
-
oclint_arguments = ' ' + ' '.join(args.oclint_args)
|
79
|
-
debug_argument = ''
|
80
|
-
if args.debug:
|
81
|
-
debug_argument = ' -debug'
|
82
|
-
oclint_invocation = OCLINT_BIN + debug_argument + oclint_arguments + ' ' + source_paths
|
83
|
-
if args.invocation:
|
84
|
-
print '------------------------------ OCLint ------------------------------'
|
85
|
-
print oclint_invocation
|
86
|
-
print '--------------------------------------------------------------------'
|
87
|
-
exit_code = subprocess.call(oclint_invocation, shell=True)
|
88
|
-
sys.exit(exit_code)
|
@@ -1,218 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
|
3
|
-
import os
|
4
|
-
import sys
|
5
|
-
import json
|
6
|
-
import argparse
|
7
|
-
import re
|
8
|
-
import shlex
|
9
|
-
import StringIO
|
10
|
-
import glob
|
11
|
-
import itertools
|
12
|
-
|
13
|
-
|
14
|
-
SUPPORTED_COMPILERS = [
|
15
|
-
"clang",
|
16
|
-
"clang\+\+",
|
17
|
-
"llvm-cpp-4.2",
|
18
|
-
"llvm-g\+\+",
|
19
|
-
"llvm-g\+\+-4.2",
|
20
|
-
"llvm-gcc",
|
21
|
-
"llvm-gcc-4.2",
|
22
|
-
"arm-apple-darwin10-llvm-g\+\+-4.2",
|
23
|
-
"arm-apple-darwin10-llvm-gcc-4.2",
|
24
|
-
"i686-apple-darwin10-llvm-g\+\+-4.2",
|
25
|
-
"i686-apple-darwin10-llvm-gcc-4.2",
|
26
|
-
"gcc",
|
27
|
-
"g\+\+",
|
28
|
-
"c\+\+",
|
29
|
-
"cc"
|
30
|
-
]
|
31
|
-
|
32
|
-
DEFAULT_INPUT_FILE = "xcodebuild.log"
|
33
|
-
|
34
|
-
JSON_COMPILATION_DATABASE = "compile_commands.json"
|
35
|
-
|
36
|
-
|
37
|
-
_find_unsafe = re.compile('[ "\\\\]').search
|
38
|
-
|
39
|
-
def clang_quote(s):
|
40
|
-
"""
|
41
|
-
Return a minimally-escaped version of the string *s* that clang-based tools understand.
|
42
|
-
(See http://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
43
|
-
ex:
|
44
|
-
clang_quote('aa') == r'aa'
|
45
|
-
clang_quote('a"a') == r'"a\"a"'
|
46
|
-
clang_quote('--my-option=a"a') == r'"--my-option=a\"a"'
|
47
|
-
"""
|
48
|
-
if not s:
|
49
|
-
return '""'
|
50
|
-
|
51
|
-
if _find_unsafe(s) is None:
|
52
|
-
return s
|
53
|
-
|
54
|
-
return '"' + s.replace('\\', '\\\\').replace('"', '\\"') + '"'
|
55
|
-
|
56
|
-
|
57
|
-
_find_quoting = re.compile('[\'"\\\\]').search
|
58
|
-
|
59
|
-
def tokenize_command(c):
|
60
|
-
"""Compute the list of shell arguments in *c* using shlex.split (note: make an explicit call to StringIO for compatibility with Python 2)."""
|
61
|
-
if _find_quoting(c) is None:
|
62
|
-
return map(str.strip, c.strip().split(' '))
|
63
|
-
else:
|
64
|
-
return shlex.split(StringIO.StringIO(c))
|
65
|
-
|
66
|
-
# global table to map pth files to (source) pch files
|
67
|
-
_pch_dictionary = {}
|
68
|
-
|
69
|
-
def register_source_for_pth_file(clang_command, directory):
|
70
|
-
tokens = iter(tokenize_command(clang_command))
|
71
|
-
src_file = ""
|
72
|
-
pth_file = ""
|
73
|
-
try:
|
74
|
-
while 1:
|
75
|
-
tok = tokens.next()
|
76
|
-
if tok == '-c':
|
77
|
-
file = tokens.next()
|
78
|
-
src_file = file
|
79
|
-
elif tok == '-o':
|
80
|
-
file = tokens.next()
|
81
|
-
if file.endswith('.pch.pth') or file.endswith('.pch.pch') or file.endswith('.h.pch'):
|
82
|
-
pth_file = file
|
83
|
-
except StopIteration:
|
84
|
-
if src_file and pth_file:
|
85
|
-
_pch_dictionary[pth_file] = src_file
|
86
|
-
|
87
|
-
def get_source_for_pth_file(file):
|
88
|
-
src_file = _pch_dictionary.get(file + '.pth')
|
89
|
-
if src_file is not None:
|
90
|
-
return src_file
|
91
|
-
return _pch_dictionary.get(file + '.pch')
|
92
|
-
|
93
|
-
def process_clang_command(clang_command, directory):
|
94
|
-
tokens = iter(tokenize_command(clang_command))
|
95
|
-
command = []
|
96
|
-
source_file = None
|
97
|
-
|
98
|
-
try:
|
99
|
-
while 1:
|
100
|
-
tok = tokens.next()
|
101
|
-
if tok == '-include':
|
102
|
-
include_file = tokens.next()
|
103
|
-
if not os.path.isfile(include_file):
|
104
|
-
src_file = get_source_for_pth_file(include_file)
|
105
|
-
if src_file is not None:
|
106
|
-
include_file = src_file
|
107
|
-
else:
|
108
|
-
print "cannot find original pch source file for %s" % include_file
|
109
|
-
exit(3)
|
110
|
-
command.append(tok)
|
111
|
-
command.append(clang_quote(include_file))
|
112
|
-
|
113
|
-
elif tok == '-c':
|
114
|
-
source_file = tokens.next()
|
115
|
-
command.append(tok)
|
116
|
-
command.append(clang_quote(source_file))
|
117
|
-
|
118
|
-
else:
|
119
|
-
command.append(clang_quote(tok))
|
120
|
-
|
121
|
-
except StopIteration:
|
122
|
-
return {"directory": directory, "command": " ".join(command), "file": os.path.normpath(source_file)}
|
123
|
-
|
124
|
-
|
125
|
-
def read_directory(line):
|
126
|
-
tokens = tokenize_command(line)
|
127
|
-
if tokens[0] == "cd":
|
128
|
-
return tokens[1]
|
129
|
-
else:
|
130
|
-
return ""
|
131
|
-
|
132
|
-
def convert(input_file, output_file, is_excluded=None):
|
133
|
-
json_input_mode = input_file.endswith('.json')
|
134
|
-
|
135
|
-
find_compileC = re.compile("CompileC").search
|
136
|
-
|
137
|
-
find_processPCH = re.compile("ProcessPCH").search
|
138
|
-
|
139
|
-
find_clang_command = re.compile("(" + "|".join(SUPPORTED_COMPILERS) + ") .* -c .* -o ").search
|
140
|
-
|
141
|
-
if is_excluded is None:
|
142
|
-
is_excluded = (lambda x: False)
|
143
|
-
|
144
|
-
with open(output_file, "w") as output:
|
145
|
-
with open(input_file, "r") as input:
|
146
|
-
if json_input_mode:
|
147
|
-
lines = itertools.chain(*(json.loads(line).get('command', '').encode("utf8").splitlines(True) for line in input))
|
148
|
-
else:
|
149
|
-
lines = input
|
150
|
-
try:
|
151
|
-
output.write("[")
|
152
|
-
cr = "\n"
|
153
|
-
while 1:
|
154
|
-
log_line = lines.next()
|
155
|
-
compilation_section_re = find_compileC(log_line)
|
156
|
-
if compilation_section_re:
|
157
|
-
directory = read_directory(lines.next())
|
158
|
-
if is_excluded(directory):
|
159
|
-
continue
|
160
|
-
while 1:
|
161
|
-
log_line = lines.next()
|
162
|
-
if not find_clang_command(log_line):
|
163
|
-
continue
|
164
|
-
output_record = process_clang_command(log_line, directory)
|
165
|
-
output.write(cr)
|
166
|
-
output.write(json.dumps(output_record, indent=2))
|
167
|
-
cr = ",\n"
|
168
|
-
break
|
169
|
-
continue
|
170
|
-
compilation_section_re = find_processPCH(log_line)
|
171
|
-
if compilation_section_re:
|
172
|
-
directory = read_directory(lines.next())
|
173
|
-
if is_excluded(directory):
|
174
|
-
continue
|
175
|
-
while 1:
|
176
|
-
log_line = lines.next()
|
177
|
-
if not find_clang_command(log_line):
|
178
|
-
continue
|
179
|
-
register_source_for_pth_file(log_line, directory)
|
180
|
-
break
|
181
|
-
continue
|
182
|
-
except StopIteration:
|
183
|
-
output.write("\n]\n");
|
184
|
-
|
185
|
-
def main():
|
186
|
-
arg_parser = argparse.ArgumentParser(description='Converts xcodebuild logs or xctool-json-reporter logs to compile_commands.json')
|
187
|
-
arg_parser.add_argument("-e", "-exclude", dest="exclusion", help="Directory exclusion pattern (regular expression)")
|
188
|
-
arg_parser.add_argument("-o", "-output", dest="output_file", help="Output json file (default: ./%s)" % JSON_COMPILATION_DATABASE)
|
189
|
-
arg_parser.add_argument(metavar="FILE", nargs='?', dest="input_file", help="Input log file (default: ./%s)" % DEFAULT_INPUT_FILE)
|
190
|
-
|
191
|
-
args = arg_parser.parse_args()
|
192
|
-
|
193
|
-
if args.input_file:
|
194
|
-
input_file = args.input_file
|
195
|
-
else:
|
196
|
-
input_file = DEFAULT_INPUT_FILE
|
197
|
-
|
198
|
-
if args.output_file:
|
199
|
-
output_file = args.output_file
|
200
|
-
else:
|
201
|
-
output_file = JSON_COMPILATION_DATABASE
|
202
|
-
|
203
|
-
if not os.path.isfile(input_file):
|
204
|
-
print "Error: %s not found." % input_file
|
205
|
-
exit(1)
|
206
|
-
|
207
|
-
if args.exclusion:
|
208
|
-
is_excluded = re.compile(args.exclusion).match
|
209
|
-
else:
|
210
|
-
is_excluded = None
|
211
|
-
|
212
|
-
convert(input_file, output_file, is_excluded)
|
213
|
-
|
214
|
-
|
215
|
-
if __name__ == '__main__':
|
216
|
-
print "This binary is no longer under maintenance by OCLint team."
|
217
|
-
print "Please consider using xcpretty (https://github.com/supermarin/xcpretty) instead!"
|
218
|
-
main()
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Blacklist for AddressSanitizer. Turns off instrumentation of particular
|
2
|
-
# functions or sources. Use with care. You may set location of blacklist
|
3
|
-
# at compile-time using -fsanitize-blacklist=<path> flag.
|
4
|
-
|
5
|
-
# Example usage:
|
6
|
-
# fun:*bad_function_name*
|
7
|
-
# src:file_with_tricky_code.cc
|
8
|
-
# global:*global_with_bad_access_or_initialization*
|
9
|
-
# global:*global_with_initialization_issues*=init
|
10
|
-
# type:*Namespace::ClassName*=init
|
11
|
-
|
12
|
-
# Stack buffer overflow in VC/INCLUDE/xlocnum, see http://goo.gl/L4qqUG
|
13
|
-
fun:*_Find_elem@*@std*
|