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

Adding instructions to generate code and open a PR #4148

Merged
merged 1 commit into from
Mar 20, 2018
Merged
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
44 changes: 44 additions & 0 deletions Documentation/code-generation-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# How to generate Code

To generate code, simply run the `generate.ps1` powershell script. If a powershell script does not exist under the RP directory, create one using an example [here](https://github.com/Azure/azure-sdk-for-net/blob/psSdkJson6/src/SDKs/Compute/Management.Compute/generate.ps1).

If code generation fails for any reason, here a few common steps to resolve the issues.

- Clean the repo
```
git clean -xdf
```
- Download and install the latest build tools (use a VS 2017 developer prompt to run msbuild)
```
msbuild build.proj
```
- Run the `generate.ps1` command again


# When opening a PR

## General instructions
- Please link the REST spec API PR which helps the review process
- Please check whether a new API version is introduced in the REST spec repo; this is important while addressing the instructions below
- Please read the SLA information and other instructions on the PR template before opening the PR

## REST API version artifacts
If there is a new version of the REST API from which code is being generated for the PR, the following files should be modified/created in the PR
- A `.props` file which holds information about the REST API versions eg: [here](https://github.com/Azure/azure-sdk-for-net/blob/psSdkJson6/src/SDKs/Compute/AzSdk.RP.props)
- A `SdkInfo_*.cs` file which holds information about the REST API versions eg: [here](https://github.com/Azure/azure-sdk-for-net/blob/psSdkJson6/src/SDKs/Compute/AzSdk.RP.props)

To generate the `.props` artifact, please run (use the VS 2017 developer prompt for msbuild):
```
msbuild build.proj /t:build /p:Scope=SDKs\<RP>
```
RP is the resource provider's directory under SDKs, eg.: Compute

To generate the `SdkInfo*.cs` file, please run the `generate.ps1` script

## Code generation artifacts
If code is generated using `generate.ps1`, information related to the generation gets logged in a `.txt` file under `src\SDKs\_metadata` eg.: [here](https://github.com/Azure/azure-sdk-for-net/blob/psSdkJson6/src/SDKs/_metadata/compute_resource-manager.txt)

Please check the branch and fork of the REST spec for which the code was generated, this must always be `Azure` and `master` respectively for a PR to be valid. Code generated using specifications not checked in the Azure master branch will not be merged.

# How to sign/publish bits
For detailed information about publishing and the overall workflow towards developing a powershell cli, click [here](https://github.com/Azure/adx-documentation-pr/blob/master/engineering/autorest-to-powershell.md)