@@ -27,6 +27,7 @@ def usage(name, msg=None):
2727 Other Options:
2828
2929 --skip-validate-bin: if skip validate bin for background log parser.
30+ --build_root: specify build root directly
3031 """
3132 )
3233 )
@@ -45,20 +46,39 @@ def main(argv=sys.argv):
4546 scheme = None
4647 project = None
4748 skip_validate_bin = None
49+ build_root = None
4850 while (arg := next (it , None )) is not None :
49- if arg == "-workspace" :
51+ if arg == "-workspace" or arg == "--workspace" :
5052 workspace = next (it , None )
51- elif arg == "-scheme" :
53+ elif arg == "-scheme" or arg == "--scheme" :
5254 scheme = next (it , None )
53- elif arg == "-project" :
55+ elif arg == "-project" or arg == "--project" :
5456 project = next (it , None )
57+ elif arg == "--build_root" :
58+ build_root = next (it , None )
5559 elif arg == "--skip-validate-bin" :
5660 skip_validate_bin = True
5761 elif "-h" == arg or "--help" == arg or "-help" == arg :
5862 _usage ()
5963 else :
6064 _usage (f"unknown arg { arg } " )
6165
66+ def update (scheme ):
67+ print ("find root:" , build_root )
68+
69+ config = ServerConfig .shared ()
70+ config .workspace = workspace
71+ config .build_root = build_root
72+ config .scheme = scheme
73+ config .kind = "xcode"
74+ config .skip_validate_bin = skip_validate_bin
75+ config .save ()
76+ print ("updated buildServer.json" )
77+
78+ if build_root :
79+ build_root = os .path .abspath (os .path .expanduser (build_root ))
80+ return update (scheme )
81+
6282 if workspace is None :
6383
6484 def get_workspace ():
@@ -95,15 +115,5 @@ def get_workspace():
95115 build_dir = output [0 ]["buildSettings" ]["SYMROOT" ]
96116 build_root = os .path .abspath (os .path .join (build_dir , "../.." ))
97117
98- print ("find root:" , build_root )
99-
100- config = ServerConfig .shared ()
101- config .workspace = os .path .abspath (os .path .expanduser (workspace ))
102- config .build_root = build_root
103- config .scheme = None if lastest_scheme else scheme
104- config .kind = "xcode"
105- config .skip_validate_bin = skip_validate_bin
106- config .save ()
107- print ("updated buildServer.json" )
108-
109-
118+ workspace = os .path .abspath (os .path .expanduser (workspace ))
119+ return update (None if lastest_scheme else scheme )
0 commit comments