Bug 1356382 - Move jsoncpp library and ensure it is included even when crashreporter is not
MozReview-Commit-ID: 2g9sFP6QQCU
--- a/build/clang-plugin/Utils.h
+++ b/build/clang-plugin/Utils.h
@@ -234,16 +234,17 @@ inline bool isIgnoredPathForSprintfLiter
End = llvm::sys::path::rend(FileName);
for (; Begin != End; ++Begin) {
if (Begin->compare_lower(StringRef("angle")) == 0 ||
Begin->compare_lower(StringRef("chromium")) == 0 ||
Begin->compare_lower(StringRef("crashreporter")) == 0 ||
Begin->compare_lower(StringRef("google-breakpad")) == 0 ||
Begin->compare_lower(StringRef("gflags")) == 0 ||
Begin->compare_lower(StringRef("harfbuzz")) == 0 ||
+ Begin->compare_lower(StringRef("jsoncpp")) == 0 ||
Begin->compare_lower(StringRef("libstagefright")) == 0 ||
Begin->compare_lower(StringRef("mtransport")) == 0 ||
Begin->compare_lower(StringRef("protobuf")) == 0 ||
Begin->compare_lower(StringRef("skia")) == 0 ||
Begin->compare_lower(StringRef("sfntly")) == 0 ||
// Gtest uses snprintf as GTEST_SNPRINTF_ with sizeof
Begin->compare_lower(StringRef("testing")) == 0) {
return true;
--- a/gfx/vr/openvr/moz.build
+++ b/gfx/vr/openvr/moz.build
@@ -18,17 +18,17 @@ if CONFIG['OS_ARCH'] == 'WINNT':
# will also need to define these:
#
# LINUX64
# LINUX
# OSX
# POSIX
LOCAL_INCLUDES += [
- '/toolkit/crashreporter/jsoncpp/include',
+ '/toolkit/components/jsoncpp/include',
]
USE_LIBS += [
'jsoncpp',
]
EXPORTS += [
'headers/openvr.h',
rename from toolkit/crashreporter/jsoncpp/AUTHORS
rename to toolkit/components/jsoncpp/AUTHORS
rename from toolkit/crashreporter/jsoncpp/GIT-INFO
rename to toolkit/components/jsoncpp/GIT-INFO
rename from toolkit/crashreporter/jsoncpp/LICENSE
rename to toolkit/components/jsoncpp/LICENSE
rename from toolkit/crashreporter/jsoncpp/NEWS.txt
rename to toolkit/components/jsoncpp/NEWS.txt
rename from toolkit/crashreporter/jsoncpp/README.md
rename to toolkit/components/jsoncpp/README.md
rename from toolkit/crashreporter/jsoncpp/include/json/allocator.h
rename to toolkit/components/jsoncpp/include/json/allocator.h
rename from toolkit/crashreporter/jsoncpp/include/json/assertions.h
rename to toolkit/components/jsoncpp/include/json/assertions.h
rename from toolkit/crashreporter/jsoncpp/include/json/autolink.h
rename to toolkit/components/jsoncpp/include/json/autolink.h
rename from toolkit/crashreporter/jsoncpp/include/json/config.h
rename to toolkit/components/jsoncpp/include/json/config.h
rename from toolkit/crashreporter/jsoncpp/include/json/features.h
rename to toolkit/components/jsoncpp/include/json/features.h
rename from toolkit/crashreporter/jsoncpp/include/json/forwards.h
rename to toolkit/components/jsoncpp/include/json/forwards.h
rename from toolkit/crashreporter/jsoncpp/include/json/json.h
rename to toolkit/components/jsoncpp/include/json/json.h
rename from toolkit/crashreporter/jsoncpp/include/json/reader.h
rename to toolkit/components/jsoncpp/include/json/reader.h
rename from toolkit/crashreporter/jsoncpp/include/json/value.h
rename to toolkit/components/jsoncpp/include/json/value.h
rename from toolkit/crashreporter/jsoncpp/include/json/version.h
rename to toolkit/components/jsoncpp/include/json/version.h
rename from toolkit/crashreporter/jsoncpp/include/json/writer.h
rename to toolkit/components/jsoncpp/include/json/writer.h
rename from toolkit/crashreporter/jsoncpp/src/lib_json/json_reader.cpp
rename to toolkit/components/jsoncpp/src/lib_json/json_reader.cpp
rename from toolkit/crashreporter/jsoncpp/src/lib_json/json_tool.h
rename to toolkit/components/jsoncpp/src/lib_json/json_tool.h
rename from toolkit/crashreporter/jsoncpp/src/lib_json/json_value.cpp
rename to toolkit/components/jsoncpp/src/lib_json/json_value.cpp
rename from toolkit/crashreporter/jsoncpp/src/lib_json/json_valueiterator.inl
rename to toolkit/components/jsoncpp/src/lib_json/json_valueiterator.inl
rename from toolkit/crashreporter/jsoncpp/src/lib_json/json_writer.cpp
rename to toolkit/components/jsoncpp/src/lib_json/json_writer.cpp
new file mode 100644
--- /dev/null
+++ b/toolkit/components/jsoncpp/src/lib_json/moz.build
@@ -0,0 +1,49 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+UNIFIED_SOURCES += [
+ 'json_reader.cpp',
+ 'json_value.cpp',
+ 'json_writer.cpp'
+]
+
+LOCAL_INCLUDES += [
+ '/toolkit/components/jsoncpp/include',
+]
+
+# This code is only used in the stand-alone minidump analyzer executable so
+# enabling exceptions should be fine.
+if CONFIG['CLANG_CL']:
+ CXXFLAGS += [
+ '-Xclang',
+ '-fcxx-exceptions',
+ ]
+elif not CONFIG['_MSC_VER']:
+ CXXFLAGS += [
+ '-fexceptions',
+ ]
+
+# Required to build with exceptions enabled
+DISABLE_STL_WRAPPING = True
+
+Library('jsoncpp')
+
+# Suppress warnings in third-party code.
+if CONFIG['_MSC_VER']:
+ CXXFLAGS += [
+ '-wd4005', # macro redefinition
+ ]
+elif CONFIG['GNU_CXX']:
+ CXXFLAGS += [
+ '-Wno-unused-local-typedefs',
+ '-Wno-shadow',
+ ]
+
+if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
+ CXXFLAGS += [
+ '-Wno-implicit-fallthrough',
+ '-Wno-c++11-narrowing',
+ ]
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -29,16 +29,17 @@ DIRS += [
'downloads',
'extensions',
'exthelper',
'filewatcher',
'finalizationwitness',
'formautofill',
'find',
'jsdownloads',
+ 'jsoncpp/src/lib_json',
'lz4',
'mediasniffer',
'microformats',
'mozprotocol',
'osfile',
'parentalcontrols',
'passwordmgr',
'perf',
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -8,17 +8,17 @@ if CONFIG['OS_TARGET'] != 'Android':
Program('crashreporter')
UNIFIED_SOURCES += [
'crashreporter.cpp',
'ping.cpp',
]
LOCAL_INCLUDES += [
- '/toolkit/crashreporter/jsoncpp/include',
+ '/toolkit/components/jsoncpp/include',
]
USE_LIBS += [
'jsoncpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
UNIFIED_SOURCES += [
deleted file mode 100644
--- a/toolkit/crashreporter/jsoncpp/src/lib_json/moz.build
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-UNIFIED_SOURCES += [
- 'json_reader.cpp',
- 'json_value.cpp',
- 'json_writer.cpp'
-]
-
-LOCAL_INCLUDES += [
- '/toolkit/crashreporter/jsoncpp/include',
-]
-
-# This code is only used in the stand-alone minidump analyzer executable so
-# enabling exceptions should be fine.
-if CONFIG['CLANG_CL']:
- CXXFLAGS += [
- '-Xclang',
- '-fcxx-exceptions',
- ]
-elif not CONFIG['_MSC_VER']:
- CXXFLAGS += [
- '-fexceptions',
- ]
-
-# Required to build with exceptions enabled
-DISABLE_STL_WRAPPING = True
-
-Library('jsoncpp')
-
-include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/minidump-analyzer/moz.build
+++ b/toolkit/crashreporter/minidump-analyzer/moz.build
@@ -15,17 +15,17 @@ if CONFIG['OS_TARGET'] != 'Android':
]
USE_LIBS += [
'breakpad_processor',
'jsoncpp',
]
LOCAL_INCLUDES += [
- '/toolkit/crashreporter/jsoncpp/include',
+ '/toolkit/components/jsoncpp/include',
]
if CONFIG['OS_TARGET'] == 'Darwin':
DIST_SUBDIR = 'crashreporter.app/Contents/MacOS'
# Don't use the STL wrappers in the crashreporter clients; they don't
# link with -lmozalloc, and it really doesn't matter here anyway.
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -38,17 +38,16 @@ elif CONFIG['OS_ARCH'] == 'Linux':
'google-breakpad/src/common/linux',
'google-breakpad/src/processor',
'google-breakpad/src/tools/linux/dump_syms',
]
DIRS += [
'client',
- 'jsoncpp/src/lib_json',
'minidump-analyzer',
]
if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
DIRS += ['injector']
UNIFIED_SOURCES += [
'InjectCrashReporter.cpp',
'LoadLibraryRemote.cpp',
--- a/toolkit/crashreporter/update-jsoncpp.sh
+++ b/toolkit/crashreporter/update-jsoncpp.sh
@@ -13,17 +13,17 @@ if [ $# -lt 1 ]; then
fi
crashreporter_dir=$(realpath $(dirname $0))
repo=${crashreporter_dir}/../..
rm -rf ${crashreporter_dir}/jsoncpp
jsoncpp_repo=$1
rev=${2-HEAD}
-(cd $jsoncpp_repo; git archive --prefix=toolkit/crashreporter/jsoncpp/ $rev) | (cd $repo; tar xf -)
+(cd $jsoncpp_repo; git archive --prefix=toolkit/components/jsoncpp/ $rev) | (cd $repo; tar xf -)
# remove some extraneous bits
rm -rf \
${crashreporter_dir}/jsoncpp/.clang-format \
${crashreporter_dir}/jsoncpp/.gitattributes \
${crashreporter_dir}/jsoncpp/.gitignore \
${crashreporter_dir}/jsoncpp/.travis.yml \
${crashreporter_dir}/jsoncpp/CMakeLists.txt \