Skip to content

Commit

Permalink
eng, spec automation for cadl, update cadl-java to 0.2.2 (Azure#33097)
Browse files Browse the repository at this point in the history
* eng, cadl, update cadl-java to 0.2.2

* update clean-up logic for mgmt; now all generated samples should be under generated namespace
  • Loading branch information
weidongxu-microsoft authored Jan 28, 2023
1 parent 3f3fdd0 commit 9e5b3c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions eng/mgmt/automation/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def sdk_automation_cadl(config: dict) -> List[dict]:
try:
# install dependencies
subprocess.run('npm install "@azure-tools/cadl-autorest@0.24.0" "@cadl-lang/eslint-config-cadl@0.5.0" "@cadl-lang/eslint-plugin@0.38.0" "@cadl-lang/library-linter@0.38.0"', shell=True, check=True)

# install latest @azure-tools/cadl-java
subprocess.run('npm install "@azure-tools/cadl-java@0.2.0"', shell=True, check=True)
subprocess.run('npm install "@azure-tools/cadl-java@0.2.2"', shell=True, check=True)

# check client.cadl
cadl_source = '.'
if os.path.exists(os.path.join(cadl_dir, 'client.cadl')):
Expand Down
8 changes: 2 additions & 6 deletions eng/mgmt/automation/generate_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@ def generate(
shutil.rmtree(os.path.join(output_dir, 'src/main'), ignore_errors=True)
shutil.rmtree(os.path.join(output_dir, 'src/test/java', namespace.replace('.', '/'), 'generated'),
ignore_errors=True)
if os.path.exists(os.path.join(output_dir, 'src/samples/README.md')):
# samples contains hand-written code
shutil.rmtree(os.path.join(output_dir, 'src/samples/java', namespace.replace('.', '/'), 'generated'),
ignore_errors=True)
else:
shutil.rmtree(os.path.join(output_dir, 'src/samples'), ignore_errors=True)
shutil.rmtree(os.path.join(output_dir, 'src/samples/java', namespace.replace('.', '/'), 'generated'),
ignore_errors=True)

if re.match(r'https?://', spec_root):
readme = urllib.parse.urljoin(spec_root, readme)
Expand Down

0 comments on commit 9e5b3c3

Please sign in to comment.