Skip to content

Commit 324962a

Browse files
Revert "eng, migrate sdk automation to tsp-client (Azure#38563)"
This reverts commit adbd86a.
1 parent 7c8a018 commit 324962a

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed

eng/mgmt/automation/generate_data.py

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def sdk_automation_typespec(config: dict) -> List[dict]:
3232
if 'relatedTypeSpecProjectFolder' not in config:
3333
return packages
3434

35-
head_sha: str = config['headSha']
36-
repo_url: str = config['repoHttpsUrl']
35+
head_sha = config['headSha']
36+
repo_url = config['repoHttpsUrl']
3737

3838
tsp_projects = config['relatedTypeSpecProjectFolder']
3939
if isinstance(tsp_projects, str):
@@ -47,40 +47,16 @@ def sdk_automation_typespec(config: dict) -> List[dict]:
4747
service = None
4848
module = None
4949
try:
50-
def remove_prefix(text, prefix):
51-
if text.startswith(prefix):
52-
return text[len(prefix):]
53-
return text
54-
55-
def find_sdk_folder():
56-
cmd = ['git', 'add', '.']
57-
check_call(cmd, sdk_root)
58-
59-
cmd = ['git', 'status', '--porcelain', '**/tsp-location.yaml']
60-
logging.info('Command line: ' + ' '.join(cmd))
61-
output = subprocess.check_output(cmd, cwd=sdk_root)
62-
output_str = str(output, 'utf-8')
63-
git_items = output_str.splitlines()
64-
sdk_folder = None
65-
if len(git_items) > 0:
66-
tsp_location_item: str = git_items[0]
67-
sdk_folder = tsp_location_item[1:].strip()[0:-len('/tsp-location.yaml')]
68-
69-
cmd = ['git', 'reset', '.']
70-
check_call(cmd, sdk_root)
71-
72-
return sdk_folder
73-
74-
repo = remove_prefix(repo_url, 'https://github.com/')
75-
cmd = ['npx', 'tsp-client', 'init', '--debug', '--tsp-config', tsp_dir, '--commit', head_sha, '--repo', repo]
76-
check_call(cmd, sdk_root)
77-
78-
sdk_folder = find_sdk_folder()
50+
cmd = ['pwsh', './eng/common/scripts/TypeSpec-Project-Process.ps1', tsp_dir, head_sha, repo_url]
51+
logging.info('Command line: ' + ' '.join(cmd))
52+
output = subprocess.check_output(cmd, cwd=sdk_root)
53+
output_str = str(output, 'utf-8')
54+
script_return = output_str.splitlines()[-1] # the path to sdk folder
55+
sdk_folder = os.path.relpath(script_return, sdk_root)
7956
logging.info('SDK folder: ' + sdk_folder)
80-
if sdk_folder:
81-
succeeded = True
57+
succeeded = True
8258
except subprocess.CalledProcessError as error:
83-
logging.error(f'tsp-client init fail: {error}')
59+
logging.error(f'TypeSpec-Project-Process.ps1 fail: {error}')
8460

8561
if succeeded:
8662
# check require_sdk_integration

eng/mgmt/automation/init.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ export NVM_DIR="$HOME/.nvm"
1010
nvm install v18.15.0
1111
nvm alias default node
1212

13-
# install tsp-client globally (local install may interfere with tooling)
14-
npm install -g @azure-tools/typespec-client-generator-cli
15-
1613
cat << EOF > $2
1714
{"envs": {"PATH": "$JAVA_HOME_11_X64/bin:$PATH", "JAVA_HOME": "$JAVA_HOME_11_X64"}}
1815
EOF

0 commit comments

Comments
 (0)