Skip to content

Commit

Permalink
Make feature_compiler.py patch extensible
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhong committed Jan 25, 2022
1 parent cf118a8 commit fc41836
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
16 changes: 4 additions & 12 deletions patches/tools-json_schema_compiler-feature_compiler.py.patch
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
diff --git a/tools/json_schema_compiler/feature_compiler.py b/tools/json_schema_compiler/feature_compiler.py
index b23dca5689042e1e6f0742ea79c3dcfcc65d168c..fe7105940bf6d6556a6394c689029617457b5f4f 100644
index b23dca5689042e1e6f0742ea79c3dcfcc65d168c..e06644d657e85fe6b42eb602ac7b597c0615a1a7 100644
--- a/tools/json_schema_compiler/feature_compiler.py
+++ b/tools/json_schema_compiler/feature_compiler.py
@@ -771,6 +771,16 @@ class FeatureCompiler(object):
@@ -771,6 +771,8 @@ class FeatureCompiler(object):
abs_source_file)
raise
dupes = set(f_json) & set(self._json)
+ dupes.discard('topSites')
+ dupes.discard('extension.inIncognitoContext')
+ dupes.discard('bookmarkManagerPrivate')
+ dupes.discard('bookmarks')
+ dupes.discard('settingsPrivate')
+ dupes.discard('sockets')
+ dupes.discard('sockets.tcp')
+ dupes.discard('sockets.udp')
+ dupes.discard('sockets.tcpServer')
+ dupes.discard('tabs')
+ from feature_compiler_helper import DiscardBraveOverridesFromDupes
+ DiscardBraveOverridesFromDupes(dupes)
assert not dupes, 'Duplicate keys found: %s' % list(dupes)
self._json.update(f_json)

20 changes: 20 additions & 0 deletions script/feature_compiler_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python

# Copyright (c) 2022 The Brave Authors. All rights reserved.
# 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/.

# When update this method, feature_compiler.py should be touched to make
# feature_compiler.py run. json_feature target doesn't have this in its dependency.
def DiscardBraveOverridesFromDupes(dupes):
dupes.discard('topSites')
dupes.discard('extension.inIncognitoContext')
dupes.discard('bookmarkManagerPrivate')
dupes.discard('bookmarks')
dupes.discard('settingsPrivate')
dupes.discard('sockets')
dupes.discard('sockets.tcp')
dupes.discard('sockets.udp')
dupes.discard('sockets.tcpServer')
dupes.discard('tabs')

0 comments on commit fc41836

Please sign in to comment.