Skip to content

Commit

Permalink
Merge branch 'andrueastman/sharedConfigs' into andrueastman/monoRepoM…
Browse files Browse the repository at this point in the history
…igration
  • Loading branch information
Andrew Omondi committed Jul 8, 2024
2 parents 242f4fd + 47e64f5 commit 73e48f6
Show file tree
Hide file tree
Showing 28 changed files with 115 additions and 389 deletions.
20 changes: 9 additions & 11 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pr:
include:
- main


variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
Expand All @@ -25,7 +24,6 @@ resources:
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release


extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
Expand Down Expand Up @@ -54,7 +52,7 @@ extends:
inputs:
targetType: filePath
filePath: 'scripts\EnableSigning.ps1'
arguments: '-projectPath "$(Build.SourcesDirectory)/src/Microsoft.Kiota.Abstractions.csproj"'
arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props"'
pwsh: true
enabled: true

Expand All @@ -67,25 +65,25 @@ extends:

# Build the Product project
- task: DotNetCoreCLI@2
displayName: 'Build Microsoft.Kiota.Abstractions'
displayName: 'Build projects in Microsoft.Kiota'
inputs:
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.Abstractions.sln'
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln'
arguments: '--configuration $(BuildConfiguration) --no-incremental'

# Run the Unit test
- task: DotNetCoreCLI@2
displayName: 'Test Microsoft.Kiota.Abstractions'
displayName: 'Test projects in Microsoft.Kiota'
inputs:
command: test
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.Abstractions.sln'
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln'
arguments: '--configuration $(BuildConfiguration) --no-build --framework net8.0'

- task: EsrpCodeSigning@2
displayName: 'ESRP DLL Strong Name'
inputs:
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
FolderPath: $(ProductBinPath)
Pattern: '**\*Microsoft.Kiota.Abstractions.dll'
Pattern: '**\*Microsoft.Kiota.*.dll'
signConfigType: inlineSignParams
UseMinimatch: true
inlineOperation: |
Expand Down Expand Up @@ -114,7 +112,7 @@ extends:
FolderPath: src
signConfigType: inlineSignParams
UseMinimatch: true
Pattern: '**\*Microsoft.Kiota.Abstractions.dll'
Pattern: '**\*Microsoft.Kiota.*.dll'
inlineOperation: |
[
{
Expand Down Expand Up @@ -156,7 +154,7 @@ extends:
SessionTimeout: 20

# arguments are not parsed in DotNetCoreCLI@2 task for `pack` command, that's why we have a custom pack command here
- pwsh: dotnet pack $env:BUILD_SOURCESDIRECTORY/src/Microsoft.Kiota.Abstractions.csproj /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION
- pwsh: dotnet pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION
env:
BUILD_CONFIGURATION: $(BuildConfiguration)
displayName: Dotnet pack
Expand All @@ -167,7 +165,7 @@ extends:
inputs:
targetType: 'filePath'
filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1
arguments: '-projectPath "$(Build.SourcesDirectory)/src/Microsoft.Kiota.Abstractions.csproj" -packageName "Microsoft.Kiota.Abstractions"'
arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"'
pwsh: true

- task: EsrpCodeSigning@2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
- name: Restore dependencies
run: dotnet restore ${{ env.solutionName }}
- name: Build
run: dotnet build ${{ env.solutionName }} --no-restore -c Release /p:UseSharedCompilation=false
run: dotnet build ${{ env.solutionName }} --no-restore /p:UseSharedCompilation=false
- name: Test for net462
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal -c Release --framework net462
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal --framework net462
- name: Test for net8.0 and collect coverage
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover --framework net8.0
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover --framework net8.0
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
File renamed without changes.
57 changes: 57 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<Project>
<!-- Common default project properties for ALL projects-->
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<!-- This is overidden in test projects by setting to true-->
<IsTestProject>false</IsTestProject>
<!-- This is overidden in test projects by setting to true-->
<IsAnalyzerProject>false</IsAnalyzerProject>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- Common project properties for PACKAGED projects TO BE RELEASED-->
<PropertyGroup Condition="('$(IsTestProject)' != 'true') and ('$(IsAnalyzerProject)' != 'true')">
<Authors>Microsoft</Authors>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
<RepositoryUrl>https://github.com/microsoft/kiota-dotnet</RepositoryUrl>
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
<PackageReleaseNotes>
https://github.com/microsoft/kiota-dotnet/releases
</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);NU5048;NETSDK1138</NoWarn>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net5.0'))">true</IsTrimmable>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net8.0'))">true</IsAotCompatible>
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<!-- Common project properties for TEST projects-->
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<IsPackable>false</IsPackable>
<OutputType>Library</OutputType>
</PropertyGroup>
<!-- Include ReadMe.md for PACKAGED projects TO BE RELEASED-->
<ItemGroup Condition="('$(IsTestProject)' != 'true') and ('$(IsAnalyzerProject)' != 'true')">
<None Include="README.md">
<Pack>True</Pack>
<PackagePath>
</PackagePath>
</None>
</ItemGroup>
<!-- Include SourceLink Dependency for packages TO BE RELEASED-->
<ItemGroup Condition="('$(IsTestProject)' != 'true') and ('$(IsAnalyzerProject)' != 'true')">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
</Project>
8 changes: 7 additions & 1 deletion scripts/EnableSigning.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ $delaySign.'#text' = "true"
$signAssembly = $doc.SelectSingleNode("//SignAssembly");
$signAssembly.'#text' = "true"

