Skip to content

Commit 13fc916

Browse files
authored
update APIView CI for cross language mapping (#42434)
1 parent d4aae57 commit 13fc916

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

eng/tox/run_apistubgen.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def get_package_wheel_path(pkg_root, out_path):
4040
out_token_path = os.path.join(out_path, os.path.basename(pkg_path))
4141
return pkg_path, out_token_path
4242

43+
def get_cross_language_mapping_path(pkg_root):
44+
mapping_path = os.path.join(pkg_root, "apiview-properties.json")
45+
if os.path.exists(mapping_path):
46+
return mapping_path
47+
return None
48+
4349
if __name__ == "__main__":
4450
parser = argparse.ArgumentParser(
4551
description="Run apistubgen against target folder. "
@@ -73,10 +79,13 @@ def get_package_wheel_path(pkg_root, out_path):
7379
# Check if a wheel is already built for current package and install from wheel when available
7480
# If wheel is not available then install package from source
7581
pkg_path, out_token_path = get_package_wheel_path(args.target_package, args.out_path)
82+
cross_language_mapping_path = get_cross_language_mapping_path(args.target_package)
7683

7784
cmds = ["apistubgen", "--pkg-path", pkg_path]
7885
if out_token_path:
7986
cmds.extend(["--out-path", out_token_path])
87+
if cross_language_mapping_path:
88+
cmds.extend(["--mapping-path", cross_language_mapping_path])
8089

8190
logging.info("Running apistubgen {}.".format(cmds))
8291
check_call(cmds, cwd=args.work_dir)

tools/azure-sdk-tools/packaging_tools/sdk_generator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,11 @@ def main(generate_input, generate_output):
416416
cwd=package_path,
417417
timeout=600,
418418
)
419-
check_call(["apistubgen", "--pkg-path", "."], cwd=package_path, timeout=600)
419+
cmds = ["apistubgen", "--pkg-path", "."]
420+
cross_language_mapping_path = Path(package_path, "apiview-properties.json")
421+
if cross_language_mapping_path.exists():
422+
cmds.extend(["--mapping-path", str(cross_language_mapping_path)])
423+
check_call(cmds, cwd=package_path, timeout=600)
420424
for file in os.listdir(package_path):
421425
if "_python.json" in file and package_name in file:
422426
result[package_name]["apiViewArtifact"] = str(Path(package_path, file))

0 commit comments

Comments
 (0)