Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions JsonGenerator/source/header_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import ProxyStubGenerator.CppParser as CppParser
import ProxyStubGenerator.Interface as CppInterface

MODULE_FILE = "Module.h"
IDS_FILE = "Ids.h"


class CaseConverter:
OBJECTS = 0
Expand Down Expand Up @@ -321,7 +324,7 @@ def Find(tree):
return [], []


def LoadInterfaceInternal(file, tree, ns, log, scanned, all = False, include_paths = []):
def LoadInterfaceInternal(file, tree, ns, log, scanned, all, include_paths):

Comment thread
sebaszm marked this conversation as resolved.
def StripInterfaceNamespace(identifier):
return str(identifier).replace(ns + "::", "")
Expand Down Expand Up @@ -1606,15 +1609,21 @@ def MaybeWarning():

return schemas, []

def LoadInterface(file, log, all = False, include_paths = []):

def LoadInterface(file, log, all, include_paths):
try:
Comment thread
sebaszm marked this conversation as resolved.
schemas = []
includes = []
scanned = []

tree = CppParser.ParseFiles([os.path.join(os.path.dirname(os.path.realpath(__file__)),
posixpath.normpath(config.DEFAULT_DEFINITIONS_FILE)), file], config.FRAMEWORK_NAMESPACE, include_paths, log)
source_path = os.path.dirname(file)

files = []
files.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), posixpath.normpath(config.DEFAULT_DEFINITIONS_FILE)))
files.append("@" + os.path.join(source_path, MODULE_FILE))
files.append("@" + os.path.join(source_path, IDS_FILE))
files.append(file)

tree = CppParser.ParseFiles(files, config.FRAMEWORK_NAMESPACE, include_paths, log)

for ns in config.INTERFACE_NAMESPACES:
their_schemas, their_includes = LoadInterfaceInternal(file, tree, ns, log, scanned, all, include_paths)
Expand Down
12 changes: 11 additions & 1 deletion JsonGenerator/source/json_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,17 @@ def Scan(pairs):

return [], [], temp_files

def Load(log, path, if_dirs = [], cpp_if_dirs = [], include_paths = []):
def Load(log, path, if_dirs=None, cpp_if_dirs=None, include_paths=None):

if if_dirs is None:
if_dirs = []

if cpp_if_dirs is None:
cpp_if_dirs = []

if include_paths is None:
include_paths = []

temp_files = []

if path.endswith(".h"):
Expand Down
18 changes: 10 additions & 8 deletions ProxyStubGenerator/StubGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

DEFAULT_DEFINITIONS_FILE = "default.h"
MODULE_FILE = "Module.h"
IDS_FILE = "Ids.h"

log = Log.Log(NAME, BE_VERBOSE, SHOW_WARNINGS)

Expand Down Expand Up @@ -2835,8 +2836,7 @@ def EmitRegistration(announce_list):
metavar="FILE",
action='append',
default=[],
nargs="*",
help="include an additional C++ header file, can be used multiple times (default: include 'Module.h')")
help="include an additional C++ header file, can be used multiple times")
argparser.add_argument('-I', dest="includePaths", metavar="INCLUDE_DIR", action='append', default=[], type=str,
help='add an include search path, can be used multiple times')

Expand Down Expand Up @@ -2984,14 +2984,16 @@ def EmitRegistration(announce_list):

for source_file in interface_files:
try:
_extra_includes = [ os.path.join("@" + os.path.dirname(source_file), MODULE_FILE),
os.path.join("@" + os.path.dirname(source_file), "Ids.h") ]
source_path = os.path.dirname(source_file)

_extra_includes.extend(args.extra_includes)
extra_includes = []
extra_includes.append("@" + os.path.join(source_path, MODULE_FILE))
extra_includes.append("@" + os.path.join(source_path, IDS_FILE))
extra_includes.extend(args.extra_includes)

Comment thread
sebaszm marked this conversation as resolved.
tree = Parse(source_file, FRAMEWORK_NAMESPACE, args.includePaths,
os.path.join("@" + os.path.dirname(os.path.realpath(__file__)), DEFAULT_DEFINITIONS_FILE),
_extra_includes)
definition_file = "@" + os.path.join(os.path.dirname(os.path.realpath(__file__)), DEFAULT_DEFINITIONS_FILE)

tree = Parse(source_file, FRAMEWORK_NAMESPACE, args.includePaths, definition_file, extra_includes)

Comment thread
sebaszm marked this conversation as resolved.
if args.code:
log.Header(source_file)
Expand Down
Loading