Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update-javascript-GeneratedSdks should not use Typespec-project scripts #9420

Open
maririos opened this issue Nov 21, 2024 · 2 comments
Open
Assignees
Labels
Central-EngSys This issue is owned by the Engineering System team.

Comments

@maririos
Copy link
Member

Current function Update-javascript-GeneratedSdks in the LanguageSettings.ps1 file has a dependency on TypeSpec-Project-Sync.ps1 and TypeSpec-Project-Generate.ps1. These should be replaced with the usage of tsp-client

@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 21, 2024
@maririos maririos added Central-EngSys This issue is owned by the Engineering System team. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Nov 21, 2024
@hallipr
Copy link
Member

hallipr commented Nov 23, 2024

I did a review of the 2 code generation functions in LanguageSettings.ps1 for each language:

Java - eng/scripts/Language-Settings.ps1

  • Get-java-DirectoriesForGeneration
    • Get grandchild directories of /sdk that contain tsp-location.yaml or swagger/Update-Codegeneration.ps1 files
  • Update-java-GeneratedSdks
    • For each supplied package directory:
      • if the directory contains a tsp-location file, call:
        eng/common/scripts/TypeSpec-Project-Sync.ps1 $directoryPath
        eng/common/scripts/TypeSpec-Project-Generate.ps1 $directoryPath
      • else if the directory contains ./swagger/Update-CodeGeneration.ps1, call that

JavaScript - eng/scripts/Language-Settings.ps1

  • No Get-javascript-DirectoriesForGeneration implementation
  • Update-javascript-GeneratedSdks
    • For each supplied package directory, calls:
      eng/common/scripts/TypeSpec-Project-Sync.ps1 $directoryPath
      eng/common/scripts/TypeSpec-Project-Generate.ps1 $directoryPath

Python - eng/scripts/Language-Settings.ps1

  • Get-python-DirectoriesForGeneration
    • Get grandchild directories of /sdk that don't contain "-mgmt-" that do contain tsp-location.yaml files
    • Searching for swagger/README.md files is currently commented out
  • Update-python-GeneratedSdks: Uses tsp-client update
    • For each supplied package directory, calls tox run -e generate -c "$toxConfigPath" --root .
    • We're only passing in TypeSpec based packages currently. The generate command does support autorest, but we'd need to do work to have it use the same version of autorest for every client
    • tox -e generate will call either autorest {readme_path} --python-sdks-folder=../../ or tsp-client update from the project folder

.NET - eng/scripts/Language-Settings.ps1

  • No Get-dotnet-DirectoriesForGeneration implementation
  • Update-dotnet-GeneratedSdks - Uses tsp-client update or tsp-client generate
    • Forms a project file, GeneratedSdks.proj, containing a project reference to each project found in the supplied package directories
    • Calls npm ci --prefix $RepoRoot to install autorest into a repo-local node_modules folder
    • Calls npm ci over emitter-package.json to prime the npm cache with emitter dependencies
    • Calls dotnet msbuild /restore /t:GenerateCode on service.proj with /p:ProjectListOverrideFile=GeneratedSdks.proj
    • The GenerateCode target will determine if the project is autorest or typespec based and will call either autorest or tsp-client

@hallipr
Copy link
Member

hallipr commented Nov 23, 2024

For the java and javascript, we should be able to replace their TypeSpec-Project- calls with tsp-client update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team.
Projects
Status: 🤔 Triage
Development

No branches or pull requests

2 participants