aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2014-06-18 10:31:40 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-18 10:31:40 -0700
commitf01a6c3663970ccd6e1882e76a887e0fda467b77 (patch)
tree849e0d79d4188528cf17849bb9535a452c05dfde
parentb59161f0000eb4aca3dcef29f27ffd0fb5a568e5 (diff)
In Android framework, make tools depend on jsoncpp
Always build the tools with JSON, but either build our own or use the system's. Rename skia_build_json_writer to skia_use_system_jsoncpp, since we now always build with JSON. Remove SK_BUILD_JSON_WRITER, which was only there so we could build without JSON it in the framework. BUG=skia:2448 R=djsollen@google.com, reed@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/303913002
-rw-r--r--bench/ResultsWriter.cpp3
-rw-r--r--bench/ResultsWriter.h3
-rw-r--r--bench/TimerData.cpp2
-rw-r--r--bench/TimerData.h2
-rw-r--r--bench/benchmain.cpp4
-rw-r--r--dm/DM.cpp8
-rw-r--r--dm/DMExpectations.h2
-rw-r--r--gm/gm_expectations.cpp12
-rw-r--r--gm/gm_expectations.h12
-rw-r--r--gm/gmmain.cpp12
-rw-r--r--gyp/common_conditions.gypi6
-rw-r--r--gyp/common_variables.gypi8
-rw-r--r--gyp/jsoncpp.gyp11
-rw-r--r--include/utils/SkJSONCPP.h4
-rw-r--r--tools/PictureResultsWriter.h2
-rw-r--r--tools/bench_pictures_main.cpp4
16 files changed, 12 insertions, 83 deletions
diff --git a/bench/ResultsWriter.cpp b/bench/ResultsWriter.cpp
index 0bfcba8b1e..08f11c190f 100644
--- a/bench/ResultsWriter.cpp
+++ b/bench/ResultsWriter.cpp
@@ -9,8 +9,6 @@
#include "ResultsWriter.h"
-#ifdef SK_BUILD_JSON_WRITER
-
Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) {
Json::Value* search_results = NULL;
for(Json::Value::iterator iter = root->begin();
@@ -30,4 +28,3 @@ Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) {
}
}
-#endif // SK_BUILD_JSON_WRITER
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index c66593864f..e089d7fd07 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -77,7 +77,6 @@ private:
const char* fTimeFormat;
};
-#ifdef SK_BUILD_JSON_WRITER
/**
* This ResultsWriter handles writing out the results in JSON.
*
@@ -146,8 +145,6 @@ private:
Json::Value* fConfig;
};
-#endif // SK_BUILD_JSON_WRITER
-
/**
* This ResultsWriter writes out to multiple ResultsWriters.
*/
diff --git a/bench/TimerData.cpp b/bench/TimerData.cpp
index d3dbf28524..0cb000280b 100644
--- a/bench/TimerData.cpp
+++ b/bench/TimerData.cpp
@@ -140,7 +140,6 @@ SkString TimerData::getResult(const char* doubleFormat,
return str;
}
-#ifdef SK_BUILD_JSON_WRITER
Json::Value TimerData::getJSON(uint32_t timerFlags,
Result result,
int itersPerTiming) {
@@ -223,4 +222,3 @@ Json::Value TimerData::getJSON(uint32_t timerFlags,
}
return dataNode;
}
-#endif // SK_BUILD_JSON_WRITER
diff --git a/bench/TimerData.h b/bench/TimerData.h
index be6158bbd8..fb84df1a9e 100644
--- a/bench/TimerData.h
+++ b/bench/TimerData.h
@@ -68,11 +68,9 @@ public:
const char* configName,
uint32_t timerFlags,
int itersPerTiming = 1);
-#ifdef SK_BUILD_JSON_WRITER
Json::Value getJSON(uint32_t timerFlags,
Result result,
int itersPerTiming = 1);
-#endif // SK_BUILD_JSON_WRITER
private:
int fMaxNumTimings;
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index af70878282..6e18a8ab3a 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -255,9 +255,7 @@ DEFINE_double(error, 0.01,
DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops.");
DEFINE_bool2(verbose, v, false, "Print more.");
DEFINE_string2(resourcePath, i, "resources", "directory for test resources.");
-#ifdef SK_BUILD_JSON_WRITER
DEFINE_string(outResultsFile, "", "If given, the results will be written to the file in JSON format.");
-#endif
DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done.");
// Has this bench converged? First arguments are milliseconds / loop iteration,
@@ -291,13 +289,11 @@ int tool_main(int argc, char** argv) {
MultiResultsWriter writer;
writer.add(&logWriter);
-#ifdef SK_BUILD_JSON_WRITER
SkAutoTDelete<JSONResultsWriter> jsonWriter;
if (FLAGS_outResultsFile.count()) {
jsonWriter.reset(SkNEW(JSONResultsWriter(FLAGS_outResultsFile[0])));
writer.add(jsonWriter.get());
}
-#endif
// Instantiate after all the writers have been added to writer so that we
// call close() before their destructors are called on the way out.
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 87555984bc..776b642e7b 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -38,16 +38,10 @@ using skiatest::TestRegistry;
DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS.");
DEFINE_int32(gpuThreads, 1, "Threads for GPU work.");
-#ifdef SK_BUILD_JSON_WRITER
DEFINE_string2(expectations, r, "",
"If a directory, compare generated images against images under this path. "
"If a file, compare generated images against JSON expectations at this path."
);
-#else
-DEFINE_string2(expectations, r, "",
- "If a directory, compare generated images against images under this path. "
-);
-#endif
DEFINE_string2(resources, i, "resources", "Path to resources directory.");
DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n"
"Multiple matches may be separated by spaces.\n"
@@ -249,9 +243,7 @@ int tool_main(int argc, char** argv) {
if (sk_isdir(path)) {
expectations.reset(SkNEW_ARGS(DM::WriteTask::Expectations, (path)));
} else {
-#ifdef SK_BUILD_JSON_WRITER
expectations.reset(SkNEW_ARGS(DM::JsonExpectations, (path)));
-#endif
}
}
}
diff --git a/dm/DMExpectations.h b/dm/DMExpectations.h
index 5509709104..238d1c5bea 100644
--- a/dm/DMExpectations.h
+++ b/dm/DMExpectations.h
@@ -19,7 +19,6 @@ public:
bool check(const Task&, SkBitmap) const SK_OVERRIDE { return true; }
};
-#ifdef SK_BUILD_JSON_WRITER
class JsonExpectations : public Expectations {
public:
explicit JsonExpectations(const char* path) : fGMExpectations(path) {}
@@ -41,7 +40,6 @@ public:
private:
skiagm::JsonExpectationsSource fGMExpectations;
};
-#endif
} // namespace DM
diff --git a/gm/gm_expectations.cpp b/gm/gm_expectations.cpp
index f0ccb3e378..70890707cf 100644
--- a/gm/gm_expectations.cpp
+++ b/gm/gm_expectations.cpp
@@ -31,7 +31,6 @@ const static char kJsonKey_Hashtype_Bitmap_64bitMD5[] = "bitmap-64bitMD5";
namespace skiagm {
-#ifdef SK_BUILD_JSON_WRITER
Json::Value CreateJsonTree(Json::Value expectedResults,
Json::Value actualResultsFailed,
Json::Value actualResultsFailureIgnored,
@@ -47,7 +46,6 @@ namespace skiagm {
root[kJsonKey_ExpectedResults] = expectedResults;
return root;
}
-#endif
// GmResultDigest class...
@@ -55,7 +53,6 @@ namespace skiagm {
fIsValid = SkBitmapHasher::ComputeDigest(bitmap, &fHashDigest);
}
-#ifdef SK_BUILD_JSON_WRITER
GmResultDigest::GmResultDigest(const Json::Value &jsonTypeValuePair) {
fIsValid = false;
if (!jsonTypeValuePair.isArray()) {
@@ -80,7 +77,6 @@ namespace skiagm {
}
}
}
-#endif
bool GmResultDigest::isValid() const {
return fIsValid;
@@ -92,7 +88,6 @@ namespace skiagm {
return (this->fIsValid && other.fIsValid && (this->fHashDigest == other.fHashDigest));
}
-#ifdef SK_BUILD_JSON_WRITER
Json::Value GmResultDigest::asJsonTypeValuePair() const {
// TODO(epoger): The current implementation assumes that the
// result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
@@ -105,7 +100,6 @@ namespace skiagm {
}
return jsonTypeValuePair;
}
-#endif
SkString GmResultDigest::getHashType() const {
// TODO(epoger): The current implementation assumes that the
@@ -140,7 +134,6 @@ namespace skiagm {
fAllowedResultDigests.push_back(bitmapAndDigest.fDigest);
}
-#ifdef SK_BUILD_JSON_WRITER
Expectations::Expectations(Json::Value jsonElement) {
if (jsonElement.empty()) {
fIgnoreFailure = kDefaultIgnoreFailure;
@@ -173,7 +166,6 @@ namespace skiagm {
}
}
}
-#endif
bool Expectations::match(GmResultDigest actualGmResultDigest) const {
for (int i=0; i < this->fAllowedResultDigests.count(); i++) {
@@ -185,7 +177,6 @@ namespace skiagm {
return false;
}
-#ifdef SK_BUILD_JSON_WRITER
Json::Value Expectations::asJsonValue() const {
Json::Value allowedDigestArray;
if (!this->fAllowedResultDigests.empty()) {
@@ -199,7 +190,6 @@ namespace skiagm {
jsonExpectations[kJsonKey_ExpectedResults_IgnoreFailure] = this->ignoreFailure();
return jsonExpectations;
}
-#endif
// IndividualImageExpectationsSource class...
@@ -217,7 +207,6 @@ namespace skiagm {
}
-#ifdef SK_BUILD_JSON_WRITER
// JsonExpectationsSource class...
JsonExpectationsSource::JsonExpectationsSource(const char *jsonPath) {
@@ -247,5 +236,4 @@ namespace skiagm {
}
return true;
}
-#endif
}
diff --git a/gm/gm_expectations.h b/gm/gm_expectations.h
index c69fafc130..1cd6a1f756 100644
--- a/gm/gm_expectations.h
+++ b/gm/gm_expectations.h
@@ -22,13 +22,11 @@
namespace skiagm {
-#ifdef SK_BUILD_JSON_WRITER
Json::Value CreateJsonTree(Json::Value expectedResults,
Json::Value actualResultsFailed,
Json::Value actualResultsFailureIgnored,
Json::Value actualResultsNoComparison,
Json::Value actualResultsSucceeded);
-#endif
/**
* The digest of a GM test result.
*
@@ -42,14 +40,12 @@ namespace skiagm {
*/
explicit GmResultDigest(const SkBitmap &bitmap);
-#ifdef SK_BUILD_JSON_WRITER
/**
* Create a ResultDigest representing an allowed result
* checksum within JSON expectations file, in the form
* ["bitmap-64bitMD5", 12345].
*/
explicit GmResultDigest(const Json::Value &jsonTypeValuePair);
-#endif
/**
* Returns true if this GmResultDigest was fully and successfully
@@ -63,13 +59,11 @@ namespace skiagm {
*/
bool equals(const GmResultDigest &other) const;
-#ifdef SK_BUILD_JSON_WRITER
/**
* Returns a JSON type/value pair representing this result,
* such as ["bitmap-64bitMD5", 12345].
*/
Json::Value asJsonTypeValuePair() const;
-#endif
/**
* Returns the hashtype, such as "bitmap-64bitMD5", as an SkString.
@@ -118,7 +112,6 @@ namespace skiagm {
*/
explicit Expectations(const BitmapAndDigest& bitmapAndDigest);
-#ifdef SK_BUILD_JSON_WRITER
/**
* Create Expectations from a JSON element as found within the
* kJsonKey_ExpectedResults section.
@@ -127,7 +120,6 @@ namespace skiagm {
* don't have any expectations.
*/
explicit Expectations(Json::Value jsonElement);
-#endif
/**
* Returns true iff we want to ignore failed expectations.
@@ -161,12 +153,10 @@ namespace skiagm {
return (kUnknown_SkColorType == fBitmap.colorType()) ? NULL : &fBitmap;
}
-#ifdef SK_BUILD_JSON_WRITER
/**
* Return a JSON representation of the expectations.
*/
Json::Value asJsonValue() const;
-#endif
private:
const static bool kDefaultIgnoreFailure = false;
@@ -209,7 +199,6 @@ namespace skiagm {
const SkString fRootDir;
};
-#ifdef SK_BUILD_JSON_WRITER
/**
* Return Expectations based on JSON summary file.
*/
@@ -237,7 +226,6 @@ namespace skiagm {
Json::Value fJsonRoot;
Json::Value fJsonExpectedResults;
};
-#endif // SK_BUILD_JSON_WRITER
}
#endif
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 37237695c0..0be3454d82 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -869,7 +869,6 @@ public:
const GmResultDigest &actualResultDigest,
ErrorCombination errors,
bool ignoreFailure) {
-#ifdef SK_BUILD_JSON_WRITER
Json::Value jsonActualResults = actualResultDigest.asJsonTypeValuePair();
Json::Value *resultCollection = NULL;
@@ -901,7 +900,6 @@ public:
if (resultCollection) {
(*resultCollection)[testName] = jsonActualResults;
}
-#endif
}
/**
@@ -909,9 +907,7 @@ public:
*/
void add_expected_results_to_json_summary(const char testName[],
Expectations expectations) {
-#ifdef SK_BUILD_JSON_WRITER
this->fJsonExpectedResults[testName] = expectations.asJsonValue();
-#endif
}
/**
@@ -1271,14 +1267,12 @@ public:
// If unset, we don't do comparisons.
SkAutoTUnref<ExpectationsSource> fExpectationsSource;
-#ifdef SK_BUILD_JSON_WRITER
// JSON summaries that we generate as we go (just for output).
Json::Value fJsonExpectedResults;
Json::Value fJsonActualResults_Failed;
Json::Value fJsonActualResults_FailureIgnored;
Json::Value fJsonActualResults_NoComparison;
Json::Value fJsonActualResults_Succeeded;
-#endif
}; // end of GMMain class definition
#if SK_SUPPORT_GPU
@@ -1475,9 +1469,7 @@ DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i
"each test).");
DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-"
"based filenames, as rebaseline.py will use when downloading them from Google Storage");
-#ifdef SK_BUILD_JSON_WRITER
DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file.");
-#endif
DEFINE_string2(writePath, w, "", "Write rendered images into this directory.");
DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.");
DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, "
@@ -2201,12 +2193,10 @@ static bool parse_flags_gmmain_paths(GMMain* gmmain) {
gmmain->fExpectationsSource.reset(SkNEW_ARGS(
IndividualImageExpectationsSource, (readPath)));
} else {
-#ifdef SK_BUILD_JSON_WRITER
if (FLAGS_verbose) {
SkDebugf("reading expectations from JSON summary file %s\n", readPath);
}
gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource, (readPath)));
-#endif
}
}
return true;
@@ -2413,7 +2403,6 @@ int tool_main(int argc, char** argv) {
}
#endif
-#ifdef SK_BUILD_JSON_WRITER
if (FLAGS_writeJsonSummaryPath.count() == 1) {
Json::Value root = CreateJsonTree(
gmmain.fJsonExpectedResults,
@@ -2423,7 +2412,6 @@ int tool_main(int argc, char** argv) {
SkFILEWStream stream(FLAGS_writeJsonSummaryPath[0]);
stream.write(jsonStdString.c_str(), jsonStdString.length());
}
-#endif
#if SK_SUPPORT_GPU
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index b908903f80..b1317661c2 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -680,12 +680,6 @@
],
}],
- [ 'skia_build_json_writer', {
- 'defines': [
- 'SK_BUILD_JSON_WRITER',
- ]
- }],
-
], # end 'conditions'
# The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
'xcode_settings': {
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index f0c065f79b..c414c75e63 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -64,13 +64,11 @@
[ 'skia_android_framework == 1', {
'skia_os%': 'android',
'skia_chrome_utils%': 0,
- # FIXME (scroggo): JSON is disabled in Android framework until we
- # solve skbug.com/2448
- 'skia_build_json_writer%': 0,
+ 'skia_use_system_json%': 1,
}, {
'skia_os%': '<(skia_os)',
'skia_chrome_utils%': 1,
- 'skia_build_json_writer%': 1,
+ 'skia_use_system_json%': 0,
}],
[ 'skia_os == "win"', {
'os_posix%': 0,
@@ -204,7 +202,7 @@
'skia_mesa%': '<(skia_mesa)',
'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)',
'skia_android_framework%': '<(skia_android_framework)',
- 'skia_build_json_writer%': '<(skia_build_json_writer)',
+ 'skia_use_system_json%': '<(skia_use_system_json)',
'skia_android_path_rendering%': '<(skia_android_path_rendering)',
'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)',
'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)',
diff --git a/gyp/jsoncpp.gyp b/gyp/jsoncpp.gyp
index 0507ed06a1..337f716a18 100644
--- a/gyp/jsoncpp.gyp
+++ b/gyp/jsoncpp.gyp
@@ -18,9 +18,16 @@
'targets': [
{
'target_name': 'jsoncpp',
- 'type': 'static_library',
'conditions': [
- ['skia_build_json_writer', {
+ ['skia_use_system_json', {
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'libraries': [
+ 'jsoncpp.a',
+ ],
+ },
+ }, {
+ 'type': 'static_library',
'defines': [
'JSON_USE_EXCEPTION=0',
],
diff --git a/include/utils/SkJSONCPP.h b/include/utils/SkJSONCPP.h
index 0582e8f5a9..de827687e0 100644
--- a/include/utils/SkJSONCPP.h
+++ b/include/utils/SkJSONCPP.h
@@ -10,8 +10,6 @@
#ifndef SkJSONCPP_DEFINED
#define SkJSONCPP_DEFINED
-#ifdef SK_BUILD_JSON_WRITER
-
#ifdef SK_BUILD_FOR_WIN
// json includes xlocale which generates warning 4530 because we're
// compiling without exceptions;
@@ -26,6 +24,4 @@
#pragma warning(pop)
#endif
-#endif // SK_BUILD_JSON_WRITER
-
#endif // SkJSONCPP_DEFINED
diff --git a/tools/PictureResultsWriter.h b/tools/PictureResultsWriter.h
index 9aa33b52ec..272a50c4c3 100644
--- a/tools/PictureResultsWriter.h
+++ b/tools/PictureResultsWriter.h
@@ -140,7 +140,6 @@ private:
SkString currentLine;
};
-#ifdef SK_BUILD_JSON_WRITER
/**
* This PictureResultsWriter collects data in a JSON node
*
@@ -227,6 +226,5 @@ private:
Json::Value *fCurrentTileSet;
Json::Value *fCurrentTile;
};
-#endif // SK_BUILD_JSON_WRITER
#endif
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index c267c4cb9b..6b76bfc8ef 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -39,9 +39,7 @@ DEFINE_string(filter, "",
"Specific flags are listed above.");
DEFINE_string(logFile, "", "Destination for writing log output, in addition to stdout.");
DEFINE_bool(logPerIter, false, "Log each repeat timer instead of mean.");
-#ifdef SK_BUILD_JSON_WRITER
DEFINE_string(jsonLog, "", "Destination for writing JSON data.");
-#endif
DEFINE_bool(min, false, "Print the minimum times (instead of average).");
DECLARE_int32(multi);
DECLARE_string(readPath);
@@ -419,14 +417,12 @@ int tool_main(int argc, char** argv) {
}
}
-#ifdef SK_BUILD_JSON_WRITER
SkAutoTDelete<PictureJSONResultsWriter> jsonWriter;
if (FLAGS_jsonLog.count() == 1) {
jsonWriter.reset(SkNEW(PictureJSONResultsWriter(FLAGS_jsonLog[0])));
gWriter.add(jsonWriter.get());
}
-#endif
gWriter.add(&gLogWriter);