# Set the AssemblyOriginatorKeyFile to an absolute path to resolve any path resolution issues.
# Assumption: The key file is in the same directory as the project file.
$dirName = [System.IO.Path]::GetDirectoryName([System.IO.Path]::GetFullPath($projectPath))
$assemblyOriginatorKeyFile = $doc.SelectSingleNode("//AssemblyOriginatorKeyFile");
$assemblyOriginatorKeyFile.'#text' = Join-Path $dirName $assemblyOriginatorKeyFile.'#text'

$doc.Save($projectPath);

Write-Host "Updated the .csproj file so that we can sign the built assemblies." -ForegroundColor Green
Write-Host "Updated the project file so that we can sign the built assemblies." -ForegroundColor Green
45 changes: 0 additions & 45 deletions src/abstractions/Microsoft.Kiota.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,18 @@

<PropertyGroup>
<Description>Abstractions library for the Kiota generated SDKs in dotnet.</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<AssemblyTitle>Kiota Abstractions Library for dotnet</AssemblyTitle>
<Authors>Microsoft</Authors>
<!-- NET 5 target to be removed on next major version-->
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
<RepositoryUrl>https://github.com/microsoft/kiota-dotnet</RepositoryUrl>
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<VersionPrefix>1.9.7</VersionPrefix>
<VersionSuffix></VersionSuffix>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- Enable this line once we go live to prevent breaking changes -->
<!-- <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> -->
<PackageReleaseNotes>
https://github.com/microsoft/kiota-dotnet/releases
</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<NoWarn>$(NoWarn);NU5048;NETSDK1138</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net5.0'))">
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Std.UriTemplate" Version="1.0.3" />
</ItemGroup>

<!-- NET 5 target to be removed on next major version-->
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0' or '$(TargetFramework)'== 'netStandard2.0' or '$(TargetFramework)' == 'netStandard2.1'">
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="[6.0,9.0)" />
</ItemGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<None Include="README.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>
Binary file removed src/authentication/azure/35MSSharedLib1024.snk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,13 @@

<PropertyGroup>
<Description>Kiota authentication provider implementation with Azure Identity.</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<AssemblyTitle>Kiota Azure Identity Authentication Library for dotnet</AssemblyTitle>
<Authors>Microsoft</Authors>
<!-- NET 5 target to be removed on next major version-->
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
<RepositoryUrl>https://github.com/microsoft/kiota-dotnet</RepositoryUrl>
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<VersionPrefix>1.1.7</VersionPrefix>
<VersionSuffix></VersionSuffix>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<!-- Enable this line once we go live to prevent breaking changes -->
<!-- <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> -->
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PackageReleaseNotes>
https://github.com/microsoft/kiota-dotnet/releases
</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<NoWarn>$(NoWarn);NU5048;NETSDK1138</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net5.0'))">
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Azure.Core" Version="1.39.0" />
<ProjectReference Include="..\..\abstractions\Microsoft.Kiota.Abstractions.csproj" />
</ItemGroup>
Expand All @@ -52,16 +18,4 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0' or '$(TargetFramework)'== 'netStandard2.0' or '$(TargetFramework)' == 'netStandard2.1'">
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="[6.0.1,9.0)" />
</ItemGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<None Include="README.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
6 changes: 4 additions & 2 deletions src/generated/KiotaGenerated.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Source Generator project to assembly info as source such as package version.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<IsAnalyzerProject>true</IsAnalyzerProject>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/generated/KiotaVersionGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ public void Execute(GeneratorExecutionContext context)
var mainSyntaxTree = context.Compilation.SyntaxTrees
.First(static x => x.HasCompilationUnitRoot);

var directory = Path.GetDirectoryName(mainSyntaxTree.FilePath);
var projectDirectory = Path.GetDirectoryName(mainSyntaxTree.FilePath);

var version = "unknown";
try {
XmlDocument csproj = new XmlDocument();
csproj.Load(Path.Combine(directory, "..", "Microsoft.Kiota.Http.HttpClientLibrary.csproj"));

projectDirectory = Path.Combine(projectDirectory, "..", "..", "..", "..", "Directory.Build.props");
csproj.Load(projectDirectory);
version = csproj.GetElementsByTagName("VersionPrefix")[0].InnerText;
} catch (Exception e)
{
throw new FileNotFoundException("KiotaVersionGenerator expanded in an invalid project, missing 'Microsoft.Kiota.Http.HttpClientLibrary.csproj' file.", e);
throw new FileNotFoundException($"KiotaVersionGenerator expanded in an invalid project, missing 'Directory.Build.props' file in the following directory {projectDirectory}", e);
}

string source = $@"// <auto-generated/>
Expand Down
Binary file removed src/http/httpClient/35MSSharedLib1024.snk
Binary file not shown.
Loading

0 comments on commit 73e48f6

Please sign in to comment.