@digitalshieldfe/react-native-backup-card-sdk 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +6 -49
- package/android/libs/backupcardsdk.aar +0 -0
- package/android/src/main/AndroidManifest.xml +1 -4
- package/package.json +6 -3
- package/android/consumer-rules.pro +0 -0
- package/android/proguard-rules.pro +0 -21
- package/android/src/main/java/com/ziancube/backupcardsdk/BackupCardSdk.kt +0 -478
- package/android/src/main/java/com/ziancube/backupcardsdk/GPChannelNatives.java +0 -41
- package/android/src/main/java/com/ziancube/backupcardsdk/listener/ApiAsyncListener.java +0 -13
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/ApiNfc.java +0 -173
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/ImplNfc.java +0 -39
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/NfcComm.java +0 -115
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/ApduParam.java +0 -67
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/CommList.java +0 -41
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/Utils.java +0 -109
- package/android/src/main/jni/CMakeLists.txt +0 -60
- package/android/src/main/jni/GPChannel/include/GPChannelSDK.h +0 -306
- package/android/src/main/jni/GPChannel/include/context/BaseContext.h +0 -56
- package/android/src/main/jni/GPChannel/include/device/ApduBuilder.hpp +0 -72
- package/android/src/main/jni/GPChannel/include/utility/Apdu.hpp +0 -166
- package/android/src/main/jni/GPChannel/include/utility/Debug.hpp +0 -59
- package/android/src/main/jni/GPChannel/include/utility/Singleton.h +0 -34
- package/android/src/main/jni/GPChannel/include/utility/mutex.h +0 -24
- package/android/src/main/jni/GPChannel/include/utility/trim.hpp +0 -155
- package/android/src/main/jni/GPChannel/include/utility/util.h +0 -104
- package/android/src/main/jni/GPChannel/include/utility/xFactory.hpp +0 -26
- package/android/src/main/jni/GPChannel/include/utility/xManager.hpp +0 -84
- package/android/src/main/jni/GPChannel/src/arm64-v8a/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/arm64-v8a/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/GPChannel/src/armeabi-v7a/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/armeabi-v7a/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/GPChannel/src/x86/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/x86/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/src/implJni.cpp +0 -313
- package/android/src/main/jni/src/implJni.h +0 -9
- package/android/src/main/jni/utils/jsoncpp/AUTHORS +0 -111
- package/android/src/main/jni/utils/jsoncpp/CMakeLists.txt +0 -159
- package/android/src/main/jni/utils/jsoncpp/LICENSE +0 -55
- package/android/src/main/jni/utils/jsoncpp/README.md +0 -135
- package/android/src/main/jni/utils/jsoncpp/amalgamate.py +0 -155
- package/android/src/main/jni/utils/jsoncpp/appveyor.yml +0 -22
- package/android/src/main/jni/utils/jsoncpp/dev.makefile +0 -35
- package/android/src/main/jni/utils/jsoncpp/devtools/__init__.py +0 -6
- package/android/src/main/jni/utils/jsoncpp/devtools/agent_vmw7.json +0 -33
- package/android/src/main/jni/utils/jsoncpp/devtools/agent_vmxp.json +0 -26
- package/android/src/main/jni/utils/jsoncpp/devtools/antglob.py +0 -205
- package/android/src/main/jni/utils/jsoncpp/devtools/batchbuild.py +0 -278
- package/android/src/main/jni/utils/jsoncpp/devtools/fixeol.py +0 -70
- package/android/src/main/jni/utils/jsoncpp/devtools/licenseupdater.py +0 -94
- package/android/src/main/jni/utils/jsoncpp/devtools/tarball.py +0 -52
- package/android/src/main/jni/utils/jsoncpp/doxybuild.py +0 -189
- package/android/src/main/jni/utils/jsoncpp/include/CMakeLists.txt +0 -2
- package/android/src/main/jni/utils/jsoncpp/include/json/allocator.h +0 -98
- package/android/src/main/jni/utils/jsoncpp/include/json/assertions.h +0 -54
- package/android/src/main/jni/utils/jsoncpp/include/json/autolink.h +0 -25
- package/android/src/main/jni/utils/jsoncpp/include/json/config.h +0 -187
- package/android/src/main/jni/utils/jsoncpp/include/json/features.h +0 -61
- package/android/src/main/jni/utils/jsoncpp/include/json/forwards.h +0 -37
- package/android/src/main/jni/utils/jsoncpp/include/json/json.h +0 -15
- package/android/src/main/jni/utils/jsoncpp/include/json/reader.h +0 -411
- package/android/src/main/jni/utils/jsoncpp/include/json/value.h +0 -888
- package/android/src/main/jni/utils/jsoncpp/include/json/version.h +0 -20
- package/android/src/main/jni/utils/jsoncpp/include/json/writer.h +0 -357
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/jsontest.vcproj +0 -119
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/lib_json.vcproj +0 -205
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/test_lib_json.vcproj +0 -130
- package/android/src/main/jni/utils/jsoncpp/makerelease.py +0 -390
- package/android/src/main/jni/utils/jsoncpp/meson.build +0 -103
- package/android/src/main/jni/utils/jsoncpp/pkg-config/jsoncpp.pc.in +0 -9
- package/android/src/main/jni/utils/jsoncpp/src/CMakeLists.txt +0 -5
- package/android/src/main/jni/utils/jsoncpp/src/jsontestrunner/CMakeLists.txt +0 -25
- package/android/src/main/jni/utils/jsoncpp/src/jsontestrunner/main.cpp +0 -333
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/CMakeLists.txt +0 -117
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_reader.cpp +0 -2060
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_tool.h +0 -114
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_value.cpp +0 -1661
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_valueiterator.inl +0 -167
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_writer.cpp +0 -1233
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/version.h.in +0 -20
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/CMakeLists.txt +0 -38
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/jsontest.cpp +0 -457
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/jsontest.h +0 -286
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/main.cpp +0 -2606
- package/android/src/main/jni/utils/jsoncpp/travis.sh +0 -23
- package/android/src/main/jni/utils/jsoncpp/version +0 -1
- package/android/src/main/jni/utils/jsoncpp/version.in +0 -1
- package/android/src/main/jni/utils/logUtils.cpp +0 -108
- package/android/src/main/jni/utils/logUtils.h +0 -87
- package/android/src/main/jni/utils/mSIGNA/stdutils/uchar_vector.h +0 -614
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
from __future__ import print_function
|
|
2
|
-
import collections
|
|
3
|
-
import itertools
|
|
4
|
-
import json
|
|
5
|
-
import os
|
|
6
|
-
import os.path
|
|
7
|
-
import re
|
|
8
|
-
import shutil
|
|
9
|
-
import string
|
|
10
|
-
import subprocess
|
|
11
|
-
import sys
|
|
12
|
-
import cgi
|
|
13
|
-
|
|
14
|
-
class BuildDesc:
|
|
15
|
-
def __init__(self, prepend_envs=None, variables=None, build_type=None, generator=None):
|
|
16
|
-
self.prepend_envs = prepend_envs or [] # [ { "var": "value" } ]
|
|
17
|
-
self.variables = variables or []
|
|
18
|
-
self.build_type = build_type
|
|
19
|
-
self.generator = generator
|
|
20
|
-
|
|
21
|
-
def merged_with(self, build_desc):
|
|
22
|
-
"""Returns a new BuildDesc by merging field content.
|
|
23
|
-
Prefer build_desc fields to self fields for single valued field.
|
|
24
|
-
"""
|
|
25
|
-
return BuildDesc(self.prepend_envs + build_desc.prepend_envs,
|
|
26
|
-
self.variables + build_desc.variables,
|
|
27
|
-
build_desc.build_type or self.build_type,
|
|
28
|
-
build_desc.generator or self.generator)
|
|
29
|
-
|
|
30
|
-
def env(self):
|
|
31
|
-
environ = os.environ.copy()
|
|
32
|
-
for values_by_name in self.prepend_envs:
|
|
33
|
-
for var, value in list(values_by_name.items()):
|
|
34
|
-
var = var.upper()
|
|
35
|
-
if type(value) is unicode:
|
|
36
|
-
value = value.encode(sys.getdefaultencoding())
|
|
37
|
-
if var in environ:
|
|
38
|
-
environ[var] = value + os.pathsep + environ[var]
|
|
39
|
-
else:
|
|
40
|
-
environ[var] = value
|
|
41
|
-
return environ
|
|
42
|
-
|
|
43
|
-
def cmake_args(self):
|
|
44
|
-
args = ["-D%s" % var for var in self.variables]
|
|
45
|
-
# skip build type for Visual Studio solution as it cause warning
|
|
46
|
-
if self.build_type and 'Visual' not in self.generator:
|
|
47
|
-
args.append("-DCMAKE_BUILD_TYPE=%s" % self.build_type)
|
|
48
|
-
if self.generator:
|
|
49
|
-
args.extend(['-G', self.generator])
|
|
50
|
-
return args
|
|
51
|
-
|
|
52
|
-
def __repr__(self):
|
|
53
|
-
return "BuildDesc(%s, build_type=%s)" % (" ".join(self.cmake_args()), self.build_type)
|
|
54
|
-
|
|
55
|
-
class BuildData:
|
|
56
|
-
def __init__(self, desc, work_dir, source_dir):
|
|
57
|
-
self.desc = desc
|
|
58
|
-
self.work_dir = work_dir
|
|
59
|
-
self.source_dir = source_dir
|
|
60
|
-
self.cmake_log_path = os.path.join(work_dir, 'batchbuild_cmake.log')
|
|
61
|
-
self.build_log_path = os.path.join(work_dir, 'batchbuild_build.log')
|
|
62
|
-
self.cmake_succeeded = False
|
|
63
|
-
self.build_succeeded = False
|
|
64
|
-
|
|
65
|
-
def execute_build(self):
|
|
66
|
-
print('Build %s' % self.desc)
|
|
67
|
-
self._make_new_work_dir()
|
|
68
|
-
self.cmake_succeeded = self._generate_makefiles()
|
|
69
|
-
if self.cmake_succeeded:
|
|
70
|
-
self.build_succeeded = self._build_using_makefiles()
|
|
71
|
-
return self.build_succeeded
|
|
72
|
-
|
|
73
|
-
def _generate_makefiles(self):
|
|
74
|
-
print(' Generating makefiles: ', end=' ')
|
|
75
|
-
cmd = ['cmake'] + self.desc.cmake_args() + [os.path.abspath(self.source_dir)]
|
|
76
|
-
succeeded = self._execute_build_subprocess(cmd, self.desc.env(), self.cmake_log_path)
|
|
77
|
-
print('done' if succeeded else 'FAILED')
|
|
78
|
-
return succeeded
|
|
79
|
-
|
|
80
|
-
def _build_using_makefiles(self):
|
|
81
|
-
print(' Building:', end=' ')
|
|
82
|
-
cmd = ['cmake', '--build', self.work_dir]
|
|
83
|
-
if self.desc.build_type:
|
|
84
|
-
cmd += ['--config', self.desc.build_type]
|
|
85
|
-
succeeded = self._execute_build_subprocess(cmd, self.desc.env(), self.build_log_path)
|
|
86
|
-
print('done' if succeeded else 'FAILED')
|
|
87
|
-
return succeeded
|
|
88
|
-
|
|
89
|
-
def _execute_build_subprocess(self, cmd, env, log_path):
|
|
90
|
-
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.work_dir,
|
|
91
|
-
env=env)
|
|
92
|
-
stdout, _ = process.communicate()
|
|
93
|
-
succeeded = (process.returncode == 0)
|
|
94
|
-
with open(log_path, 'wb') as flog:
|
|
95
|
-
log = ' '.join(cmd) + '\n' + stdout + '\nExit code: %r\n' % process.returncode
|
|
96
|
-
flog.write(fix_eol(log))
|
|
97
|
-
return succeeded
|
|
98
|
-
|
|
99
|
-
def _make_new_work_dir(self):
|
|
100
|
-
if os.path.isdir(self.work_dir):
|
|
101
|
-
print(' Removing work directory', self.work_dir)
|
|
102
|
-
shutil.rmtree(self.work_dir, ignore_errors=True)
|
|
103
|
-
if not os.path.isdir(self.work_dir):
|
|
104
|
-
os.makedirs(self.work_dir)
|
|
105
|
-
|
|
106
|
-
def fix_eol(stdout):
|
|
107
|
-
"""Fixes wrong EOL produced by cmake --build on Windows (\r\r\n instead of \r\n).
|
|
108
|
-
"""
|
|
109
|
-
return re.sub('\r*\n', os.linesep, stdout)
|
|
110
|
-
|
|
111
|
-
def load_build_variants_from_config(config_path):
|
|
112
|
-
with open(config_path, 'rb') as fconfig:
|
|
113
|
-
data = json.load(fconfig)
|
|
114
|
-
variants = data[ 'cmake_variants' ]
|
|
115
|
-
build_descs_by_axis = collections.defaultdict(list)
|
|
116
|
-
for axis in variants:
|
|
117
|
-
axis_name = axis["name"]
|
|
118
|
-
build_descs = []
|
|
119
|
-
if "generators" in axis:
|
|
120
|
-
for generator_data in axis["generators"]:
|
|
121
|
-
for generator in generator_data["generator"]:
|
|
122
|
-
build_desc = BuildDesc(generator=generator,
|
|
123
|
-
prepend_envs=generator_data.get("env_prepend"))
|
|
124
|
-
build_descs.append(build_desc)
|
|
125
|
-
elif "variables" in axis:
|
|
126
|
-
for variables in axis["variables"]:
|
|
127
|
-
build_desc = BuildDesc(variables=variables)
|
|
128
|
-
build_descs.append(build_desc)
|
|
129
|
-
elif "build_types" in axis:
|
|
130
|
-
for build_type in axis["build_types"]:
|
|
131
|
-
build_desc = BuildDesc(build_type=build_type)
|
|
132
|
-
build_descs.append(build_desc)
|
|
133
|
-
build_descs_by_axis[axis_name].extend(build_descs)
|
|
134
|
-
return build_descs_by_axis
|
|
135
|
-
|
|
136
|
-
def generate_build_variants(build_descs_by_axis):
|
|
137
|
-
"""Returns a list of BuildDesc generated for the partial BuildDesc for each axis."""
|
|
138
|
-
axis_names = list(build_descs_by_axis.keys())
|
|
139
|
-
build_descs = []
|
|
140
|
-
for axis_name, axis_build_descs in list(build_descs_by_axis.items()):
|
|
141
|
-
if len(build_descs):
|
|
142
|
-
# for each existing build_desc and each axis build desc, create a new build_desc
|
|
143
|
-
new_build_descs = []
|
|
144
|
-
for prototype_build_desc, axis_build_desc in itertools.product(build_descs, axis_build_descs):
|
|
145
|
-
new_build_descs.append(prototype_build_desc.merged_with(axis_build_desc))
|
|
146
|
-
build_descs = new_build_descs
|
|
147
|
-
else:
|
|
148
|
-
build_descs = axis_build_descs
|
|
149
|
-
return build_descs
|
|
150
|
-
|
|
151
|
-
HTML_TEMPLATE = string.Template('''<html>
|
|
152
|
-
<head>
|
|
153
|
-
<title>$title</title>
|
|
154
|
-
<style type="text/css">
|
|
155
|
-
td.failed {background-color:#f08080;}
|
|
156
|
-
td.ok {background-color:#c0eec0;}
|
|
157
|
-
</style>
|
|
158
|
-
</head>
|
|
159
|
-
<body>
|
|
160
|
-
<table border="1">
|
|
161
|
-
<thead>
|
|
162
|
-
<tr>
|
|
163
|
-
<th>Variables</th>
|
|
164
|
-
$th_vars
|
|
165
|
-
</tr>
|
|
166
|
-
<tr>
|
|
167
|
-
<th>Build type</th>
|
|
168
|
-
$th_build_types
|
|
169
|
-
</tr>
|
|
170
|
-
</thead>
|
|
171
|
-
<tbody>
|
|
172
|
-
$tr_builds
|
|
173
|
-
</tbody>
|
|
174
|
-
</table>
|
|
175
|
-
</body></html>''')
|
|
176
|
-
|
|
177
|
-
def generate_html_report(html_report_path, builds):
|
|
178
|
-
report_dir = os.path.dirname(html_report_path)
|
|
179
|
-
# Vertical axis: generator
|
|
180
|
-
# Horizontal: variables, then build_type
|
|
181
|
-
builds_by_generator = collections.defaultdict(list)
|
|
182
|
-
variables = set()
|
|
183
|
-
build_types_by_variable = collections.defaultdict(set)
|
|
184
|
-
build_by_pos_key = {} # { (generator, var_key, build_type): build }
|
|
185
|
-
for build in builds:
|
|
186
|
-
builds_by_generator[build.desc.generator].append(build)
|
|
187
|
-
var_key = tuple(sorted(build.desc.variables))
|
|
188
|
-
variables.add(var_key)
|
|
189
|
-
build_types_by_variable[var_key].add(build.desc.build_type)
|
|
190
|
-
pos_key = (build.desc.generator, var_key, build.desc.build_type)
|
|
191
|
-
build_by_pos_key[pos_key] = build
|
|
192
|
-
variables = sorted(variables)
|
|
193
|
-
th_vars = []
|
|
194
|
-
th_build_types = []
|
|
195
|
-
for variable in variables:
|
|
196
|
-
build_types = sorted(build_types_by_variable[variable])
|
|
197
|
-
nb_build_type = len(build_types_by_variable[variable])
|
|
198
|
-
th_vars.append('<th colspan="%d">%s</th>' % (nb_build_type, cgi.escape(' '.join(variable))))
|
|
199
|
-
for build_type in build_types:
|
|
200
|
-
th_build_types.append('<th>%s</th>' % cgi.escape(build_type))
|
|
201
|
-
tr_builds = []
|
|
202
|
-
for generator in sorted(builds_by_generator):
|
|
203
|
-
tds = [ '<td>%s</td>\n' % cgi.escape(generator) ]
|
|
204
|
-
for variable in variables:
|
|
205
|
-
build_types = sorted(build_types_by_variable[variable])
|
|
206
|
-
for build_type in build_types:
|
|
207
|
-
pos_key = (generator, variable, build_type)
|
|
208
|
-
build = build_by_pos_key.get(pos_key)
|
|
209
|
-
if build:
|
|
210
|
-
cmake_status = 'ok' if build.cmake_succeeded else 'FAILED'
|
|
211
|
-
build_status = 'ok' if build.build_succeeded else 'FAILED'
|
|
212
|
-
cmake_log_url = os.path.relpath(build.cmake_log_path, report_dir)
|
|
213
|
-
build_log_url = os.path.relpath(build.build_log_path, report_dir)
|
|
214
|
-
td = '<td class="%s"><a href="%s" class="%s">CMake: %s</a>' % ( build_status.lower(), cmake_log_url, cmake_status.lower(), cmake_status)
|
|
215
|
-
if build.cmake_succeeded:
|
|
216
|
-
td += '<br><a href="%s" class="%s">Build: %s</a>' % ( build_log_url, build_status.lower(), build_status)
|
|
217
|
-
td += '</td>'
|
|
218
|
-
else:
|
|
219
|
-
td = '<td></td>'
|
|
220
|
-
tds.append(td)
|
|
221
|
-
tr_builds.append('<tr>%s</tr>' % '\n'.join(tds))
|
|
222
|
-
html = HTML_TEMPLATE.substitute( title='Batch build report',
|
|
223
|
-
th_vars=' '.join(th_vars),
|
|
224
|
-
th_build_types=' '.join(th_build_types),
|
|
225
|
-
tr_builds='\n'.join(tr_builds))
|
|
226
|
-
with open(html_report_path, 'wt') as fhtml:
|
|
227
|
-
fhtml.write(html)
|
|
228
|
-
print('HTML report generated in:', html_report_path)
|
|
229
|
-
|
|
230
|
-
def main():
|
|
231
|
-
usage = r"""%prog WORK_DIR SOURCE_DIR CONFIG_JSON_PATH [CONFIG2_JSON_PATH...]
|
|
232
|
-
Build a given CMake based project located in SOURCE_DIR with multiple generators/options.dry_run
|
|
233
|
-
as described in CONFIG_JSON_PATH building in WORK_DIR.
|
|
234
|
-
|
|
235
|
-
Example of call:
|
|
236
|
-
python devtools\batchbuild.py e:\buildbots\jsoncpp\build . devtools\agent_vmw7.json
|
|
237
|
-
"""
|
|
238
|
-
from optparse import OptionParser
|
|
239
|
-
parser = OptionParser(usage=usage)
|
|
240
|
-
parser.allow_interspersed_args = True
|
|
241
|
-
# parser.add_option('-v', '--verbose', dest="verbose", action='store_true',
|
|
242
|
-
# help="""Be verbose.""")
|
|
243
|
-
parser.enable_interspersed_args()
|
|
244
|
-
options, args = parser.parse_args()
|
|
245
|
-
if len(args) < 3:
|
|
246
|
-
parser.error("Missing one of WORK_DIR SOURCE_DIR CONFIG_JSON_PATH.")
|
|
247
|
-
work_dir = args[0]
|
|
248
|
-
source_dir = args[1].rstrip('/\\')
|
|
249
|
-
config_paths = args[2:]
|
|
250
|
-
for config_path in config_paths:
|
|
251
|
-
if not os.path.isfile(config_path):
|
|
252
|
-
parser.error("Can not read: %r" % config_path)
|
|
253
|
-
|
|
254
|
-
# generate build variants
|
|
255
|
-
build_descs = []
|
|
256
|
-
for config_path in config_paths:
|
|
257
|
-
build_descs_by_axis = load_build_variants_from_config(config_path)
|
|
258
|
-
build_descs.extend(generate_build_variants(build_descs_by_axis))
|
|
259
|
-
print('Build variants (%d):' % len(build_descs))
|
|
260
|
-
# assign build directory for each variant
|
|
261
|
-
if not os.path.isdir(work_dir):
|
|
262
|
-
os.makedirs(work_dir)
|
|
263
|
-
builds = []
|
|
264
|
-
with open(os.path.join(work_dir, 'matrix-dir-map.txt'), 'wt') as fmatrixmap:
|
|
265
|
-
for index, build_desc in enumerate(build_descs):
|
|
266
|
-
build_desc_work_dir = os.path.join(work_dir, '%03d' % (index+1))
|
|
267
|
-
builds.append(BuildData(build_desc, build_desc_work_dir, source_dir))
|
|
268
|
-
fmatrixmap.write('%s: %s\n' % (build_desc_work_dir, build_desc))
|
|
269
|
-
for build in builds:
|
|
270
|
-
build.execute_build()
|
|
271
|
-
html_report_path = os.path.join(work_dir, 'batchbuild-report.html')
|
|
272
|
-
generate_html_report(html_report_path, builds)
|
|
273
|
-
print('Done')
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if __name__ == '__main__':
|
|
277
|
-
main()
|
|
278
|
-
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
2
|
-
# Distributed under MIT license, or public domain if desired and
|
|
3
|
-
# recognized in your jurisdiction.
|
|
4
|
-
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
5
|
-
|
|
6
|
-
from __future__ import print_function
|
|
7
|
-
import os.path
|
|
8
|
-
import sys
|
|
9
|
-
|
|
10
|
-
def fix_source_eol(path, is_dry_run = True, verbose = True, eol = '\n'):
|
|
11
|
-
"""Makes sure that all sources have the specified eol sequence (default: unix)."""
|
|
12
|
-
if not os.path.isfile(path):
|
|
13
|
-
raise ValueError('Path "%s" is not a file' % path)
|
|
14
|
-
try:
|
|
15
|
-
f = open(path, 'rb')
|
|
16
|
-
except IOError as msg:
|
|
17
|
-
print("%s: I/O Error: %s" % (file, str(msg)), file=sys.stderr)
|
|
18
|
-
return False
|
|
19
|
-
try:
|
|
20
|
-
raw_lines = f.readlines()
|
|
21
|
-
finally:
|
|
22
|
-
f.close()
|
|
23
|
-
fixed_lines = [line.rstrip('\r\n') + eol for line in raw_lines]
|
|
24
|
-
if raw_lines != fixed_lines:
|
|
25
|
-
print('%s =>' % path, end=' ')
|
|
26
|
-
if not is_dry_run:
|
|
27
|
-
f = open(path, "wb")
|
|
28
|
-
try:
|
|
29
|
-
f.writelines(fixed_lines)
|
|
30
|
-
finally:
|
|
31
|
-
f.close()
|
|
32
|
-
if verbose:
|
|
33
|
-
print(is_dry_run and ' NEED FIX' or ' FIXED')
|
|
34
|
-
return True
|
|
35
|
-
##
|
|
36
|
-
##
|
|
37
|
-
##
|
|
38
|
-
##def _do_fix(is_dry_run = True):
|
|
39
|
-
## from waftools import antglob
|
|
40
|
-
## python_sources = antglob.glob('.',
|
|
41
|
-
## includes = '**/*.py **/wscript **/wscript_build',
|
|
42
|
-
## excludes = antglob.default_excludes + './waf.py',
|
|
43
|
-
## prune_dirs = antglob.prune_dirs + 'waf-* ./build')
|
|
44
|
-
## for path in python_sources:
|
|
45
|
-
## _fix_python_source(path, is_dry_run)
|
|
46
|
-
##
|
|
47
|
-
## cpp_sources = antglob.glob('.',
|
|
48
|
-
## includes = '**/*.cpp **/*.h **/*.inl',
|
|
49
|
-
## prune_dirs = antglob.prune_dirs + 'waf-* ./build')
|
|
50
|
-
## for path in cpp_sources:
|
|
51
|
-
## _fix_source_eol(path, is_dry_run)
|
|
52
|
-
##
|
|
53
|
-
##
|
|
54
|
-
##def dry_fix(context):
|
|
55
|
-
## _do_fix(is_dry_run = True)
|
|
56
|
-
##
|
|
57
|
-
##def fix(context):
|
|
58
|
-
## _do_fix(is_dry_run = False)
|
|
59
|
-
##
|
|
60
|
-
##def shutdown():
|
|
61
|
-
## pass
|
|
62
|
-
##
|
|
63
|
-
##def check(context):
|
|
64
|
-
## # Unit tests are run when "check" target is used
|
|
65
|
-
## ut = UnitTest.unit_test()
|
|
66
|
-
## ut.change_to_testfile_dir = True
|
|
67
|
-
## ut.want_to_see_test_output = True
|
|
68
|
-
## ut.want_to_see_test_error = True
|
|
69
|
-
## ut.run()
|
|
70
|
-
## ut.print_results()
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"""Updates the license text in source file.
|
|
2
|
-
"""
|
|
3
|
-
from __future__ import print_function
|
|
4
|
-
|
|
5
|
-
# An existing license is found if the file starts with the string below,
|
|
6
|
-
# and ends with the first blank line.
|
|
7
|
-
LICENSE_BEGIN = "// Copyright "
|
|
8
|
-
|
|
9
|
-
BRIEF_LICENSE = LICENSE_BEGIN + """2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
10
|
-
// Distributed under MIT license, or public domain if desired and
|
|
11
|
-
// recognized in your jurisdiction.
|
|
12
|
-
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
13
|
-
|
|
14
|
-
""".replace('\r\n','\n')
|
|
15
|
-
|
|
16
|
-
def update_license(path, dry_run, show_diff):
|
|
17
|
-
"""Update the license statement in the specified file.
|
|
18
|
-
Parameters:
|
|
19
|
-
path: path of the C++ source file to update.
|
|
20
|
-
dry_run: if True, just print the path of the file that would be updated,
|
|
21
|
-
but don't change it.
|
|
22
|
-
show_diff: if True, print the path of the file that would be modified,
|
|
23
|
-
as well as the change made to the file.
|
|
24
|
-
"""
|
|
25
|
-
with open(path, 'rt') as fin:
|
|
26
|
-
original_text = fin.read().replace('\r\n','\n')
|
|
27
|
-
newline = fin.newlines and fin.newlines[0] or '\n'
|
|
28
|
-
if not original_text.startswith(LICENSE_BEGIN):
|
|
29
|
-
# No existing license found => prepend it
|
|
30
|
-
new_text = BRIEF_LICENSE + original_text
|
|
31
|
-
else:
|
|
32
|
-
license_end_index = original_text.index('\n\n') # search first blank line
|
|
33
|
-
new_text = BRIEF_LICENSE + original_text[license_end_index+2:]
|
|
34
|
-
if original_text != new_text:
|
|
35
|
-
if not dry_run:
|
|
36
|
-
with open(path, 'wb') as fout:
|
|
37
|
-
fout.write(new_text.replace('\n', newline))
|
|
38
|
-
print('Updated', path)
|
|
39
|
-
if show_diff:
|
|
40
|
-
import difflib
|
|
41
|
-
print('\n'.join(difflib.unified_diff(original_text.split('\n'),
|
|
42
|
-
new_text.split('\n'))))
|
|
43
|
-
return True
|
|
44
|
-
return False
|
|
45
|
-
|
|
46
|
-
def update_license_in_source_directories(source_dirs, dry_run, show_diff):
|
|
47
|
-
"""Updates license text in C++ source files found in directory source_dirs.
|
|
48
|
-
Parameters:
|
|
49
|
-
source_dirs: list of directory to scan for C++ sources. Directories are
|
|
50
|
-
scanned recursively.
|
|
51
|
-
dry_run: if True, just print the path of the file that would be updated,
|
|
52
|
-
but don't change it.
|
|
53
|
-
show_diff: if True, print the path of the file that would be modified,
|
|
54
|
-
as well as the change made to the file.
|
|
55
|
-
"""
|
|
56
|
-
from devtools import antglob
|
|
57
|
-
prune_dirs = antglob.prune_dirs + 'scons-local* ./build* ./libs ./dist'
|
|
58
|
-
for source_dir in source_dirs:
|
|
59
|
-
cpp_sources = antglob.glob(source_dir,
|
|
60
|
-
includes = '''**/*.h **/*.cpp **/*.inl''',
|
|
61
|
-
prune_dirs = prune_dirs)
|
|
62
|
-
for source in cpp_sources:
|
|
63
|
-
update_license(source, dry_run, show_diff)
|
|
64
|
-
|
|
65
|
-
def main():
|
|
66
|
-
usage = """%prog DIR [DIR2...]
|
|
67
|
-
Updates license text in sources of the project in source files found
|
|
68
|
-
in the directory specified on the command-line.
|
|
69
|
-
|
|
70
|
-
Example of call:
|
|
71
|
-
python devtools\licenseupdater.py include src -n --diff
|
|
72
|
-
=> Show change that would be made to the sources.
|
|
73
|
-
|
|
74
|
-
python devtools\licenseupdater.py include src
|
|
75
|
-
=> Update license statement on all sources in directories include/ and src/.
|
|
76
|
-
"""
|
|
77
|
-
from optparse import OptionParser
|
|
78
|
-
parser = OptionParser(usage=usage)
|
|
79
|
-
parser.allow_interspersed_args = False
|
|
80
|
-
parser.add_option('-n', '--dry-run', dest="dry_run", action='store_true', default=False,
|
|
81
|
-
help="""Only show what files are updated, do not update the files""")
|
|
82
|
-
parser.add_option('--diff', dest="show_diff", action='store_true', default=False,
|
|
83
|
-
help="""On update, show change made to the file.""")
|
|
84
|
-
parser.enable_interspersed_args()
|
|
85
|
-
options, args = parser.parse_args()
|
|
86
|
-
update_license_in_source_directories(args, options.dry_run, options.show_diff)
|
|
87
|
-
print('Done')
|
|
88
|
-
|
|
89
|
-
if __name__ == '__main__':
|
|
90
|
-
import sys
|
|
91
|
-
import os.path
|
|
92
|
-
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
93
|
-
main()
|
|
94
|
-
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
2
|
-
# Distributed under MIT license, or public domain if desired and
|
|
3
|
-
# recognized in your jurisdiction.
|
|
4
|
-
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
5
|
-
|
|
6
|
-
from contextlib import closing
|
|
7
|
-
import os
|
|
8
|
-
import tarfile
|
|
9
|
-
|
|
10
|
-
TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
|
|
11
|
-
|
|
12
|
-
def make_tarball(tarball_path, sources, base_dir, prefix_dir=''):
|
|
13
|
-
"""Parameters:
|
|
14
|
-
tarball_path: output path of the .tar.gz file
|
|
15
|
-
sources: list of sources to include in the tarball, relative to the current directory
|
|
16
|
-
base_dir: if a source file is in a sub-directory of base_dir, then base_dir is stripped
|
|
17
|
-
from path in the tarball.
|
|
18
|
-
prefix_dir: all files stored in the tarball be sub-directory of prefix_dir. Set to ''
|
|
19
|
-
to make them child of root.
|
|
20
|
-
"""
|
|
21
|
-
base_dir = os.path.normpath(os.path.abspath(base_dir))
|
|
22
|
-
def archive_name(path):
|
|
23
|
-
"""Makes path relative to base_dir."""
|
|
24
|
-
path = os.path.normpath(os.path.abspath(path))
|
|
25
|
-
common_path = os.path.commonprefix((base_dir, path))
|
|
26
|
-
archive_name = path[len(common_path):]
|
|
27
|
-
if os.path.isabs(archive_name):
|
|
28
|
-
archive_name = archive_name[1:]
|
|
29
|
-
return os.path.join(prefix_dir, archive_name)
|
|
30
|
-
def visit(tar, dirname, names):
|
|
31
|
-
for name in names:
|
|
32
|
-
path = os.path.join(dirname, name)
|
|
33
|
-
if os.path.isfile(path):
|
|
34
|
-
path_in_tar = archive_name(path)
|
|
35
|
-
tar.add(path, path_in_tar)
|
|
36
|
-
compression = TARGZ_DEFAULT_COMPRESSION_LEVEL
|
|
37
|
-
with closing(tarfile.TarFile.open(tarball_path, 'w:gz',
|
|
38
|
-
compresslevel=compression)) as tar:
|
|
39
|
-
for source in sources:
|
|
40
|
-
source_path = source
|
|
41
|
-
if os.path.isdir(source):
|
|
42
|
-
for dirpath, dirnames, filenames in os.walk(source_path):
|
|
43
|
-
visit(tar, dirpath, filenames)
|
|
44
|
-
else:
|
|
45
|
-
path_in_tar = archive_name(source_path)
|
|
46
|
-
tar.add(source_path, path_in_tar) # filename, arcname
|
|
47
|
-
|
|
48
|
-
def decompress(tarball_path, base_dir):
|
|
49
|
-
"""Decompress the gzipped tarball into directory base_dir.
|
|
50
|
-
"""
|
|
51
|
-
with closing(tarfile.TarFile.open(tarball_path)) as tar:
|
|
52
|
-
tar.extractall(base_dir)
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
"""Script to generate doxygen documentation.
|
|
2
|
-
"""
|
|
3
|
-
from __future__ import print_function
|
|
4
|
-
from __future__ import unicode_literals
|
|
5
|
-
from devtools import tarball
|
|
6
|
-
from contextlib import contextmanager
|
|
7
|
-
import subprocess
|
|
8
|
-
import traceback
|
|
9
|
-
import re
|
|
10
|
-
import os
|
|
11
|
-
import sys
|
|
12
|
-
import shutil
|
|
13
|
-
|
|
14
|
-
@contextmanager
|
|
15
|
-
def cd(newdir):
|
|
16
|
-
"""
|
|
17
|
-
http://stackoverflow.com/questions/431684/how-do-i-cd-in-python
|
|
18
|
-
"""
|
|
19
|
-
prevdir = os.getcwd()
|
|
20
|
-
os.chdir(newdir)
|
|
21
|
-
try:
|
|
22
|
-
yield
|
|
23
|
-
finally:
|
|
24
|
-
os.chdir(prevdir)
|
|
25
|
-
|
|
26
|
-
def find_program(*filenames):
|
|
27
|
-
"""find a program in folders path_lst, and sets env[var]
|
|
28
|
-
@param filenames: a list of possible names of the program to search for
|
|
29
|
-
@return: the full path of the filename if found, or '' if filename could not be found
|
|
30
|
-
"""
|
|
31
|
-
paths = os.environ.get('PATH', '').split(os.pathsep)
|
|
32
|
-
suffixes = ('win32' in sys.platform) and '.exe .com .bat .cmd' or ''
|
|
33
|
-
for filename in filenames:
|
|
34
|
-
for name in [filename+ext for ext in suffixes.split(' ')]:
|
|
35
|
-
for directory in paths:
|
|
36
|
-
full_path = os.path.join(directory, name)
|
|
37
|
-
if os.path.isfile(full_path):
|
|
38
|
-
return full_path
|
|
39
|
-
return ''
|
|
40
|
-
|
|
41
|
-
def do_subst_in_file(targetfile, sourcefile, dict):
|
|
42
|
-
"""Replace all instances of the keys of dict with their values.
|
|
43
|
-
For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
|
|
44
|
-
then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
|
|
45
|
-
"""
|
|
46
|
-
with open(sourcefile, 'r') as f:
|
|
47
|
-
contents = f.read()
|
|
48
|
-
for (k,v) in list(dict.items()):
|
|
49
|
-
v = v.replace('\\','\\\\')
|
|
50
|
-
contents = re.sub(k, v, contents)
|
|
51
|
-
with open(targetfile, 'w') as f:
|
|
52
|
-
f.write(contents)
|
|
53
|
-
|
|
54
|
-
def getstatusoutput(cmd):
|
|
55
|
-
"""cmd is a list.
|
|
56
|
-
"""
|
|
57
|
-
try:
|
|
58
|
-
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
59
|
-
output, _ = process.communicate()
|
|
60
|
-
status = process.returncode
|
|
61
|
-
except:
|
|
62
|
-
status = -1
|
|
63
|
-
output = traceback.format_exc()
|
|
64
|
-
return status, output
|
|
65
|
-
|
|
66
|
-
def run_cmd(cmd, silent=False):
|
|
67
|
-
"""Raise exception on failure.
|
|
68
|
-
"""
|
|
69
|
-
info = 'Running: %r in %r' %(' '.join(cmd), os.getcwd())
|
|
70
|
-
print(info)
|
|
71
|
-
sys.stdout.flush()
|
|
72
|
-
if silent:
|
|
73
|
-
status, output = getstatusoutput(cmd)
|
|
74
|
-
else:
|
|
75
|
-
status, output = subprocess.call(cmd), ''
|
|
76
|
-
if status:
|
|
77
|
-
msg = 'Error while %s ...\n\terror=%d, output="""%s"""' %(info, status, output)
|
|
78
|
-
raise Exception(msg)
|
|
79
|
-
|
|
80
|
-
def assert_is_exe(path):
|
|
81
|
-
if not path:
|
|
82
|
-
raise Exception('path is empty.')
|
|
83
|
-
if not os.path.isfile(path):
|
|
84
|
-
raise Exception('%r is not a file.' %path)
|
|
85
|
-
if not os.access(path, os.X_OK):
|
|
86
|
-
raise Exception('%r is not executable by this user.' %path)
|
|
87
|
-
|
|
88
|
-
def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
|
|
89
|
-
assert_is_exe(doxygen_path)
|
|
90
|
-
config_file = os.path.abspath(config_file)
|
|
91
|
-
with cd(working_dir):
|
|
92
|
-
cmd = [doxygen_path, config_file]
|
|
93
|
-
run_cmd(cmd, is_silent)
|
|
94
|
-
|
|
95
|
-
def build_doc(options, make_release=False):
|
|
96
|
-
if make_release:
|
|
97
|
-
options.make_tarball = True
|
|
98
|
-
options.with_dot = True
|
|
99
|
-
options.with_html_help = True
|
|
100
|
-
options.with_uml_look = True
|
|
101
|
-
options.open = False
|
|
102
|
-
options.silent = True
|
|
103
|
-
|
|
104
|
-
version = open('version', 'rt').read().strip()
|
|
105
|
-
output_dir = 'dist/doxygen' # relative to doc/doxyfile location.
|
|
106
|
-
if not os.path.isdir(output_dir):
|
|
107
|
-
os.makedirs(output_dir)
|
|
108
|
-
top_dir = os.path.abspath('.')
|
|
109
|
-
html_output_dirname = 'jsoncpp-api-html-' + version
|
|
110
|
-
tarball_path = os.path.join('dist', html_output_dirname + '.tar.gz')
|
|
111
|
-
warning_log_path = os.path.join(output_dir, '../jsoncpp-doxygen-warning.log')
|
|
112
|
-
html_output_path = os.path.join(output_dir, html_output_dirname)
|
|
113
|
-
def yesno(bool):
|
|
114
|
-
return bool and 'YES' or 'NO'
|
|
115
|
-
subst_keys = {
|
|
116
|
-
'%JSONCPP_VERSION%': version,
|
|
117
|
-
'%DOC_TOPDIR%': '',
|
|
118
|
-
'%TOPDIR%': top_dir,
|
|
119
|
-
'%HTML_OUTPUT%': os.path.join('..', output_dir, html_output_dirname),
|
|
120
|
-
'%HAVE_DOT%': yesno(options.with_dot),
|
|
121
|
-
'%DOT_PATH%': os.path.split(options.dot_path)[0],
|
|
122
|
-
'%HTML_HELP%': yesno(options.with_html_help),
|
|
123
|
-
'%UML_LOOK%': yesno(options.with_uml_look),
|
|
124
|
-
'%WARNING_LOG_PATH%': os.path.join('..', warning_log_path)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if os.path.isdir(output_dir):
|
|
128
|
-
print('Deleting directory:', output_dir)
|
|
129
|
-
shutil.rmtree(output_dir)
|
|
130
|
-
if not os.path.isdir(output_dir):
|
|
131
|
-
os.makedirs(output_dir)
|
|
132
|
-
|
|
133
|
-
do_subst_in_file('doc/doxyfile', options.doxyfile_input_path, subst_keys)
|
|
134
|
-
run_doxygen(options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent)
|
|
135
|
-
if not options.silent:
|
|
136
|
-
print(open(warning_log_path, 'r').read())
|
|
137
|
-
index_path = os.path.abspath(os.path.join('doc', subst_keys['%HTML_OUTPUT%'], 'index.html'))
|
|
138
|
-
print('Generated documentation can be found in:')
|
|
139
|
-
print(index_path)
|
|
140
|
-
if options.open:
|
|
141
|
-
import webbrowser
|
|
142
|
-
webbrowser.open('file://' + index_path)
|
|
143
|
-
if options.make_tarball:
|
|
144
|
-
print('Generating doc tarball to', tarball_path)
|
|
145
|
-
tarball_sources = [
|
|
146
|
-
output_dir,
|
|
147
|
-
'README.md',
|
|
148
|
-
'LICENSE',
|
|
149
|
-
'NEWS.txt',
|
|
150
|
-
'version'
|
|
151
|
-
]
|
|
152
|
-
tarball_basedir = os.path.join(output_dir, html_output_dirname)
|
|
153
|
-
tarball.make_tarball(tarball_path, tarball_sources, tarball_basedir, html_output_dirname)
|
|
154
|
-
return tarball_path, html_output_dirname
|
|
155
|
-
|
|
156
|
-
def main():
|
|
157
|
-
usage = """%prog
|
|
158
|
-
Generates doxygen documentation in build/doxygen.
|
|
159
|
-
Optionally makes a tarball of the documentation to dist/.
|
|
160
|
-
|
|
161
|
-
Must be started in the project top directory.
|
|
162
|
-
"""
|
|
163
|
-
from optparse import OptionParser
|
|
164
|
-
parser = OptionParser(usage=usage)
|
|
165
|
-
parser.allow_interspersed_args = False
|
|
166
|
-
parser.add_option('--with-dot', dest="with_dot", action='store_true', default=False,
|
|
167
|
-
help="""Enable usage of DOT to generate collaboration diagram""")
|
|
168
|
-
parser.add_option('--dot', dest="dot_path", action='store', default=find_program('dot'),
|
|
169
|
-
help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""")
|
|
170
|
-
parser.add_option('--doxygen', dest="doxygen_path", action='store', default=find_program('doxygen'),
|
|
171
|
-
help="""Path to Doxygen tool. [Default: %default]""")
|
|
172
|
-
parser.add_option('--in', dest="doxyfile_input_path", action='store', default='doc/doxyfile.in',
|
|
173
|
-
help="""Path to doxygen inputs. [Default: %default]""")
|
|
174
|
-
parser.add_option('--with-html-help', dest="with_html_help", action='store_true', default=False,
|
|
175
|
-
help="""Enable generation of Microsoft HTML HELP""")
|
|
176
|
-
parser.add_option('--no-uml-look', dest="with_uml_look", action='store_false', default=True,
|
|
177
|
-
help="""Generates DOT graph without UML look [Default: False]""")
|
|
178
|
-
parser.add_option('--open', dest="open", action='store_true', default=False,
|
|
179
|
-
help="""Open the HTML index in the web browser after generation""")
|
|
180
|
-
parser.add_option('--tarball', dest="make_tarball", action='store_true', default=False,
|
|
181
|
-
help="""Generates a tarball of the documentation in dist/ directory""")
|
|
182
|
-
parser.add_option('-s', '--silent', dest="silent", action='store_true', default=False,
|
|
183
|
-
help="""Hides doxygen output""")
|
|
184
|
-
parser.enable_interspersed_args()
|
|
185
|
-
options, args = parser.parse_args()
|
|
186
|
-
build_doc(options)
|
|
187
|
-
|
|
188
|
-
if __name__ == '__main__':
|
|
189
|
-
main()
|