Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
33 stars 80 forks source link

tsp, support flavor flag from typespec config #2609

Closed haolingdong-msft closed 4 months ago

haolingdong-msft commented 4 months ago

link https://github.com/Azure/autorest.java/issues/2596

Code changes:

  1. Remove branded related logics in both emitter and codegen
  2. Add flavor to JavaSettings
  3. Update the logics for checking if it's Azure in TypeSpecPlugin and emitter. But keep using JavaSettings.isBranded() in templates.
  4. add package-dir and related logics -> this part is one of Laurent's requirements. If package-dir starts with azure, we will treat as branded. Though we default set to Azure currently, this logic may not take effect, but later we set default to non-azure, this will be effective.
weidongxu-microsoft commented 4 months ago

Also update the tspconfig.yaml in our test module to flavor=azure.

haolingdong-msft commented 4 months ago

Personally I'd prefer to put flavor to JavaSettings, add getFlavor, and keep the convenience API isBranded in JavaSettings.

not a strong opinion though, not visible and can be changed later anyway.

I did not add flavor into it JavaSettings just to make the change easy, thinking we can add later. But I agree with you adding flavor to JavaSettings would be better. If we want to support embed flavor(brand name) into our generated sdk, we will need this in JavaSettings. I will update in this pr.

weidongxu-microsoft commented 4 months ago

Also make sure you've tested flavor!=azure case locally (that is what needed by Srikanta).

We may need to have a test setup on flavor=generic, but maybe later.