Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
<UseVSTestRunner>true</UseVSTestRunner>
</PropertyGroup>

<PropertyGroup>
<!-- By default turn off the NodeJS tools required to build the reports for Microsoft.Extensions.AI.Evaluation.Reporting
This should be enabled in CI and also for report development work. -->
<EnableEvaluationReportBuild>false</EnableEvaluationReportBuild>
</PropertyGroup>

<!-- Common properties -->
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Analyzers.props" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Packaging.props" />
Expand Down
3 changes: 2 additions & 1 deletion eng/pipelines/templates/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ steps:
-configuration ${{ parameters.buildConfig }}
-warnAsError ${{ parameters.warnAsError }}
/bl:${{ parameters.repoLogPath }}/build.binlog
/p:"EnableEvaluationReportBuild=true"
$(_OfficialBuildIdArgs)
displayName: Build

- ${{ if eq(parameters.isWindows, 'true') }}:
- pwsh: |
$(Build.SourcesDirectory)/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/azure-devops-report/build.ps1 -OutputPath $(Build.ArtifactStagingDirectory)\VSIX
$(Build.SourcesDirectory)/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/azure-devops-report/build.ps1 -OutputPath $(Build.Arcade.ArtifactsPath)/packages
displayName: Build Azure DevOps plugin

- ${{ if ne(parameters.skipTests, 'true') }}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="..\TypeScript\html-report\dist\index.html" Visible="false">
<EmbeddedResource Condition="'$(EnableEvaluationReportBuild)'=='true'"
Include="..\TypeScript\html-report\dist\index.html" Visible="false">
<LogicalName>Reporting.HTML.index.html</LogicalName>
</EmbeddedResource>
</ItemGroup>
Expand All @@ -33,59 +34,4 @@
<InternalsVisibleToTest Include="Microsoft.Extensions.AI.Evaluation.Reporting.Tests" />
</ItemGroup>

<!-- Build the report code before this, so it can be embedded.
Setting the BeforeTargets=DispatchToInnerBuilds allows it to build only once before
the multiple parallel builds are invoked for each target framework. -->
<Target Name="BuildTypescriptBundle"
BeforeTargets="DispatchToInnerBuilds"
Outputs="..\TypeScript\html-report\dist\index.html">
<Message Text="Build the Typescript bundle" Importance="high" />
<Exec Command="npm install" WorkingDirectory="..\TypeScript" />
<Exec Command="node build-if-out-of-date.js" WorkingDirectory="..\TypeScript" />
</Target>

<!-- Generate a version constant that can be accessed from the C# code. -->
<Target Name="GenerateVersionConstant" BeforeTargets="CoreCompile">
<PropertyGroup>
<ConstantsFilePath>$(IntermediateOutputPath)Constants.g.cs</ConstantsFilePath>
<Lines>
// <auto-generated>
// This file is auto-generated by MSBuild.
// </auto-generated>

namespace Microsoft.Extensions.AI.Evaluation.Reporting%3B

internal static class Constants
{
public const string Version = "$(Version)"%3B
}
</Lines>
</PropertyGroup>

<Message Text="Generating $(ConstantsFilePath)." Importance="high" />

<WriteLinesToFile File="$(ConstantsFilePath)"
Lines="$(Lines)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />

<ItemGroup>
<Compile Include="$(ConstantsFilePath)" />
</ItemGroup>
</Target>

<!-- Generate a version file that can be accessed from the script that builds the Azure DevOps Extension pacakge. -->
<Target Name="StampVSIXPackageVersion" BeforeTargets="CoreCompile">
<PropertyGroup>
<VSIXPackageVersionFile>..\TypeScript\azure-devops-report\VSIXPackageVersion.json</VSIXPackageVersionFile>
<VSIXVersion>$(VersionPrefix).42424242</VSIXVersion>
<VSIXVersion Condition=" '$(VersionSuffixDateStamp)'!='' ">$(VersionPrefix).$(VersionSuffixDateStamp)$(VersionSuffixBuildOfTheDayPadded)</VSIXVersion>
<Lines>{"PackageVersion":"$(VSIXVersion)"}</Lines>
</PropertyGroup>
<WriteLinesToFile File="$(VSIXPackageVersionFile)"
Lines="$(Lines)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<!-- Enable this property during development and CI so that the report is built and embedded in the assembly. -->
<!-- <EnableEvaluationReportBuild>true</EnableEvaluationReportBuild> -->
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />

<!-- Build the report code before this, so it can be embedded.
Setting the BeforeTargets=DispatchToInnerBuilds allows it to build only once before
the multiple parallel builds are invoked for each target framework. -->
<Target Name="BuildTypescriptBundle"
BeforeTargets="DispatchToInnerBuilds"
Condition="'$(EnableEvaluationReportBuild)'=='true'"
Outputs="$(MSBuildThisFileDirectory)\TypeScript\html-report\dist\index.html">
<Message Text="Build the Typescript bundle" Importance="high" />
<Exec Command="npm install" WorkingDirectory="$(MSBuildThisFileDirectory)\TypeScript" />
<Exec Command="node build-if-out-of-date.js" WorkingDirectory="$(MSBuildThisFileDirectory)\TypeScript" />
</Target>

<!-- Generate a version constant that can be accessed from the C# code. -->
<Target Name="GenerateVersionConstant" BeforeTargets="CoreCompile">
<PropertyGroup>
<_ConstantsFilePath>$(IntermediateOutputPath)Constants.g.cs</_ConstantsFilePath>
<_Lines>
// <auto-generated>
// This file is auto-generated by MSBuild.
// </auto-generated>

namespace Microsoft.Extensions.AI.Evaluation.Reporting%3B

internal static class Constants
{
public const string Version = "$(Version)"%3B
}
</_Lines>
</PropertyGroup>

<Message Text="Generating $(_ConstantsFilePath)." Importance="high" />

<WriteLinesToFile File="$(_ConstantsFilePath)"
Lines="$(_Lines)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />

<ItemGroup>
<Compile Include="$(_ConstantsFilePath)" />
</ItemGroup>
</Target>

<!-- Generate a version file that can be accessed from the script that builds the Azure DevOps Extension pacakge. -->
<Target Name="StampVSIXPackageVersion" BeforeTargets="CoreCompile">
<PropertyGroup>
<_VSIXPackageVersionFile>$(MSBuildThisFileDirectory)\TypeScript\azure-devops-report\VSIXPackageVersion.json</_VSIXPackageVersionFile>

<_VSIXVersion>$(VersionPrefix).42424242</_VSIXVersion>
<_VSIXVersion Condition=" '$(VersionSuffixDateStamp)'!='' ">$(VersionPrefix).$(VersionSuffixDateStamp)$(VersionSuffixBuildOfTheDayPadded)</_VSIXVersion>

<_Lines>{"PackageVersion":"$(_VSIXVersion)"}</_Lines>
</PropertyGroup>

<WriteLinesToFile File="$(_VSIXPackageVersionFile)"
Lines="$(_Lines)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
</Target>
</Project>
Loading