Skip to content

Commit

Permalink
Transitioning to new directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahak Jain committed Jun 19, 2019
1 parent 56414ab commit 2b25db0
Show file tree
Hide file tree
Showing 19,547 changed files with 243,338 additions and 95,803 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
122 changes: 0 additions & 122 deletions .azure-pipelines/client.yml

This file was deleted.

50 changes: 28 additions & 22 deletions .azure-pipelines/mgmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,37 @@ pr:
- BuildToolsForSdk

variables:
DotNetCoreVersion: '2.1.503'
DotNetCoreVersion: '2.2.202'
#DotNetCoreVersion: '2.1.503'

jobs:
- job: Windows_Build
pool:
vmImage: 'VS2017-Win2016'
variables:
IgnoreBuildTokens: 'Microsoft.Rest.ClientRuntime.Tracing.Tests Microsoft.Azure.Services.AppAuthentication.IntegrationTests KeyVault\dataPlane LocationBasedServices Az.Auth.Tests BotService.Tests Search Batch.FileStaging.Tests Azure.Batch.IntegrationTests Azure.Batch.ProtocolTests Batch\Support\FileConventions AzureBatchFileConventions.IntegrationTests Batch\DataPlane\Azure.Batch.Unit.Tests Batch\DataPlane\Tools\ConfigureAwaitAnalyzer\ConfigureAwaitAnalyzer.Tests ContainerService\ContainerService.Tests Consumption\Consumption.Tests Billing\Billing.Tests ApplicationInsights\Management\ApplicationInsights.Tests Batch\Management\Management.Batch.Tests SecurityCenter\SecurityCenter.Tests AzureStack\Admin\FabricAdmin\Fabric.Admin.Tests IotHub\IotHub.Tests Monitor\Monitor.Tests Compute\Compute.Tests Reservations\Reservations.Tests NetApp\NetApp.Tests ContainerRegistry\ContainerRegistry.Tests OperationalInsights\Management\OperationalInsights.Test Subscription\Subscription.Tests'
LoggingArgs: '/flp:Summary;Verbosity=minimal;LogFile=msbuild.sum /flp1:warningsonly;logfile=msbuild.wrn /flp2:errorsonly;logfile=msbuild.err'
IgnoreBuildTokens: 'Microsoft.Rest.ClientRuntime.Tracing.Tests Microsoft.Azure.Services.AppAuthentication.IntegrationTests KeyVault\dataPlane LocationBasedServices Az.Auth.Tests Search Batch.FileStaging.Tests Azure.Batch.IntegrationTests Azure.Batch.ProtocolTests Batch\Support\FileConventions AzureBatchFileConventions.IntegrationTests Batch\DataPlane\Azure.Batch.Unit.Tests Batch\DataPlane\Tools\ConfigureAwaitAnalyzer\ConfigureAwaitAnalyzer.Tests ContainerService\ContainerService.Tests Consumption\Consumption.Tests Billing\Billing.Tests ApplicationInsights\Management\ApplicationInsights.Tests Batch\Management\Management.Batch.Tests SecurityCenter\SecurityCenter.Tests AzureStack\Admin\FabricAdmin\Fabric.Admin.Tests IotHub\IotHub.Tests Monitor\Monitor.Tests Compute\Compute.Tests Reservations\Reservations.Tests NetApp\NetApp.Tests ContainerRegistry\ContainerRegistry.Tests OperationalInsights\Management\OperationalInsights.Test Subscription\Subscription.Tests WebSites\WebSites.Tests DataLake.Store EventGrid.Tests StorageSync.Tests ServiceFabric\ServiceFabric.Test AppAuthentication\Azure.Services.AppAuthentication.Unit.Tests Graph.RBAC\Graph.RBAC.Tests'
LoggingArgs: '/v:m /clp:ShowtimeStamp /flp:LogFile=msbuild.normal;Verbosity=normal /flp1:Summary;Verbosity=minimal;LogFile=msbuild.sum /flp2:warningsonly;logfile=msbuild.wrn /flp3:errorsonly;logfile=msbuild.err'

steps:
- task: CmdLine@1
inputs:
filename: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe
arguments: -Vr *,31bf3856ad364e35
# - task: CmdLine@1
# inputs:
# filename: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\sn.exe
# arguments: -Vr *,31bf3856ad364e35
# displayName: 'Disable strong name verification'

