Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: feature
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Add logic to clear output folder
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: internal
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Exclude unnecessary files from pylint checks to improve execution speed
2 changes: 1 addition & 1 deletion packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.19.2",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "~4.19.1",
"@typespec/http-client-python": "~0.19.2",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz",
"fs-extra": "~11.2.0"
},
"devDependencies": {
Expand Down
34 changes: 34 additions & 0 deletions packages/typespec-python/scripts/eng/regenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,45 @@ async function runTaskPool(tasks: Array<() => Promise<void>>, poolLimit: number)
await Promise.all(workers);
}

// create some files before regeneration. After regeneration, these files should be deleted and we will test it
// in test case
async function preprocess(flags: RegenerateFlagsInput): Promise<void> {
if (flags.flavor === "azure") {
const generalParts = [PLUGIN_DIR, "test", "azure", "generated"];
await promises.writeFile(
join(
...generalParts,
"authentication-api-key",
"authentication",
"apikey",
"_operations",
"to_be_deleted.py",
),
"# This file is to be deleted after regeneration",
);

const folderParts = [...generalParts, "generation-subdir"];
await promises.writeFile(
join(...folderParts, "generation", "subdir", "_generated", "to_be_deleted.py"),
"# This file is to be deleted after regeneration",
);
await promises.writeFile(
join(...folderParts, "generated_tests", "to_be_deleted.py"),
"# This file is to be kept after regeneration",
);
await promises.writeFile(
join(...folderParts, "generation", "subdir", "to_be_kept.py"),
"# This file is to be kept after regeneration",
);
}
}

async function regenerate(flags: RegenerateFlagsInput): Promise<void> {
if (flags.flavor === undefined) {
await regenerate({ ...flags, flavor: "azure" });
await regenerate({ ...flags, flavor: "unbranded" });
} else {
await preprocess(flags);
const flagsResolved = { debug: false, flavor: flags.flavor, ...flags };
const subdirectoriesForAzure = await getSubdirectories(AZURE_HTTP_SPECS, flagsResolved);
const subdirectoriesForNonAzure = await getSubdirectories(HTTP_SPECS, flagsResolved);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file is to be kept after regeneration

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading