Skip to content

Commit

Permalink
Adding instructions to generate code
Browse files Browse the repository at this point in the history
  • Loading branch information
dsgouda committed Mar 20, 2018
1 parent a5d0b60 commit f369ff3
Showing 1 changed file with 44 additions and 0 deletions.
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)

0 comments on commit f369ff3

Please sign in to comment.