Skip to content

Commit

Permalink
Remove dependency of @autorest/csharp (#8940)
Browse files Browse the repository at this point in the history
* Remove dependency of @autorest/csharp

* update

* Update tools/tsp-client/CHANGELOG.md

Co-authored-by: catalinaperalta <catalinaperaltah@hotmail.com>

---------

Co-authored-by: Pan Shao <pashao@microsoft.com>
Co-authored-by: catalinaperalta <catalinaperaltah@hotmail.com>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent 01d28bc commit 06c04d8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 44 deletions.
5 changes: 5 additions & 0 deletions tools/tsp-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release

## 2024-09-10 - 0.13.0

- Bumped `@autorest/openapi-to-typespec` version to `0.10.0`.
- Removed the dependency `@autorest/csharp`.

## 2024-08-30 - 0.12.2

- Bumped `@autorest/openapi-to-typespec` version to `0.9.1`.
Expand Down
18 changes: 6 additions & 12 deletions tools/tsp-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions tools/tsp-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/typespec-client-generator-cli",
"version": "0.12.2",
"version": "0.13.0",
"description": "A tool to generate Azure SDKs from TypeSpec",
"main": "dist/index.js",
"homepage": "https://github.com/Azure/azure-sdk-tools/tree/main/tools/tsp-client#readme",
Expand Down Expand Up @@ -51,8 +51,7 @@
"typescript": "^5.1.6"
},
"dependencies": {
"@autorest/csharp": "https://aka.ms/azsdk/openapi-to-typespec-csharp",
"@autorest/openapi-to-typespec": "0.9.1",
"@autorest/openapi-to-typespec": "0.10.0",
"@azure-tools/typespec-autorest": ">=0.44.0 <1.0.0",
"@azure/core-rest-pipeline": "^1.12.0",
"@azure-tools/rest-api-diff": ">=0.1.0 <1.0.0",
Expand Down
30 changes: 1 addition & 29 deletions tools/tsp-client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
readTspLocation,
removeDirectory,
} from "./fs.js";
import { cp, mkdir, readFile, rename, stat, unlink, writeFile } from "fs/promises";
import { cp, mkdir, readFile, stat, unlink, writeFile } from "fs/promises";
import { npmCommand, nodeCommand } from "./npm.js";
import { compileTsp, discoverMainFile, resolveTspConfigUrl, TspLocation } from "./typespec.js";
import {
Expand Down Expand Up @@ -360,35 +360,7 @@ export async function convertCommand(argv: any): Promise<void> {
`"${readme}"`,
];

// If the swagger is an ARM swagger, generate ARM metadata
if (arm) {
const autorestCsharpPath = await getPathToDependency("@autorest/csharp");
const generateMetadataCmd = [
autorestBinPath,
"--csharp",
"--max-memory-size=8192",
`--use="${autorestCsharpPath}"`,
`--output-folder="${outputDir}"`,
"--mgmt-debug.only-generate-metadata",
"--mgmt-debug.suppress-list-exception",
"--azure-arm",
"--skip-csproj",
`"${readme}"`,
];
try {
await nodeCommand(outputDir, generateMetadataCmd);
} catch (err) {
Logger.error(`Error occurred while attempting to generate ARM metadata: ${err}`);
process.exit(1);
}
try {
await rename(joinPaths(outputDir, "metadata.json"), joinPaths(outputDir, "resources.json"));
} catch (err) {
Logger.error(
`Error occurred while attempting to rename metadata.json to resources.json: ${err}`,
);
process.exit(1);
}
args.push("--isArm");
}
await nodeCommand(outputDir, args);
Expand Down

0 comments on commit 06c04d8

Please sign in to comment.