Skip to content

Commit

Permalink
Merge branch 'main' into kalyanaj-linkssampler
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Apr 13, 2023
2 parents f483188 + 7db6941 commit c8076b0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Merging test results
run: reportgenerator -reports:TestResults/**/*.xml -targetdir:TestResults -reporttypes:Cobertura -assemblyFilters:"-microsoft.data.sqlclient*;-grpc.core*;-opentracing*"

- uses: codecov/codecov-action@v3.1.1
- uses: codecov/codecov-action@v3.1.2
with:
file: TestResults/Cobertura.xml
env_vars: OS
Expand Down
12 changes: 9 additions & 3 deletions build/Common.prod.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,28 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true'">
<PropertyGroup>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true' AND '$(RunApiCompat)' == 'true'">
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="6.0.0-beta.21308.1" PrivateAssets="All" />
<ResolvedMatchingContract Include="$(RepoRoot)\build\LastMajorVersionBinaries\$(AssemblyName)\$(OTelPreviousStableVer)\lib\$(TargetFramework)\$(AssemblyName).dll" />
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="DispatchToInnerBuilds;ValidateApiCompatForSrc" Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true'">
<Target Name="PreBuild" BeforeTargets="DispatchToInnerBuilds;ValidateApiCompatForSrc" Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true' AND '$(RunApiCompat)' == 'true'">
<!-- Note: DispatchToInnerBuilds is called for projects with multiple
targets defined to spawn a build process for each target framework being
compiled. Executing BEFORE that step means this runs once for a project
instead of in parallel for each target framework defined. If we ever have a
project with only a single target, this will NOT run and an alternative
solution will be needed. -->
<Message Text="ApiCompat: Running the powershell script to download the package for $(MSBuildProjectName)." Importance="High"/>
<Exec Command="powershell -ExecutionPolicy Unrestricted -File &quot;$(RepoRoot)\build\PreBuild.ps1&quot; -package $(AssemblyName) -version &quot;$(OTelPreviousStableVer)&quot; -workDir &quot;$(RepoRoot)\build\LastMajorVersionBinaries&quot;" />
</Target>

<Target Name="FindContractDependencyPaths" BeforeTargets="ValidateApiCompatForSrc" AfterTargets="ResolveAssemblyReferences" Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true'">
<Target Name="FindContractDependencyPaths" BeforeTargets="ValidateApiCompatForSrc" AfterTargets="ResolveAssemblyReferences" Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true' AND '$(RunApiCompat)' == 'true'">
<Message Text="ApiCompat: Finding the contract dependency path for $(MSBuildProjectName)." Importance="High"/>
<ItemGroup>
<_ReferencePathDirectories Include="@(ReferencePath -> '%(RootDir)%(Directory)')" />
</ItemGroup>
Expand Down
23 changes: 19 additions & 4 deletions build/PreBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,35 @@ if (-Not (Test-Path $workDir))

if (Test-Path -Path "$workDir\$package.$version.zip")
{
Write-Debug "Previous package $package@$version already downloaded for compatibility check"
Write-Host "Previous package $package@$version already downloaded for compatibility check"
}
else
{
Write-Host "Retrieving package $package@$version for compatibility check"
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/$package/$version -Outfile "$workDir\$package.$version.zip"
try
{
$Response = Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/$package/$version -Outfile "$workDir\$package.$version.zip"
}
catch
{
$StatusCode = $_.Exception.Response.StatusCode.value__
throw "Error downloading the package $package@$version. Status code of the received response: $StatusCode"
}
}

if (Test-Path -Path "$workDir\$package\$version\lib")
{
Write-Debug "Previous package $package@$version already extracted to '$workDir\$package\$version\lib'"
Write-Host "Previous package $package@$version already extracted to '$workDir\$package\$version\lib'"
}
else
{
Write-Host "Extracting package $package@$version from '$workDir\$package.$version.zip' to '$workDir\$package\$version' for compatibility check"
Expand-Archive -LiteralPath "$workDir\$package.$version.zip" -DestinationPath "$workDir\$package\$version" -Force
try
{
Expand-Archive -LiteralPath "$workDir\$package.$version.zip" -DestinationPath "$workDir\$package\$version" -Force
}
catch
{
throw "Error extracting $package@$version.zip"
}
}

0 comments on commit c8076b0

Please sign in to comment.