fix const order in docs
SkColor_Reference.md and SkMatrix_Reference.md generated
different contents depending on which platform bookmaker
was built. Fixed so that generated const tables keep
the same order as was defined in the includes.
TBR=reed@google.com,herb@google.com
Docs-Preview: https://skia.org/?cl=165940
Bug: skia:
Change-Id: I69543ff365c2b1d71c4bc6052ffb3acdac990ef4
Reviewed-on: https://skia-review.googlesource.com/c/165940
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp
index 0716bc7..0b4576c 100644
--- a/tools/bookmaker/includeParser.cpp
+++ b/tools/bookmaker/includeParser.cpp
@@ -1765,11 +1765,18 @@
} else {
SkASSERT(0); // only Constant supported for now
}
+ vector<Definition*> consts;
for (auto entry : *mapPtr) {
if (string::npos == entry.first.find(filterContents)) {
continue;
}
- result += this->writeCodeBlock(*entry.second, markType);
+ consts.push_back(entry.second);
+ }
+ std::sort(consts.begin(), consts.end(), [](Definition* def1, Definition* def2) {
+ return def1->fLineCount < def2->fLineCount;
+ } );
+ for (auto oneConst : consts) {
+ result += this->writeCodeBlock(*oneConst, markType);
}
return result;
}