Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: tools/json_schema_compiler/cpp_bundle_generator.py

Issue 1558413002: 'linux' platform should exclude 'chromeos' in json compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/json_schema_compiler/cpp_bundle_generator_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import code 5 import code
6 import cpp_util 6 import cpp_util
7 from model import Platforms 7 from model import Platforms
8 from schema_util import CapitalizeFirstLetter 8 from schema_util import CapitalizeFirstLetter
9 from schema_util import JsFunctionNameToClassName 9 from schema_util import JsFunctionNameToClassName
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 """Generates the "defined" conditional for an #if check if |model_object| 87 """Generates the "defined" conditional for an #if check if |model_object|
88 has platform restrictions. Returns None if there are no restrictions. 88 has platform restrictions. Returns None if there are no restrictions.
89 """ 89 """
90 if model_object.platforms is None: 90 if model_object.platforms is None:
91 return None 91 return None
92 ifdefs = [] 92 ifdefs = []
93 for platform in model_object.platforms: 93 for platform in model_object.platforms:
94 if platform == Platforms.CHROMEOS: 94 if platform == Platforms.CHROMEOS:
95 ifdefs.append('defined(OS_CHROMEOS)') 95 ifdefs.append('defined(OS_CHROMEOS)')
96 elif platform == Platforms.LINUX: 96 elif platform == Platforms.LINUX:
97 ifdefs.append('defined(OS_LINUX)') 97 ifdefs.append('(defined(OS_LINUX) && !defined(OS_CHROMEOS))')
98 elif platform == Platforms.MAC: 98 elif platform == Platforms.MAC:
99 ifdefs.append('defined(OS_MACOSX)') 99 ifdefs.append('defined(OS_MACOSX)')
100 elif platform == Platforms.WIN: 100 elif platform == Platforms.WIN:
101 ifdefs.append('defined(OS_WIN)') 101 ifdefs.append('defined(OS_WIN)')
102 else: 102 else:
103 raise ValueError("Unsupported platform ifdef: %s" % platform.name) 103 raise ValueError("Unsupported platform ifdef: %s" % platform.name)
104 return ' || '.join(ifdefs) 104 return ' || '.join(ifdefs)
105 105
106 def _GenerateRegisterFunctions(self, namespace_name, function): 106 def _GenerateRegisterFunctions(self, namespace_name, function):
107 c = code.Code() 107 c = code.Code()
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 c.Append() 322 c.Append()
323 c.Append('// static') 323 c.Append('// static')
324 c.Sblock('bool %s::IsGenerated(std::string name) {' % 324 c.Sblock('bool %s::IsGenerated(std::string name) {' %
325 self._bundle._GenerateBundleClass('GeneratedSchemas')) 325 self._bundle._GenerateBundleClass('GeneratedSchemas'))
326 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;') 326 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;')
327 c.Eblock('}') 327 c.Eblock('}')
328 c.Append() 328 c.Append()
329 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) 329 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace))
330 c.Append() 330 c.Append()
331 return c 331 return c
OLDNEW
« no previous file with comments | « no previous file | tools/json_schema_compiler/cpp_bundle_generator_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698