Skip to content

Commit

Permalink
add module if possible regardless of failure
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaofeiCao committed Nov 28, 2024
1 parent 2e1ac76 commit fb7e854
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions eng/automation/generate_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,7 @@ def generate_typespec_project(
logging.info("SDK folder: " + sdk_folder)
if sdk_folder:
# parse service and module
match = re.match(r"sdk[\\/](.*)[\\/](.*)", sdk_folder)
service = match.group(1)
module = match.group(2)
module, service = parse_service_module(sdk_folder)
# check require_sdk_integration
cmd = ["git", "add", "."]
check_call(cmd, sdk_root)
Expand All @@ -418,10 +416,25 @@ def generate_typespec_project(
succeeded = True
except subprocess.CalledProcessError as error:
logging.error(f"[GENERATE] Code generation failed. tsp-client init fails: {error}")
try:
sdk_folder = find_sdk_folder(sdk_root)
logging.info("SDK folder: " + sdk_folder)
if sdk_folder:
# parse service and module
module, service = parse_service_module(sdk_folder)
except Exception:
pass

return succeeded, require_sdk_integration, sdk_folder, service, module


def parse_service_module(sdk_folder: str) -> Tuple:
match = re.match(r"sdk[\\/](.*)[\\/](.*)", sdk_folder)
service = match.group(1)
module = match.group(2)
return module, service


def check_call(cmd: List[str], work_dir: str, shell: bool = False):
logging.info("Command line: " + " ".join(cmd))
subprocess.check_call(cmd, cwd=work_dir, shell=shell)
Expand Down

0 comments on commit fb7e854

Please sign in to comment.