Skip to content

Commit

Permalink
Publish AuthoringTest with NAOT in build.cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Jan 3, 2024
1 parent 62a2fdd commit f6c2c0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,10 @@
</ItemGroup>

<!--
When in Release x64, we want to test NativeAOT publishing. So we use a custom MSBuild target
to publish the test WinRT component (need to restore first) and then copy the .dll file.
When in Release x64, we want to test NativeAOT publishing. The build.cmd script is
already publishing the project, so we just need to copy the .dll to the output.
-->
<Target
Condition="'$(Configuration)' == 'Release' and '$(Platform)' == 'x64'"
Name="BuildAndReferenceManagedLibrary"
BeforeTargets="PrepareForBuild">
<PropertyGroup Condition="'$(Configuration)' == 'Release' and '$(Platform)' == 'x64'">
<PropertyGroup>
<NativeLibraryProjectName>AuthoringTest</NativeLibraryProjectName>
<NativeLibraryProjectDirectory>$(MSBuildThisFileDirectory)..\$(NativeLibraryProjectName)\</NativeLibraryProjectDirectory>
Expand All @@ -116,17 +113,9 @@
<NativeLibraryPublishedDllPath>$(NativeLibraryPublishFolder)$(NativeLibraryProjectName).dll</NativeLibraryPublishedDllPath>
</PropertyGroup>

<!-- Publish the managed library with NativeAOT -->
<MSBuild Projects="$(NativeLibraryProjectFilePath)"
Properties="Configuration=$(Configuration);Platform=$(Platform);RuntimeIdentifier=win-$(Platform);NativeLib=Shared"
Targets="Restore" />
<MSBuild Projects="$(NativeLibraryProjectFilePath)"
Properties="Configuration=$(Configuration);Platform=$(Platform);RuntimeIdentifier=win-$(Platform);NativeLib=Shared"
Targets="Publish" />

<!-- Copy the .dll to our output folder -->
<Copy SourceFiles="$(NativeLibraryPublishedDllPath)" DestinationFolder="$(OutputPath)" />
</Target>
</PropertyGroup>

<ItemGroup>
<Reference Include="AuthoringTest">
Expand Down
8 changes: 8 additions & 0 deletions src/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ if "%cswinrt_platform%" EQU "x64" (
)
)

if "%cswinrt_platform%" EQU "x64" (
if /I "%cswinrt_configuration%" EQU "release" (
echo Publishing AOT authoring tests for %cswinrt_platform% %cswinrt_configuration%
rem We also restore here as NAOT needs its own restore to pull in ILC
call :exec %msbuild_path%msbuild.exe /restore -t:publish %cswinrt_build_params% /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;RuntimeIdentifier=win-%cswinrt_platform%;VersionNumber=%cswinrt_version_number%;VersionString=%cswinrt_version_string%;AssemblyVersionNumber=%cswinrt_assembly_version%;GenerateTestProjection=true;BaselineAllAPICompatError=%cswinrt_baseline_breaking_compat_errors%;BaselineAllMatchingRefApiCompatError=%cswinrt_baseline_assembly_version_compat_errors% /p:solutiondir=%this_dir% %this_dir%Tests\AuthoringTest\AuthoringTest.csproj
)
)

if "%cswinrt_build_only%"=="true" goto :eof

:buildembedded
Expand Down

0 comments on commit f6c2c0a

Please sign in to comment.