2018-11-20 00:48:22 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
|
<!--
|
2022-12-05 22:54:09 +00:00
|
|
|
This is the master msbuild project file for all csharp components.
|
2018-11-20 00:48:22 +00:00
|
|
|
This is created so that the NuGet dependencies are restored before the projects are built during a CI build.
|
|
|
|
|
CMake creates a target to this project
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
<Project DefaultTargets="Build">
|
2022-12-05 22:54:09 +00:00
|
|
|
|
2018-11-20 00:48:22 +00:00
|
|
|
<PropertyGroup>
|
2020-02-28 02:00:17 +00:00
|
|
|
<OrtPackageId Condition=" '$(OrtPackageId)' == '' ">Microsoft.ML.OnnxRuntime</OrtPackageId>
|
2018-11-20 00:48:22 +00:00
|
|
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
|
|
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
|
|
|
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
|
2019-06-14 21:51:03 +00:00
|
|
|
<DotNetExe Condition= " '$(DotNetExe)' == '' ">dotnet</DotNetExe>
|
2020-02-28 02:00:17 +00:00
|
|
|
<NugetExe Condition= " '$(NugetExe)' == '' ">nuget</NugetExe>
|
|
|
|
|
<TargetArchitecture Condition=" '$(TargetArchitecture)' == '' ">x64</TargetArchitecture>
|
|
|
|
|
<IsReleaseBuild Condition=" '$(IsReleaseBuild)' == '' ">false</IsReleaseBuild>
|
2023-05-06 01:18:24 +00:00
|
|
|
<ReleaseVersionSuffix></ReleaseVersionSuffix>
|
2020-08-18 04:52:17 +00:00
|
|
|
<IsLinuxBuild Condition=" '$(IsLinuxBuild)' == '' ">false</IsLinuxBuild>
|
2020-08-26 19:33:48 +00:00
|
|
|
<ExecutionProvider Condition=" '$(ExecutionProvider)' == '' ">None</ExecutionProvider>
|
2020-02-28 02:00:17 +00:00
|
|
|
|
|
|
|
|
<!--internal build related properties-->
|
2020-03-03 04:18:46 +00:00
|
|
|
<OnnxRuntimeSourceDirectory Condition="'$(OnnxRuntimeSourceDirectory)'==''">..</OnnxRuntimeSourceDirectory>
|
2020-08-26 19:33:48 +00:00
|
|
|
<GenerateNuspecScript>..\tools\nuget\generate_nuspec_for_native_nuget.py</GenerateNuspecScript>
|
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
|
|
<PropertyGroup Condition="'$(IsLinuxBuild)'=='true'">
|
|
|
|
|
<!--internal build related properties for Linux -->
|
|
|
|
|
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">..\build\Linux</OnnxRuntimeBuildDirectory>
|
|
|
|
|
<OnnxRuntimePackagesDirectory Condition="'$(OnnxRuntimePackagesDirectory)'==''">$(OnnxRuntimeBuildDirectory)\packages</OnnxRuntimePackagesDirectory>
|
|
|
|
|
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
|
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
|
|
<PropertyGroup Condition="'$(IsLinuxBuild)'=='false'">
|
|
|
|
|
<!--internal build related properties for Windows -->
|
2020-02-28 02:00:17 +00:00
|
|
|
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">..\build\Windows</OnnxRuntimeBuildDirectory>
|
2020-03-03 04:18:46 +00:00
|
|
|
<OnnxRuntimePackagesDirectory Condition="'$(OnnxRuntimePackagesDirectory)'==''">$(OnnxRuntimeBuildDirectory)\packages</OnnxRuntimePackagesDirectory>
|
2020-02-28 02:00:17 +00:00
|
|
|
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
|
2018-11-20 00:48:22 +00:00
|
|
|
</PropertyGroup>
|
2020-08-26 19:33:48 +00:00
|
|
|
|
2018-11-20 00:48:22 +00:00
|
|
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
|
|
|
|
|
|
|
|
<Target Name="Build">
|
2022-06-21 22:08:24 +00:00
|
|
|
<Error Text="Building via this file is not supported. Please build using the appropriate .sln file in this directory." />
|
2018-11-20 00:48:22 +00:00
|
|
|
</Target>
|
|
|
|
|
|
2019-08-16 00:28:47 +00:00
|
|
|
<Target Name="RunTest">
|
2018-11-20 00:48:22 +00:00
|
|
|
<Message Importance="High" Text="Running CSharp tests..." />
|
2019-10-08 02:14:34 +00:00
|
|
|
<Exec Command="$(DotNetExe) test test\Microsoft.ML.OnnxRuntime.Tests\Microsoft.ML.OnnxRuntime.Tests.csproj -c $(Configuration) --no-build --blame -v n" ConsoleToMSBuild="true">
|
2018-12-13 22:46:59 +00:00
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
|
|
|
|
|
</Exec>
|
2018-11-20 00:48:22 +00:00
|
|
|
</Target>
|
2018-11-26 06:46:21 +00:00
|
|
|
|
2022-06-21 22:08:24 +00:00
|
|
|
<Target Name="ObtainPackageVersion" BeforeTargets="Build;CreatePackage;CreateWindowsAIPackage">
|
2020-02-28 02:00:17 +00:00
|
|
|
<ReadLinesFromFile File="..\VERSION_NUMBER">
|
|
|
|
|
<Output TaskParameter="Lines" ItemName="MajorVersionNumber"/>
|
2022-12-05 22:54:09 +00:00
|
|
|
</ReadLinesFromFile>
|
2020-02-28 02:00:17 +00:00
|
|
|
<Exec Command="git rev-parse --short HEAD" ConsoleToMSBuild="true">
|
|
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHashShort" />
|
|
|
|
|
</Exec>
|
|
|
|
|
<Exec Command="git rev-parse HEAD" ConsoleToMSBuild="true">
|
|
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHash" />
|
|
|
|
|
</Exec>
|
|
|
|
|
<ConvertToAbsolutePath Paths="$(OnnxRuntimeBuildDirectory)">
|
|
|
|
|
<Output TaskParameter="AbsolutePaths" PropertyName="OnnxRuntimeBuildDirectoryAbs"/>
|
|
|
|
|
</ConvertToAbsolutePath>
|
|
|
|
|
<ConvertToAbsolutePath Paths="$(NativeBuildOutputDir)">
|
|
|
|
|
<Output TaskParameter="AbsolutePaths" PropertyName="NativeBuildOutputDirAbs"/>
|
|
|
|
|
</ConvertToAbsolutePath>
|
2020-03-03 04:18:46 +00:00
|
|
|
<ConvertToAbsolutePath Paths="$(OnnxRuntimePackagesDirectory)">
|
|
|
|
|
<Output TaskParameter="AbsolutePaths" PropertyName="OnnxRuntimePackagesDirectoryAbs"/>
|
|
|
|
|
</ConvertToAbsolutePath>
|
2020-02-28 02:00:17 +00:00
|
|
|
<ConvertToAbsolutePath Paths="$(OnnxRuntimeSourceDirectory)">
|
|
|
|
|
<Output TaskParameter="AbsolutePaths" PropertyName="OnnxRuntimeSourceDirectoryAbs"/>
|
2022-12-05 22:54:09 +00:00
|
|
|
</ConvertToAbsolutePath>
|
2020-02-28 02:00:17 +00:00
|
|
|
<PropertyGroup>
|
|
|
|
|
<CurrentDate>$([System.DateTime]::UtcNow.ToString(yyyyMMdd))</CurrentDate>
|
|
|
|
|
<CurrentTime>$([System.DateTime]::UtcNow.ToString(hhmm))</CurrentTime>
|
|
|
|
|
<PackageVersion>@(MajorVersionNumber)</PackageVersion>
|
2023-05-06 01:18:24 +00:00
|
|
|
<PackageVersion>$(PackageVersion)$(ReleaseVersionSuffix)</PackageVersion>
|
2020-02-28 02:00:17 +00:00
|
|
|
<Version>$(PackageVersion)</Version>
|
2021-02-17 17:53:36 +00:00
|
|
|
<PackageVersion Condition="'$(IsReleaseBuild)'!='True'">$(PackageVersion)-dev-$(CurrentDate)-$(CurrentTime)-$(GitCommitHashShort)</PackageVersion>
|
2020-02-28 02:00:17 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
|
<Message Importance="High" Text="PackageVersion=$(PackageVersion)" />
|
|
|
|
|
</Target>
|
2022-12-05 22:54:09 +00:00
|
|
|
|
2018-11-28 03:01:28 +00:00
|
|
|
<Target Name="CreatePackage">
|
2020-02-28 02:00:17 +00:00
|
|
|
<Message Importance="High" Text="Bundling managed assemblies into a NuGet package ..." />
|
2018-11-26 06:46:21 +00:00
|
|
|
<MSBuild Projects="src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj"
|
2020-02-28 02:00:17 +00:00
|
|
|
Targets="CopyMiscFiles;Pack"
|
2022-12-05 22:54:09 +00:00
|
|
|
Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId);SelectedTargets=All"/>
|
2020-08-26 19:33:48 +00:00
|
|
|
|
2020-02-28 02:00:17 +00:00
|
|
|
<Message Importance="High" Text="Generating nuspec for the native Nuget package ..." />
|
2021-09-29 16:28:31 +00:00
|
|
|
<Exec ContinueOnError="False" Command="python $(GenerateNuspecScript) --package_version $(PackageVersion) --package_name $(OrtPackageId) --target_architecture $(TargetArchitecture) --build_config $(Configuration) --native_build_path $(NativeBuildOutputDirAbs) --packages_path $(OnnxRuntimePackagesDirectoryAbs) --ort_build_path $(OnnxRuntimeBuildDirectoryAbs) --sources_path $(OnnxRuntimeSourceDirectoryAbs) --commit_id $(GitCommitHash) --is_release_build $(IsReleaseBuild) --execution_provider $(ExecutionProvider)" ConsoleToMSBuild="true">
|
2020-02-28 02:00:17 +00:00
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GenerateNuspecOutput" />
|
|
|
|
|
</Exec>
|
|
|
|
|
|
|
|
|
|
<Message Importance="High" Text="Bundling native shared library artifacts into a NuGet package ..." />
|
2021-11-23 01:29:53 +00:00
|
|
|
<Exec ContinueOnError="False" Command="$(NugetExe) pack NativeNuget.nuspec" ConsoleToMSBuild="true" WorkingDirectory="$(NativeBuildOutputDirAbs)" Condition=" '$(OS)' == 'Windows_NT'">
|
2021-09-21 09:45:20 +00:00
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
|
|
|
|
|
</Exec>
|
|
|
|
|
|
|
|
|
|
<Exec ContinueOnError="False" Command="$(NugetExe) pack NativeNuget.nuspec" ConsoleToMSBuild="true" WorkingDirectory="$(NativeBuildOutputDirAbs)" Condition=" '$(OS)' != 'Windows_NT'">
|
2020-02-28 02:00:17 +00:00
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
|
|
|
|
|
</Exec>
|
2020-08-26 19:33:48 +00:00
|
|
|
|
|
|
|
|
<Copy
|
|
|
|
|
SourceFiles="$(NativeBuildOutputDirAbs)\$(OrtPackageId).$(PackageVersion).nupkg"
|
2022-12-05 22:54:09 +00:00
|
|
|
DestinationFolder="$(NativeBuildOutputDirAbs)\nuget-local-artifacts"
|
2020-08-26 19:33:48 +00:00
|
|
|
/>
|
2018-11-26 06:46:21 +00:00
|
|
|
</Target>
|
|
|
|
|
|
2020-04-25 03:20:04 +00:00
|
|
|
<ItemGroup>
|
|
|
|
|
<LicenseFile Include="$(OnnxRuntimeSourceDirectory)\LICENSE"/>
|
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
2022-12-05 22:54:09 +00:00
|
|
|
<Target Name="CreateWindowsAIPackage">
|
2020-04-25 03:20:04 +00:00
|
|
|
<Copy SourceFiles="@(LicenseFile)" DestinationFiles="@(LicenseFile->'$(OnnxRuntimeSourceDirectory)\%(Filename).txt')"/>
|
|
|
|
|
|
|
|
|
|
<Message Importance="High" Text="Generating nuspec for the Microsoft.AI.MachineLearning Nuget package ..." />
|
2021-09-27 22:37:15 +00:00
|
|
|
<Exec ContinueOnError="False" Command="python ..\tools\nuget\generate_nuspec_for_native_nuget.py --package_version $(PackageVersion) --package_name Microsoft.AI.MachineLearning --target_architecture $(TargetArchitecture) --build_config $(Configuration) --native_build_path $(NativeBuildOutputDirAbs) --packages_path $(OnnxRuntimePackagesDirectoryAbs) --ort_build_path $(OnnxRuntimeBuildDirectoryAbs) --sources_path $(OnnxRuntimeSourceDirectoryAbs) --commit_id $(GitCommitHash) --is_release_build $(IsReleaseBuild)" ConsoleToMSBuild="true">
|
2020-04-25 03:20:04 +00:00
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GenerateNuspecOutput" />
|
|
|
|
|
</Exec>
|
|
|
|
|
|
|
|
|
|
<Message Importance="High" Text="Bundling native shared library artifacts into a NuGet package ..." />
|
2020-07-14 21:52:39 +00:00
|
|
|
<Exec ContinueOnError="False" Command="$(NugetExe) pack NativeNuget.nuspec -Symbols -SymbolPackageFormat snupkg" ConsoleToMSBuild="true" WorkingDirectory="$(NativeBuildOutputDirAbs)">
|
2020-04-25 03:20:04 +00:00
|
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
|
|
|
|
|
</Exec>
|
|
|
|
|
</Target>
|
2020-06-09 16:08:19 +00:00
|
|
|
|
2018-12-13 22:46:59 +00:00
|
|
|
</Project>
|