From 62b8ddfc34fc285260a517fe9baf65ddb8faf80b Mon Sep 17 00:00:00 2001
From: "Nicolas \"Pixel\" Noble" <pixel@nobis-crew.org>
Date: Wed, 22 Apr 2015 17:36:47 +0200
Subject: [PATCH] Supporting comments in build-cleaner.

---
 build.json                      | 7 +++----
 tools/buildgen/build-cleaner.py | 4 ++++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/build.json b/build.json
index 7d6afd48cb..341c0fe3c3 100644
--- a/build.json
+++ b/build.json
@@ -1,8 +1,7 @@
 {
-  "#": "This file describes the list of targets and dependencies.",
-  "#": "It is used among other things to generate all of our project files.",
-  "#": "Please refer to the templates directory for more information.",
-
+  "#1": "This file describes the list of targets and dependencies.",
+  "#2": "It is used among other things to generate all of our project files.",
+  "#3": "Please refer to the templates directory for more information.",
   "settings": {
     "#": "The public version number of the library.",
     "version": {
diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py
index 6c5355bce3..fba103723c 100755
--- a/tools/buildgen/build-cleaner.py
+++ b/tools/buildgen/build-cleaner.py
@@ -52,11 +52,15 @@ _ELEM_KEYS = [
 
 def rebuild_as_ordered_dict(indict, special_keys):
   outdict = collections.OrderedDict()
+  for key in sorted(indict.keys()):
+    if '#' in key:
+      outdict[key] = indict[key]
   for key in special_keys:
     if key in indict:
       outdict[key] = indict[key]
   for key in sorted(indict.keys()):
     if key in special_keys: continue
+    if '#' in key: continue
     outdict[key] = indict[key]
   return outdict
 
-- 
GitLab