Skip to content

Commit ad40a28

Browse files
authored
Initialize Azure csharp plugin (Azure#45617)
1 parent 6921884 commit ad40a28

File tree

92 files changed

+16463
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+16463
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Backup*/
140140
UpgradeLog*.XML
141141

142142
# NuGet
143-
packages
143+
# packages
144144
packages/repositories.config
145145
testPackages
146146

@@ -176,3 +176,6 @@ artifacts
176176

177177
# Temporary typespec folders for typespec generation
178178
TempTypeSpecFiles/
179+
180+
# Common toolchain intermediate files
181+
temp

eng/Directory.Build.Common.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<DocumentationFile>$(IntermediateOutputPath)$(TargetFramework)\$(MSBuildProjectName).xml</DocumentationFile>
1212

1313
<!-- Client in this context is any library that is following the new Azure SDK guidelines -->
14+
<IsGeneratorLibrary Condition="'$(IsGeneratorLibrary)' == '' and $(MSBuildProjectName.StartsWith('Azure.Generator'))">true</IsGeneratorLibrary>
1415
<IsClientLibrary Condition="'$(IsClientLibrary)' == '' and $(MSBuildProjectName.StartsWith('Azure.'))">true</IsClientLibrary>
1516
<IsFunctionsLibrary Condition="'$(IsFunctionsLibrary)' == '' and $(MSBuildProjectName.StartsWith('Microsoft.Azure.WebJobs.Extensions.'))">true</IsFunctionsLibrary>
1617

@@ -133,6 +134,7 @@
133134

134135
<RequiredTargetFrameworks>net452;netstandard1.4;net461;netstandard2.0</RequiredTargetFrameworks>
135136
<RequiredTargetFrameworks Condition="'$(SupportsNetStandard20)' == 'true'">netstandard2.0</RequiredTargetFrameworks>
137+
<RequiredTargetFrameworks Condition="'$(IsGeneratorLibrary)' == 'true'">net8.0</RequiredTargetFrameworks>
136138
</PropertyGroup>
137139

138140
<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsSamplesProject)' == 'true' or '$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true'">

eng/Microsoft.Build.CentralPackageVersions/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ If this needs to be updated go and download the latest package from
55
https://www.nuget.org/packages/Microsoft.Build.CentralPackageVersions and extract the sdk.props/targets
66
file from the package and put them under a folder matching the version of the package. Then update
77
the places we are importing those files to include the updated version number. Currently only
8-
the CentralPackageVersionPackagePath property in Directory.Build.Data.targets. Be sure to cleam up
8+
the CentralPackageVersionPackagePath property in Directory.Build.Data.targets. Be sure to clean up
99
the old version as well.
1010

1111
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Feng%2FMicrosoft.Build.CentralPackageVersions%2FReadme.png)

eng/Packages.Data.props

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
- https://github.com/Azure/azure-functions-host/blob/dev/test/WebJobs.Script.Tests/Microsoft.Azure.WebJobs.Script.WebHost.deps.json
8383
-->
8484

85-
<ItemGroup Condition="'$(IsClientLibrary)' == 'true'">
85+
<ItemGroup Condition="'$(IsClientLibrary)' == 'true' or '$(IsGeneratorLibrary)' == 'true'">
8686

8787
<!-- BCL packages -->
8888
<PackageReference Update="System.Buffers" Version="4.5.1" />
@@ -241,6 +241,10 @@
241241
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version ="3.9.0" PrivateAssets="all" />
242242
</ItemGroup>
243243

244+
<ItemGroup Condition="'$(IsGeneratorLibrary)' == 'true'">
245+
<PackageReference Update="Microsoft.Generator.CSharp.ClientModel" Version="1.0.0-alpha.20240904.4" />
246+
</ItemGroup>
247+
244248
<!--
245249
Test/Sample/Perf/Stress project dependencies
246250
-->
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "none",
4+
"printWidth": 80,
5+
"endOfLine": "auto"
6+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
trigger: none
2+
pr:
3+
branches:
4+
include:
5+
- main
6+
- feature/*
7+
- hotfix/*
8+
- release/*
9+
paths:
10+
include:
11+
- eng/packages/http-client-csharp
12+
13+
variables:
14+
- template: /eng/pipelines/templates/variables/image.yml
15+
16+
extends:
17+
template: /eng/pipelines/templates/stages/1es-redirect.yml
18+
parameters:
19+
stages:
20+
- stage: 'Build'
21+
pool:
22+
name: $(WINDOWSPOOL)
23+
image: $(WINDOWSVMIMAGE)
24+
os: windows
25+
jobs:
26+
- job: Build
27+
timeoutInMinutes: 120
28+
steps:
29+
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
30+
- task: UseDotNet@2
31+
displayName: 'Use .NET Core SDK'
32+
retryCountOnTaskFailure: 3
33+
inputs:
34+
useGlobalJson: true
35+
performMultiLevelLookup: true
36+
- task: NodeTool@0
37+
displayName: "Install Node 18.x"
38+
inputs:
39+
versionSpec: '18.x'
40+
- script: |
41+
npm ci
42+
displayName: "Install packages"
43+
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp
44+
- script: |
45+
npm ls -a
46+
displayName: "List packages"
47+
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp
48+
- script: |
49+
npm run prettier
50+
displayName: "Emitter format check"
51+
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/emitter
52+
- script: |
53+
npm run lint
54+
displayName: "Emitter linter check"
55+
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/emitter
56+
- script: |
57+
npm run build
58+
displayName: 'Build Azure csharp client emitter and generator'
59+
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/
60+
- pwsh: ./eng/packages/http-client-csharp/eng/scripts/CodeGenerationCheck.ps1
61+
displayName: "Check if generated code is up-to-date"
62+
env:
63+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
64+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
65+
DOTNET_MULTILEVEL_LOOKUP: 0
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
import { EmitContext } from "@typespec/compiler";
5+
6+
import {
7+
$onEmit as $OnMGCEmit,
8+
NetEmitterOptions
9+
} from "@typespec/http-client-csharp";
10+
11+
export async function $onEmit(context: EmitContext<NetEmitterOptions>) {
12+
context.options["plugin-name"] = "AzureClientPlugin";
13+
context.options["emitter-extension-path"] = import.meta.url;
14+
await $OnMGCEmit(context);
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
export * from "./emitter.js";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"rootDir": "./src",
6+
"outDir": "../dist/emitter",
7+
"tsBuildInfoFile": "temp/tsconfig.tsbuildinfo"
8+
},
9+
"references": [],
10+
"include": ["src/"]
11+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"compilerOptions": {
3+
"noEmit": true,
4+
"composite": true,
5+
"alwaysStrict": true,
6+
"forceConsistentCasingInFileNames": true,
7+
"module": "Node16",
8+
"moduleResolution": "Node16",
9+
"esModuleInterop": true,
10+
"noImplicitAny": true,
11+
"noImplicitReturns": true,
12+
"noImplicitThis": true,
13+
"sourceMap": true,
14+
"declarationMap": true,
15+
"strict": true,
16+
"declaration": true,
17+
"stripInternal": true,
18+
"noEmitHelpers": false,
19+
"target": "ES2022",
20+
"types": ["node"],
21+
"lib": ["es2022", "DOM"],
22+
"experimentalDecorators": true,
23+
"newLine": "LF"
24+
},
25+
"include": ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts", "**/*.ts", "**/*.tsx", "**/.storybook/**/*.ts", "**/.storybook/**/*.tsx"],
26+
"exclude": ["**/node_modules/", "**/dist/", "**/build/", "**/coverage/"]
27+
}

0 commit comments

Comments
 (0)