- task: MSBuild@1
inputs:
solution: build.proj
displayName: 'Install build tools'
- task: MSBuild@1
inputs:
solution: build.proj
msbuildArguments: /t:RunTests /clp:ShowTimestamp $(LoggingArgs) /p:IgnorePathTokens="$(IgnoreBuildTokens)"
msbuildArguments: /t:RunTests $(LoggingArgs)
displayName: 'Build and Run tests'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*.trx'
testResultsFiles: 'TestResults/**/*.trx'
testRunTitle: 'Windows Test Results'
testResultsFormat: 'VSTest'
mergeTestResults: true
Expand All @@ -41,16 +46,17 @@ jobs:
vmImage: 'ubuntu-16.04'

steps:
- task: DotNetCoreInstaller@0
displayName: 'Use .NET Core sdk $(DotNetCoreVersion)'
inputs:
version: '$(DotNetCoreVersion)'
- script: './tools/linuxScripts/runNetCoreSdkTests.sh'
displayName: 'Build and test on Non-windows machine'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*.trx'
testRunTitle: 'Ubuntu Test Results'
testResultsFormat: 'VSTest'
mergeTestResults: true
- task: DotNetCoreInstaller@0
displayName: 'Use .NET Core sdk $(DotNetCoreVersion)'
inputs:
version: '$(DotNetCoreVersion)'

- script: dotnet msbuild build.proj /t:RunTests $(LoggingArgs)
displayName: 'Ubuntu Build and Run tests'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*.trx'
testRunTitle: 'Ubuntu Test Results'
testResultsFormat: 'VSTest'
mergeTestResults: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tools/Microsoft.WindowsAzure.Build.Tasks/packages/
PublishedNugets/
src/NuGet.Config
tools/7-zip/
#tools/LocalNugetFeed/Microsoft.Internal.NetSdkBuild.Mgmt.Tools.*.nupkg

