Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.26k stars 1.93k forks source link

[FEATURE REQ] support cadl sync and generate for Java SDK #33263

Open weidongxu-microsoft opened 1 year ago

weidongxu-microsoft commented 1 year ago

ref: https://github.com/Azure/azure-sdk-tools/pull/5272/files (scripts are syned to sdk repo)

Our first case can be MVAD https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cognitiveservices/AnomalyDetector (you can use other case)

We do not need to able to run automation or CI on it.

First we probably just want to add the cadl-location.yaml, and able to locally run the PS script to generate the code.

Later we can worry about automation or other script for first-time SDK onboard (client_version.txt, ci.yml, pom.yml etc.)

Feel free to collaborate with @XiaofeiCao as he might be more familiar with SDK repo scripts.

haolingdong-msft commented 1 year ago

Refereneces: doc: https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/Typespec-Project-Scripts.md sdk repor pr ref: https://github.com/Azure/azure-sdk-for-java/pull/33251 sdk-for-net example: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/anomalydetector/Azure.AI.AnomalyDetector

weidongxu-microsoft commented 1 year ago

PS: also evaluate on whether it may be integrated in CI

e.g. https://github.com/Azure/azure-sdk-for-java/pull/32498 this one for swagger/readme.md

weidongxu-microsoft commented 1 year ago

official spec guide is here https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/cadl-structure-guidelines.md

please make a short paragraph to guide service to use the script from SDK repo. Plan to insert that into https://github.com/Azure/azure-sdk-for-java/wiki/Cadl-Java-Quickstart#use-cadl (before that section, as recommend service to do this together with their spec repo)

haolingdong-msft commented 1 year ago

Regarding to integrating the script in CI, there are two places to run the script.

One is to have a seperate CI running on merged branch(usually main branch) like lite gen CI. So we can just generate sdk using CI instead of generating locally. The CI will:

  1. sync cadl and generate sdk
  2. create pr in azure-sdk-for-java repo.

The other is to trigger the script in pr. But I can't think of a meaningful use case.

Please let me know your thoughts on where to run the scripts in CI.

weidongxu-microsoft commented 1 year ago

The CI step Alan did, was to make sure the code is always latest (from codegen), before release etc.

We don't need a fluent lite gen CI. Data-plane PR is done by service, and they can use the automation from spec to do the PR. They don't need to first configure spec repo, then get to SDK repo do generate code.

weidongxu-microsoft commented 1 year ago

First let's get MVAD regened and we can get it merged.

haolingdong-msft commented 1 year ago

First let's get MVAD regened and we can get it merged.

Got it, make sense, working on it now.