From 0f76baaf7ad6e97e6a387b2c87f11a932a02375d Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Thu, 18 Feb 2021 13:57:25 +0800 Subject: [PATCH] generate_sdk pin stable version --- .../packaging_tools/swaggertosdk/SwaggerToSdkCore.py | 3 ++- .../packaging_tools/swaggertosdk/autorest_tools.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/azure-sdk-tools/packaging_tools/swaggertosdk/SwaggerToSdkCore.py b/tools/azure-sdk-tools/packaging_tools/swaggertosdk/SwaggerToSdkCore.py index c94d64ce6e8c..588752141fdb 100644 --- a/tools/azure-sdk-tools/packaging_tools/swaggertosdk/SwaggerToSdkCore.py +++ b/tools/azure-sdk-tools/packaging_tools/swaggertosdk/SwaggerToSdkCore.py @@ -222,7 +222,8 @@ def build_swaggertosdk_conf_from_json_readme(readme_file, sdk_git_id, config, ba with tempfile.TemporaryDirectory() as temp_dir: readme_as_conf = autorest_swagger_to_sdk_conf( readme_full_path, - temp_dir + temp_dir, + config ) generated_config = { "markdown": readme_full_path, diff --git a/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py b/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py index d9347b9132ec..378a3129aa91 100644 --- a/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py +++ b/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py @@ -15,14 +15,15 @@ def autorest_latest_version_finder(): return json.loads(subprocess.check_output(cmd_line.split()).decode().strip()) -def autorest_swagger_to_sdk_conf(readme, output_folder): +def autorest_swagger_to_sdk_conf(readme, output_folder, config): _LOGGER.info("Looking for swagger-to-sdk section in {}".format(readme)) autorest_bin = shutil.which("autorest") # --input-file=foo is to workaround a bug where the command is not executed at all if no input-file is found (even if we don't care about input-file here) - cmd_line = "{} {} --perform-load=false --swagger-to-sdk --output-artifact=configuration.json --input-file=foo --output-folder={}".format( + cmd_line = "{} {} --perform-load=false --swagger-to-sdk --output-artifact=configuration.json --input-file=foo --output-folder={} --version={}".format( autorest_bin, str(readme), - str(output_folder) + str(output_folder), + str(config['meta']['autorest_options']['version']) ) execute_simple_command(cmd_line.split()) conf_path = Path(output_folder, "configuration.json")