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
This commit is contained in:
parent
b59161f000
commit
f01a6c3663
@ -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
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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': {
|
||||
|
@ -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)',
|
||||
|
@ -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',
|
||||
],
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user