diff --git a/client/Options.py b/client/Options.py index 19f381a..610e263 100644 --- a/client/Options.py +++ b/client/Options.py @@ -61,6 +61,8 @@ def Help(bin_name, subcommand=None): "\t--jobs=num\t\t: Set the number of build threads", False) Log.colorprint("DEFAULT", "\t --all-log\t\t: Show all build log infomation", False) + Log.colorprint("DEFAULT", "\t --auto-includet\t: Add include directory of dependent modules", False) + Log.colorprint("DEFAULT", "\t --auto-lib\t\t: Add static library files of dependent modules", False) return 0 if subcommand == "show-deps": @@ -104,12 +106,16 @@ def OptionBuild(argv): options["mode"] : debug or release options["path"] : modular path options["jobs"] : the number of build threads + options["auto_include"] : add directory include of dependent modules automatically + options["auto_lib"] : add .a files of dependent modules automatically """ options = dict() options["all_log"] = False options["path"] = "" options["mode"] = "debug" options["jobs"] = 4 + options["auto_include"] = False + options["auto_lib"] = False try: opts, args = getopt.gnu_getopt(argv, "", ["all-log", "mode=", "jobs="]) @@ -140,6 +146,12 @@ def OptionBuild(argv): if opt == "--jobs": options["jobs"] = int(arg) continue + if opt == "--auto-inlcude": + options["auto_include"] = True + continue + if opt == "--auto-lib": + options["auto_lib"] = True + continue return None return options diff --git a/dependency/Environment.py b/dependency/Environment.py index 0e34e82..f64db3e 100755 --- a/dependency/Environment.py +++ b/dependency/Environment.py @@ -101,6 +101,12 @@ def BuildMode(self): """ return self._build_mode + def IsMain(self): + """ + whether is env object of main module + """ + return self._module.is_main + def AddSubDir(self, v): """ Add subdirectory v diff --git a/dependency/Planish.py b/dependency/Planish.py index 83e68f3..a79da98 100644 --- a/dependency/Planish.py +++ b/dependency/Planish.py @@ -71,7 +71,6 @@ from dependency import BrocModule_pb2 from util import Function - class Planish(object): """ class for planishing dependent modules diff --git a/dependency/Syntax.py b/dependency/Syntax.py index 6a16f7f..738d5af 100755 --- a/dependency/Syntax.py +++ b/dependency/Syntax.py @@ -718,9 +718,8 @@ def DIRECTORY(v): child_broc_dir = os.path.abspath(os.path.join(env.ModulePath(), v)) if env.ModulePath() not in child_broc_dir: raise BrocArgumentIllegalError("DIRECTORY(%s) is wrong: %s not in %s" % \ - (child_broc_dir, env.ModulePath()) - - child_broc_file = os.path.join(parent.module.root_path, v, 'BROC') + (child_broc_dir, env.ModulePath())) + child_broc_file = os.path.join(env.Module().root_path, v, 'BROC') if sys.argv[0] == 'PLANISH': parent = sys.argv[1] if not os.path.exists(child_broc_file): @@ -917,6 +916,8 @@ def LoadBROC(self): if not broc_file: self._lack_broc.add(parent.module.origin_config) continue + env = Environment.Environment(parent.module) + Environment.SetCurrent(env) try: execfile(broc_file) except BaseException as err: @@ -959,8 +960,8 @@ def _download_broc(self, node): return abs path of BROC file if download success return None if download failed """ - broc_path = None - cmd = None + broc_path = "" + cmd = "" # for svn # Log.Log().LevPrint("MSG", 'download BROC %s' % node.module.url) if node.module.repo_kind == BrocModule_pb2.Module.SVN: @@ -975,8 +976,8 @@ def _download_broc(self, node): broc_path = os.path.join(node.module.workspace, node.module.module_cvspath, 'BROC') broc_dir = os.path.dirname(broc_path) if not os.path.exists(broc_path): - cmd += "git clone %s %s &&" \ - % ("%s.git" % node.module.url, "%s" % broc_dir) + #cmd += "git clone %s %s &&" % ("%s.git" % node.module.url, "%s" % broc_dir) + cmd += "git clone %s %s" % (node.module.url, broc_dir) if node.module.br_name and node.module.br_name != 'master': br_name = node.module.br_name diff --git a/example/foo/BROC b/example/foo/BROC index 9639977..92de40d 100644 --- a/example/foo/BROC +++ b/example/foo/BROC @@ -19,6 +19,7 @@ CONFIGS("brocbuild/log@master@branch") CONFIGS("brocbuild/function@master@branch") CONFIGS("brocbuild/data@master@branch") + #show the debug mode and the release mode CXXFLAGS("-Werror -O0", "-Wall -O2") diff --git a/unittest/test_BrocTree.py b/unittest/test_BrocTree.py index 34c79f4..8538ea7 100644 --- a/unittest/test_BrocTree.py +++ b/unittest/test_BrocTree.py @@ -48,7 +48,7 @@ def test_singleton(self): postfix[2], logger) tree = BrocTree.BrocTree() - tree.SetRoot(root) + tree.SetRoot(BrocTree.BrocNode(root, None, True)) tree1 = BrocTree.BrocTree() tree2 = BrocTree.BrocTree() self.assertEqual(tree.Id(), tree1.Id())