nixenvironment 0.0.125 → 0.0.127

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,134 +0,0 @@
1
- #!/bin/sh -e
2
-
3
- # Created by Nezhelskoy Iliya on 10/09/14.
4
- # Copyright (c) 2014 NIX. All rights reserved.
5
-
6
- # Script generates code coverage report for Cobertura Jenkins plugin. Call it after running tests.
7
- # Tests target should be setup for generating GCOV data.
8
-
9
- # Prepare variables
10
- workspace="" scheme="" configuration="" sdk="" exclude="" output="" extraParams=()
11
-
12
- currentScriptDir=$(cd "$(dirname "$0")"; pwd)
13
-
14
- # Description of command usage
15
- function Usage()
16
- {
17
- echo "\tUsage: -workspace <workspacename>\n\t\
18
- -scheme <schemeName>\n\t\
19
- -configuration <configurationName>\n\t\
20
- -sdk <sdkName>\n\t\
21
- [-exclude <excludePattern>]\n\t\
22
- [-output <outputDirectory>]\n\t\
23
- ..."
24
- }
25
-
26
- function GetParams()
27
- {
28
- while [[ $# > 0 ]]
29
- do
30
- key="$1"
31
-
32
- case $key in
33
- -workspace)
34
- workspace="$2"
35
- shift 2;;
36
- -scheme)
37
- scheme="$2"
38
- shift 2;;
39
- -configuration)
40
- configuration="$2"
41
- shift 2 ;;
42
- -sdk)
43
- sdk="$2"
44
- shift 2 ;;
45
- -exclude)
46
- exclude="-exclude $2"
47
- shift 2 ;;
48
- -output)
49
- output="$2"
50
- shift 2 ;;
51
- *)
52
- extraParams=(${extraParams[@]} \"$1\")
53
- shift ;;
54
- esac
55
- done
56
- }
57
-
58
- # Сheck for required arguments
59
- function CheckParams()
60
- {
61
- if [ ! "$workspace" ] || [ ! "$scheme" ] || [ ! "$configuration" ] || [ ! "$sdk" ]; then
62
- echo "Missing parameter argument" >&2
63
- Usage >&2
64
- exit 1
65
- fi
66
- }
67
-
68
- function GenerateCoverage()
69
- {
70
- productName="$1"
71
- objectsDir="$2"
72
- exclude="$3"
73
- outputPath="$4"
74
-
75
- # Create output directory
76
- mkdir -p $outputPath
77
-
78
- printf " Generating coverage for '$productName'... "
79
- "${currentScriptDir}/../utils/gcovr" -r "$(PWD)" --object-directory="${objectsDir}" "${exclude}" --xml > "$outputPath${productName}.xml"
80
-
81
- if [ $? -ne 0 ]; then
82
- exit 1
83
- fi
84
-
85
- echo "Done"
86
- }
87
-
88
- function ProcessBuildSetting ()
89
- {
90
- # The characters in the value are used to split the line into words
91
- IFS=" = "
92
-
93
- # Prepare variables
94
- readonly currentVariantKey="CURRENT_VARIANT"
95
- readonly defaultVariant="normal"
96
- readonly productNameKey="PRODUCT_NAME"
97
- readonly currentArchKey="NATIVE_ARCH"
98
- readonly objectDirPrefix="OBJECT_FILE_DIR_"
99
-
100
- # To be determined by 'currentVariantKey'. Initially will use the default value
101
- objectsDirKey="$objectDirPrefix$defaultVariant"
102
-
103
- productName=""
104
- objectsDir=""
105
- currentArch=""
106
-
107
- # Read input settings
108
- while read settingKey settingValue; do
109
- case $settingKey in
110
- $currentVariantKey)
111
- objectsDirKey="$objectDirPrefix$settingValue" ;;
112
- $objectsDirKey)
113
- objectsDir=$settingValue ;;
114
- $productNameKey)
115
- productName=$settingValue ;;
116
- $currentArchKey)
117
- currentArch=$settingValue ;;
118
- esac
119
-
120
- if [ "$productName" ] && [ "$objectsDir" ] && [ "$currentArch" ]; then
121
- GenerateCoverage $productName "${objectsDir}/${currentArch}" "$exclude" "$output"
122
- productName=""
123
- objectsDir=""
124
- currentArch=""
125
- fi
126
- done
127
- }
128
-
129
- # Load variables
130
- GetParams "$@"
131
- CheckParams
132
-
133
- # Execute
134
- eval xcodebuild -workspace "$workspace" -scheme "$scheme" -configuration "$configuration" -sdk "$sdk" test -showBuildSettings "${extraParams[@]}" | ProcessBuildSetting