[Tt]est[Rr]esult
[Bb]uild[Ll]og.*
Expand Down Expand Up @@ -114,6 +115,7 @@ tools/*.dll

# Sensitive files
*.keys
!Azure.Security.KeyVault.Keys
*.pfx
sdk/storage/Azure.Storage.Common/tests/Shared/TestConfigurations.xml

Expand Down
3 changes: 0 additions & 3 deletions AzSdk.props

This file was deleted.

83 changes: 39 additions & 44 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,62 @@

### To build:
=======
#### If you have recently cloned the repo or did a pull from upstream or did git clean -xdf you need to the following before you do anything else in order to build your projects

1. Open **elevated** VS 2017 command prompt
2. Navigate to repository root directory
3. Skip verification for the following dlls
- Sn -Vr tools\bootstrapTools\taskBinaries\Microsoft.Azure.Build.BootstrapTasks.dll
- Sn -Vr tools\SdkBuildTools\tasks\net46\Microsoft.Azure.Sdk.Build.Tasks.dll
4. Execute MsBuild.exe build.proj (this will pull all the build related tools needed to build the repo)
5. Follow below steps to start building your repo/project

#### If you are building from VS, add a nuget feed source that points to < root >\tools\LocalNugetFeed directory
1. Open any solution, eg "SDKs\Compute\Compute.sln"
1. Open any solution, eg "Compute\Microsoft.Azure.Management.Compute.sln"
2. Build solution from VS

#### Full Build from command line

1. Open VS 2017 command prompt
1. Open VS 2017 developer command prompt
2. Navigate to repository root directory
3. Invoke **msbuild** build.proj /t:Build
will Build
##### *Build* without any scope will build all SDK's and create nuget packages.
##### *Build* without any scope will build all management SDK's.

#### Create single nuget package
In order to build one package and run it's test
`msbuild build.proj /t:CreateNugetPackage /p:scope=SDKs\Compute`
Nuget package will be created in root directory under \binaries\packages

### To run the tests:
#### Build single SDK
`msbuild build.proj /t:CreateNugetPackage /p:scope=Compute`

### To run tests:
Using Visual Studio:
- Build.
- "Test Explorer" window will get populated with tests. Select test and Run/Debug.
- Build project in VS
- "Test Explorer" window will get populated with tests. Right click on a test that you wish to Run/Debug.

Using the command line:
msbuild .\build.proj /t:"Runtests" /p:Scope=SDKs\Compute
msbuild .\build.proj /t:Runtests /p:Scope=Compute
in the above example RunTests will build and run tests for Compute only
or
dotnet test SDKs\Compute\Compute.Tests\Compute.Tests.csproj
or you can use command line CLI
dotnet test Compute\Microsoft.Azure.Management.Compute\tests\Microsoft.Azure.Management.Tests.csproj

#### Create single nuget package
In order to build one package and run it's test
`msbuild build.proj /t:CreateNugetPackage /p:scope=Compute`
Nuget package will be created in root directory under \artifacts\packages\Debug (default configuration is Debug)

### Non-Windows command line build
Now you can use the same command on non-windows as above
for e.g. on Ubuntu you can do something like below:
`dotnet msbuild build.proj /t:Build /p:scope=Compute`
`dotnet msbuild build.proj /t:RunTests /p:scope=Compute`
`dotnet msbuild build.proj /t:CreateNugetPackage /p:scope=Compute`

### Update build tools
Build tools are now downloaded as part of a nuget package under root\restoredPackages\microsoft.internal.netsdkbuild.mgmt.tools
If for any reason there is an update to the build tools, you will then need to first delete directory root\restoredPackages\microsoft.internal.netsdkbuild.mgmt.tools and reexecute your build command. This will simply get the latest version of build tools.

- Refer to the "To build" section to get the command window set up.
- Invoke "RunTests" target from "Build.proj". RunTests will build and run tests
*msbuild build.proj /t:RunTests /p:scope=SDKs\Compute*

## To on-board new libraries

### Project Structure

In "SDKs\< Service Name >", you will find projects for services that have already been implemented
In "sdk\< Service Name >", you will find projects for services that have already been implemented

- Each SDK project needs to target .NET 4.5.2 and .NET Standard 1.4
- Test project needs to target NetCoreApp 1.1
- The easiest way is to model your test/sdk project using existing test/sdk project
- Make a copy of existing csproj and change the meta data relevant to your SDK
- This ensures the SDK that will be generated will be consistent (including consistent target frameworks)
- Each service contains a project for their generated/customized code
- The folder 'Generated' contains the generated code
- The folder 'Customizations' contains additions to the generated code - this can include additions to the generated partial classes, or additional classes that augment the SDK or call the generated code
- The file 'generate.cmd', used to generate library code for the given service, can also be found in this project
- Services also contain a project for their tests
- The folder 'Customizations' contains additions to the generated code - this can include additions to the generated partial classes, or additional classes that augment the SDK or

### Standard Process

Expand All @@ -78,24 +79,18 @@ In "SDKs\< Service Name >", you will find projects for services that have alread
6. **MANDATORY**: Add or update tests for the newly generated code.
7. Once added to the Azure SDK for .NET, build your local package using command
e.g.
`msbuild build.proj /t:CreateNugetPackage /p:scope=SDKs\Compute`
8. If you're using **master** branch, bump up the package version in YourService.nuget.proj. If you're using **psSdkJson6** branch, change the package version in the .csproj file, as well as in the AssemblyInfo.cs file.
9. A Pull request of your Azure SDK for .NET changes against **psSdkJson6** branch of the [Azure SDK for .NET](https://github.com/azure/azure-sdk-for-net)
11. Both the pull requests will be reviewed and merged by the Azure SDK team
`msbuild build.proj /t:CreateNugetPackage /p:scope=Compute`
8. A Pull request of your Azure SDK for .NET changes against **master** branch of the [Azure SDK for .NET](https://github.com/azure/azure-sdk-for-net)
9. Both the pull requests will be reviewed and merged by the Azure SDK team

### New Resource Provider
1. If you have never created an SDK for your service before, you will need the following things to get your SDK in the repo
2. Follow the standard process described above.
3. Directory names helps in using basic heuristics in finding projects as well it's associated test projects during CI process.
4. Create a new directory (name of your service e.g. Compute, Storage etc)
5. If you have a data plane as well as management plane follow the following directory structure.
- `SDKs\<RPName>\management\Management.<RPName>\Microsoft.Azure.Management.<RPName>.csproj`
- `SDKs\<RPName\management\<RPName>.Tests\Management.<RPName>.Tests.csproj`
- `SDKs\<RPName>\dataplane\Microsoft.Azure.<RPName>\Microsoft.Azure.<RPName>.csproj`
- `SDKs\<RPName\dataplane\Microsoft.Azure.<RPName>.Tests\Microsoft.Azure.<RPName>.Tests.csproj`
6. If you only have management plane SDK then have the following directory structure
- `SDKs\<RPName>\Management.<RPName>\Microsoft.Azure.Management.<RPName>.csproj`
- `SDKs\<RPName\<RPName>.Tests\Management.<RPName>.Tests.csproj`
6. For e.g. for management plane SDKs the following directory structure
- `<RPName>\<packageName>\src\Microsoft.Azure.Management.<RPName>\Microsoft.Azure.Management.<RPName>.csproj`
- `<RPName>\<packageName>\tests\Microsoft.Azure.Management.<RPName>.Tests.csproj`
7. Copy .csproj from any other .csproj and update the following information in the new .csproj
- PackageId
- Description
Expand Down
Loading

0 comments on commit 2b25db0

Please sign in to comment.