mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-24 22:17:32 +00:00
parent
689e524c58
commit
1b494daffa
4 changed files with 310 additions and 91 deletions
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="Microsoft_ML_OnnxRuntime_CheckPrerequisites" BeforeTargets="BeforeBuild">
|
||||
<!--
|
||||
Special case .NET Core portable applications. When building a portable .NET Core app,
|
||||
the PlatformTarget is empty, and you don't know until runtime (i.e. which dotnet.exe)
|
||||
what processor architecture will be used.
|
||||
-->
|
||||
<Error Condition="('$(PlatformTarget)' != 'x64' AND '$(PlatformTarget)' != 'arm64') AND
|
||||
('$(OutputType)' == 'Exe' OR '$(OutputType)'=='WinExe') AND
|
||||
!('$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(PlatformTarget)' == '') AND
|
||||
'$(SuppressOnnxRuntimePlatformCompatibilityError)' != 'true'"
|
||||
Text="Microsoft.ML.OnnxRuntime.Snpe_Win only supports the arm64 and x64 at this time."/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
@ -2107,7 +2107,7 @@ def derive_linux_build_property():
|
|||
|
||||
|
||||
def build_nuget_package(
|
||||
source_dir, build_dir, configs, use_cuda, use_openvino, use_tensorrt, use_dnnl, use_tvm, use_winml
|
||||
source_dir, build_dir, configs, use_cuda, use_openvino, use_tensorrt, use_dnnl, use_tvm, use_winml, use_snpe
|
||||
):
|
||||
if not (is_windows() or is_linux()):
|
||||
raise BuildError(
|
||||
|
|
@ -2143,6 +2143,9 @@ def build_nuget_package(
|
|||
elif use_tvm:
|
||||
execution_provider = '/p:ExecutionProvider="tvm"'
|
||||
package_name = '/p:OrtPackageId="Microsoft.ML.OnnxRuntime.Tvm"'
|
||||
elif use_snpe:
|
||||
execution_provider = '/p:ExecutionProvider="snpe"'
|
||||
package_name = '/p:OrtPackageId="Microsoft.ML.OnnxRuntime.Snpe"'
|
||||
else:
|
||||
# use the solution file that includes Xamarin mobile targets
|
||||
sln = "OnnxRuntime.CSharp.sln"
|
||||
|
|
@ -2783,6 +2786,7 @@ def main():
|
|||
args.use_dnnl,
|
||||
args.use_tvm,
|
||||
args.use_winml,
|
||||
args.use_snpe,
|
||||
)
|
||||
|
||||
if args.test and args.build_nuget:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,257 @@
|
|||
parameters:
|
||||
- name: snpe_sdk_path_win
|
||||
displayName: Snpe Windows SDK path
|
||||
type: string
|
||||
default: C:\data\local\SNPE\snpe_win-1.61.46.3724
|
||||
|
||||
- name: snpe_sdk_info
|
||||
displayName: Snpe SDK Version Information
|
||||
type: string
|
||||
default: snpe_win-1.61.46
|
||||
|
||||
- name: ort_package_version
|
||||
displayName: OnnxRuntime Nuget package version
|
||||
type: string
|
||||
default: 1.13.1
|
||||
|
||||
- name: build_config
|
||||
displayName: Build Configuration
|
||||
type: string
|
||||
default: 'Release'
|
||||
|
||||
- name: IsReleaseBuild
|
||||
displayName: Is a release build? Set it to true if you are doing an Onnx Runtime release.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
- name: DoEsrp
|
||||
displayName: Run code sign tasks? Must be true if you are doing an Onnx Runtime release.
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
|
||||
- job: OnnxRuntime_SnpeNuget_Win_x64
|
||||
timeoutInMinutes: 120
|
||||
|
||||
pool: 'Onnxruntime-SNPE-Windows-2022-CPU'
|
||||
variables:
|
||||
MsbuildArguments: '-detailedsummary -maxcpucount -consoleloggerparameters:PerformanceSummary'
|
||||
OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)'
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
||||
buildArch: x64
|
||||
setVcvars: true
|
||||
ALLOW_RELEASED_ONNX_OPSET_ONLY: '1'
|
||||
|
||||
steps:
|
||||
- template: templates/set-version-number-variables-step.yml
|
||||
|
||||
- task: NuGetAuthenticate@0
|
||||
inputs:
|
||||
forceReinstallCredentialProvider: true
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.7'
|
||||
addToPath: true
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Build onnxruntime for x64'
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
||||
arguments: '--disable_ml_ops --build_dir $(Build.BinariesDirectory)\Windows --skip_submodule_sync --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --use_snpe --snpe_root=${{parameters.snpe_sdk_path_win}}'
|
||||
|
||||
- template: templates/win-esrp-dll.yml
|
||||
parameters:
|
||||
FolderPath: '$(Build.BinariesDirectory)\Windows\${{ parameters.build_config }}\${{ parameters.build_config }}'
|
||||
DisplayName: 'ESRP - Sign dlls'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: 'Generating nuspec for the native Nuget package x64'
|
||||
inputs:
|
||||
script: |
|
||||
copy $(Build.SourcesDirectory)\LICENSE $(Build.SourcesDirectory)\LICENSE.txt
|
||||
python "$(Build.SourcesDirectory)\tools\nuget\generate_nuspec_for_native_nuget.py" --package_version ${{ parameters.ort_package_version }} --package_name Microsoft.ML.OnnxRuntime.Snpe --target_architecture x64 --build_config ${{ parameters.build_config }} --native_build_path=$(Build.BinariesDirectory)\Windows\${{ parameters.build_config }}\${{ parameters.build_config }} --packages_path $(Build.BinariesDirectory)\Windows\packages --ort_build_path $(Build.BinariesDirectory)\Windows --sources_path $(Build.SourcesDirectory) --commit_id $(OnnxRuntimeGitCommitHash) --is_release_build ${{ parameters.IsReleaseBuild }} --sdk_info ${{ parameters.snpe_sdk_info }}
|
||||
cd $(Build.BinariesDirectory)\Windows\${{ parameters.build_config }}\${{ parameters.build_config }}
|
||||
nuget pack NativeNuget.nuspec
|
||||
mkdir $(Build.ArtifactStagingDirectory)\x64
|
||||
copy $(Build.BinariesDirectory)\Windows\${{ parameters.build_config }}\${{ parameters.build_config }}\*.nupkg $(Build.ArtifactStagingDirectory)\x64
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline x64 NuGet Artifact'
|
||||
inputs:
|
||||
artifactName: 'drop-winnuget-x64'
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)/x64'
|
||||
|
||||
- job: OnnxRuntime_SnpeNuget_Win_Arm64
|
||||
timeoutInMinutes: 120
|
||||
|
||||
pool: 'Onnxruntime-SNPE-Windows-2022-CPU'
|
||||
variables:
|
||||
MsbuildArguments: '-detailedsummary -maxcpucount -consoleloggerparameters:PerformanceSummary'
|
||||
OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)'
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
||||
buildArch: x64
|
||||
setVcvars: true
|
||||
ALLOW_RELEASED_ONNX_OPSET_ONLY: '1'
|
||||
|
||||
steps:
|
||||
- template: templates/set-version-number-variables-step.yml
|
||||
|
||||
- task: NuGetAuthenticate@0
|
||||
inputs:
|
||||
forceReinstallCredentialProvider: true
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.7'
|
||||
addToPath: true
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate CMake Configuration for arm64'
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
||||
arguments: '--update --disable_ml_ops --build_dir $(Build.BinariesDirectory)\Win_arm64 --skip_submodule_sync --skip_tests --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --arm64 --use_snpe --snpe_root=${{parameters.snpe_sdk_path_win}}'
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build onnxruntime arm64'
|
||||
inputs:
|
||||
solution: '$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\onnxruntime.vcxproj'
|
||||
platform: ARM64
|
||||
configuration: ${{ parameters.build_config }}
|
||||
msbuildArchitecture: ARM64
|
||||
maximumCpuCount: true
|
||||
logProjectEvents: true
|
||||
workingFolder: '$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}'
|
||||
createLogFile: true
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build onnx_test_runner arm64'
|
||||
inputs:
|
||||
solution: '$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\onnx_test_runner.vcxproj'
|
||||
platform: ARM64
|
||||
configuration: ${{ parameters.build_config }}
|
||||
msbuildArchitecture: ARM64
|
||||
maximumCpuCount: true
|
||||
logProjectEvents: true
|
||||
workingFolder: '$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}'
|
||||
createLogFile: true
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build onnxruntime_perf_test arm64'
|
||||
inputs:
|
||||
solution: '$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\onnxruntime_perf_test.vcxproj'
|
||||
platform: ARM64
|
||||
configuration: ${{ parameters.build_config }}
|
||||
msbuildArchitecture: ARM64
|
||||
maximumCpuCount: true
|
||||
logProjectEvents: true
|
||||
workingFolder: '$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}'
|
||||
createLogFile: true
|
||||
|
||||
- template: templates/win-esrp-dll.yml
|
||||
parameters:
|
||||
FolderPath: '$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\${{ parameters.build_config }}'
|
||||
DisplayName: 'ESRP - Sign dlls'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: 'Generating nuspec for the native Nuget package arm64'
|
||||
inputs:
|
||||
script: |
|
||||
copy $(Build.SourcesDirectory)\LICENSE $(Build.SourcesDirectory)\LICENSE.txt
|
||||
python "$(Build.SourcesDirectory)\tools\nuget\generate_nuspec_for_native_nuget.py" --package_version ${{ parameters.ort_package_version }} --package_name Microsoft.ML.OnnxRuntime.Snpe --target_architecture arm64 --build_config ${{ parameters.build_config }} --native_build_path=$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\${{ parameters.build_config }} --packages_path $(Build.BinariesDirectory)\Win_arm64\packages --ort_build_path $(Build.BinariesDirectory)\Win_arm64 --sources_path $(Build.SourcesDirectory) --commit_id $(OnnxRuntimeGitCommitHash) --is_release_build ${{ parameters.IsReleaseBuild }} --sdk_info ${{ parameters.snpe_sdk_info }}
|
||||
cd $(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\${{ parameters.build_config }}
|
||||
nuget pack NativeNuget.nuspec
|
||||
mkdir $(Build.ArtifactStagingDirectory)\arm64
|
||||
copy $(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\${{ parameters.build_config }}\*.nupkg $(Build.ArtifactStagingDirectory)\arm64
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline arm64 NuGet Artifact'
|
||||
inputs:
|
||||
artifactName: 'drop-winnuget-arm64'
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)/arm64'
|
||||
|
||||
- job: NuGet_Packaging_Snpe
|
||||
workspace:
|
||||
clean: all
|
||||
pool: 'Onnxruntime-SNPE-Windows-2022-CPU'
|
||||
dependsOn:
|
||||
- OnnxRuntime_SnpeNuget_Win_x64
|
||||
- OnnxRuntime_SnpeNuget_Win_Arm64
|
||||
condition: succeeded()
|
||||
steps:
|
||||
|
||||
- task: DownloadPipelineArtifact@0
|
||||
displayName: 'Download Pipeline Artifact - Snpe NuGet x64'
|
||||
inputs:
|
||||
artifactName: 'drop-winnuget-x64'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-x64'
|
||||
|
||||
- task: DownloadPipelineArtifact@0
|
||||
displayName: 'Download Pipeline Artifact - Snpe NuGet arm64'
|
||||
inputs:
|
||||
artifactName: 'drop-winnuget-arm64'
|
||||
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-arm64'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Bundle NuGet'
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
Add-Type -AssemblyName "System.IO.Compression.FileSystem"
|
||||
|
||||
$nupkgs = (Get-ChildItem $(Build.BinariesDirectory)/nuget-artifact-x64 -Filter Microsoft.ML.OnnxRuntime.Snpe*.nupkg -Recurse)
|
||||
$x64_nuget_package_name = $nupkgs[0].Name
|
||||
$x64_nuget_package = $nupkgs[0].FullName
|
||||
$x64_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName
|
||||
$x64_nupkg_unzipped_directory = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x64_nuget_package))
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($x64_nuget_package, $x64_nupkg_unzipped_directory)
|
||||
|
||||
$nupkgs = (Get-ChildItem $(Build.BinariesDirectory)/nuget-artifact-arm64 -Filter Microsoft.ML.OnnxRuntime.Snpe*.nupkg -Recurse)
|
||||
$arm64_nuget_package = $nupkgs[0].FullName
|
||||
$arm64_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName
|
||||
$arm64_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm64_nuget_package))
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($arm64_nuget_package, $arm64_nupkg_unzipped_directory)
|
||||
|
||||
$arm64_runtime_path_old = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', 'native')
|
||||
$arm64_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', 'native')
|
||||
|
||||
New-Item -Path $arm64_runtime_path_new -ItemType Directory
|
||||
|
||||
Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime.dll')) $arm64_runtime_path_new
|
||||
Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime.lib')) $arm64_runtime_path_new
|
||||
Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnx_test_runner.exe')) $arm64_runtime_path_new
|
||||
Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime_perf_test.exe')) $arm64_runtime_path_new
|
||||
|
||||
$merged_nuget_path = [System.IO.Path]::Combine($Env:BUILD_ARTIFACTSTAGINGDIRECTORY, 'merged')
|
||||
if (!(Test-Path $merged_nuget_path)) {
|
||||
New-Item -Path $merged_nuget_path -ItemType Directory
|
||||
}
|
||||
|
||||
$merged_nuget = [System.IO.Path]::Combine($merged_nuget_path, $x64_nuget_package_name)
|
||||
|
||||
$zip_tool_directory = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory_root, 'ziptool')
|
||||
if (!(Test-Path $zip_tool_directory)) {
|
||||
New-Item -Path $zip_tool_directory -ItemType Directory
|
||||
}
|
||||
|
||||
$zip_tool = [System.IO.Path]::Combine($zip_tool_directory, 'zip.exe')
|
||||
|
||||
Invoke-WebRequest http://stahlworks.com/dev/zip.exe -OutFile $zip_tool
|
||||
Start-Process -FilePath $zip_tool -ArgumentList "-r $merged_nuget ." -WorkingDirectory $x64_nupkg_unzipped_directory -NoNewWindow -Wait
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
|
||||
- template: templates/esrp_nuget.yml
|
||||
parameters:
|
||||
DisplayName: 'ESRP - sign NuGet package'
|
||||
FolderPath: '$(Build.ArtifactStagingDirectory)/merged'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline NuGet Artifact'
|
||||
inputs:
|
||||
artifactName: 'drop-winnuget'
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)/merged'
|
||||
|
||||
|
|
@ -122,29 +122,28 @@ def parse_arguments():
|
|||
choices=["cuda", "dnnl", "openvino", "tensorrt", "snpe", "tvm", "None"],
|
||||
help="The selected execution provider for this build.",
|
||||
)
|
||||
parser.add_argument("--dependency_id", required=False, default="None", type=str, help="ependency id.")
|
||||
parser.add_argument("--dependency_version", required=False, default="None", type=str, help="dependency version.")
|
||||
parser.add_argument("--sdk_info", required=False, default="", type=str, help="dependency SDK information.")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def generate_id(list, package_name):
|
||||
list.append("<id>" + package_name + "</id>")
|
||||
def generate_id(line_list, package_name):
|
||||
line_list.append("<id>" + package_name + "</id>")
|
||||
|
||||
|
||||
def generate_version(list, package_version):
|
||||
list.append("<version>" + package_version + "</version>")
|
||||
def generate_version(line_list, package_version):
|
||||
line_list.append("<version>" + package_version + "</version>")
|
||||
|
||||
|
||||
def generate_authors(list, authors):
|
||||
list.append("<authors>" + authors + "</authors>")
|
||||
def generate_authors(line_list, authors):
|
||||
line_list.append("<authors>" + authors + "</authors>")
|
||||
|
||||
|
||||
def generate_owners(list, owners):
|
||||
list.append("<owners>" + owners + "</owners>")
|
||||
def generate_owners(line_list, owners):
|
||||
line_list.append("<owners>" + owners + "</owners>")
|
||||
|
||||
|
||||
def generate_description(list, package_name):
|
||||
def generate_description(line_list, package_name):
|
||||
description = ""
|
||||
|
||||
if package_name == "Microsoft.AI.MachineLearning":
|
||||
|
|
@ -154,45 +153,38 @@ def generate_description(list, package_name):
|
|||
"This package contains native shared library artifacts " "for all supported platforms of ONNX Runtime."
|
||||
)
|
||||
|
||||
list.append("<description>" + description + "</description>")
|
||||
line_list.append("<description>" + description + "</description>")
|
||||
|
||||
|
||||
def generate_copyright(list, copyright):
|
||||
list.append("<copyright>" + copyright + "</copyright>")
|
||||
def generate_copyright(line_list, copyright):
|
||||
line_list.append("<copyright>" + copyright + "</copyright>")
|
||||
|
||||
|
||||
def generate_tags(list, tags):
|
||||
list.append("<tags>" + tags + "</tags>")
|
||||
def generate_tags(line_list, tags):
|
||||
line_list.append("<tags>" + tags + "</tags>")
|
||||
|
||||
|
||||
def generate_icon(list, icon_file):
|
||||
list.append("<icon>" + icon_file + "</icon>")
|
||||
def generate_icon(line_list, icon_file):
|
||||
line_list.append("<icon>" + icon_file + "</icon>")
|
||||
|
||||
|
||||
def generate_license(list):
|
||||
list.append('<license type="file">LICENSE.txt</license>')
|
||||
def generate_license(line_list):
|
||||
line_list.append('<license type="file">LICENSE.txt</license>')
|
||||
|
||||
|
||||
def generate_project_url(list, project_url):
|
||||
list.append("<projectUrl>" + project_url + "</projectUrl>")
|
||||
def generate_project_url(line_list, project_url):
|
||||
line_list.append("<projectUrl>" + project_url + "</projectUrl>")
|
||||
|
||||
|
||||
def generate_repo_url(list, repo_url, commit_id):
|
||||
list.append('<repository type="git" url="' + repo_url + '"' + ' commit="' + commit_id + '" />')
|
||||
def generate_repo_url(line_list, repo_url, commit_id):
|
||||
line_list.append('<repository type="git" url="' + repo_url + '"' + ' commit="' + commit_id + '" />')
|
||||
|
||||
|
||||
def generate_dependencies(xml_text, package_name, version, dependency_id, dependency_version):
|
||||
if package_name in ("Microsoft.ML.OnnxRuntime.Snpe", "Microsoft.ML.OnnxRuntime.Snpe_Win"):
|
||||
xml_text.append("<dependencies>")
|
||||
xml_text.append('<dependency id="' + dependency_id + '" version="' + dependency_version + '"/>')
|
||||
xml_text.append("</dependencies>")
|
||||
return
|
||||
|
||||
def generate_dependencies(xml_text, package_name, version):
|
||||
dml_dependency = '<dependency id="Microsoft.AI.DirectML" version="1.9.1"/>'
|
||||
|
||||
if package_name == "Microsoft.AI.MachineLearning":
|
||||
xml_text.append("<dependencies>")
|
||||
|
||||
# Support .Net Core
|
||||
xml_text.append('<group targetFramework="net5.0">')
|
||||
xml_text.append(dml_dependency)
|
||||
|
|
@ -205,7 +197,6 @@ def generate_dependencies(xml_text, package_name, version, dependency_id, depend
|
|||
xml_text.append('<group targetFramework="native">')
|
||||
xml_text.append(dml_dependency)
|
||||
xml_text.append("</group>")
|
||||
|
||||
xml_text.append("</dependencies>")
|
||||
else:
|
||||
include_dml = package_name == "Microsoft.ML.OnnxRuntime.DirectML"
|
||||
|
|
@ -263,27 +254,30 @@ def get_env_var(key):
|
|||
return os.environ.get(key)
|
||||
|
||||
|
||||
def generate_release_notes(list):
|
||||
list.append("<releaseNotes>")
|
||||
list.append("Release Def:")
|
||||
def generate_release_notes(line_list, dependency_sdk_info):
|
||||
line_list.append("<releaseNotes>")
|
||||
line_list.append("Release Def:")
|
||||
|
||||
branch = get_env_var("BUILD_SOURCEBRANCH")
|
||||
list.append("\t" + "Branch: " + (branch if branch is not None else ""))
|
||||
line_list.append("\t" + "Branch: " + (branch if branch is not None else ""))
|
||||
|
||||
version = get_env_var("BUILD_SOURCEVERSION")
|
||||
list.append("\t" + "Commit: " + (version if version is not None else ""))
|
||||
line_list.append("\t" + "Commit: " + (version if version is not None else ""))
|
||||
|
||||
build_id = get_env_var("BUILD_BUILDID")
|
||||
list.append(
|
||||
line_list.append(
|
||||
"\t"
|
||||
+ "Build: https://aiinfra.visualstudio.com/Lotus/_build/results?buildId="
|
||||
+ (build_id if build_id is not None else "")
|
||||
)
|
||||
|
||||
list.append("</releaseNotes>")
|
||||
if dependency_sdk_info:
|
||||
line_list.append("Dependency SDK: " + dependency_sdk_info)
|
||||
|
||||
line_list.append("</releaseNotes>")
|
||||
|
||||
|
||||
def generate_metadata(list, args):
|
||||
def generate_metadata(line_list, args):
|
||||
metadata_list = ["<metadata>"]
|
||||
generate_id(metadata_list, args.package_name)
|
||||
generate_version(metadata_list, args.package_version)
|
||||
|
|
@ -296,16 +290,14 @@ def generate_metadata(list, args):
|
|||
generate_license(metadata_list)
|
||||
generate_project_url(metadata_list, "https://github.com/Microsoft/onnxruntime")
|
||||
generate_repo_url(metadata_list, "https://github.com/Microsoft/onnxruntime.git", args.commit_id)
|
||||
generate_dependencies(
|
||||
metadata_list, args.package_name, args.package_version, args.dependency_id, args.dependency_version
|
||||
)
|
||||
generate_release_notes(metadata_list)
|
||||
generate_dependencies(metadata_list, args.package_name, args.package_version)
|
||||
generate_release_notes(metadata_list, args.sdk_info)
|
||||
metadata_list.append("</metadata>")
|
||||
|
||||
list += metadata_list
|
||||
line_list += metadata_list
|
||||
|
||||
|
||||
def generate_files(list, args):
|
||||
def generate_files(line_list, args):
|
||||
files_list = ["<files>"]
|
||||
|
||||
is_cpu_package = args.package_name in ["Microsoft.ML.OnnxRuntime", "Microsoft.ML.OnnxRuntime.OpenMP"]
|
||||
|
|
@ -313,7 +305,7 @@ def generate_files(list, args):
|
|||
is_cuda_gpu_package = args.package_name == "Microsoft.ML.OnnxRuntime.Gpu"
|
||||
is_dml_package = args.package_name == "Microsoft.ML.OnnxRuntime.DirectML"
|
||||
is_windowsai_package = args.package_name == "Microsoft.AI.MachineLearning"
|
||||
is_snpe_package_win = args.package_name == "Microsoft.ML.OnnxRuntime.Snpe_Win"
|
||||
is_snpe_package = args.package_name == "Microsoft.ML.OnnxRuntime.Snpe"
|
||||
|
||||
includes_winml = is_windowsai_package
|
||||
includes_directml = (is_dml_package or is_windowsai_package) and (
|
||||
|
|
@ -489,7 +481,7 @@ def generate_files(list, args):
|
|||
+ '" target="lib\\net5.0\\Microsoft.AI.MachineLearning.Interop.pdb" />'
|
||||
)
|
||||
|
||||
if args.package_name == "Microsoft.ML.OnnxRuntime.Snpe_Win":
|
||||
if args.package_name == "Microsoft.ML.OnnxRuntime.Snpe":
|
||||
files_list.append(
|
||||
"<file src=" + '"' + os.path.join(args.native_build_path, "onnx_test_runner.exe") + runtimes + " />"
|
||||
)
|
||||
|
|
@ -527,13 +519,6 @@ def generate_files(list, args):
|
|||
files_list.append(
|
||||
"<file src=" + '"' + os.path.join(args.native_build_path, "onnxruntime.pdb") + runtimes + " />"
|
||||
)
|
||||
elif args.package_name == "Microsoft.ML.OnnxRuntime.Snpe":
|
||||
files_list.append(
|
||||
"<file src="
|
||||
+ '"'
|
||||
+ os.path.join(args.native_build_path, "libonnxruntime.so")
|
||||
+ '" target="runtimes\\android-arm64\\native" />'
|
||||
)
|
||||
else:
|
||||
files_list.append(
|
||||
"<file src="
|
||||
|
|
@ -842,7 +827,7 @@ def generate_files(list, args):
|
|||
files_list.append("<file src=" + '"' + windowsai_net50_props + '" target="build\\net5.0" />')
|
||||
files_list.append("<file src=" + '"' + windowsai_net50_targets + '" target="build\\net5.0" />')
|
||||
|
||||
if is_cpu_package or is_cuda_gpu_package or is_dml_package or is_mklml_package or is_snpe_package_win:
|
||||
if is_cpu_package or is_cuda_gpu_package or is_dml_package or is_mklml_package or is_snpe_package:
|
||||
# Process props file
|
||||
source_props = os.path.join(
|
||||
args.sources_path, "csharp", "src", "Microsoft.ML.OnnxRuntime", "targets", "netstandard", "props.xml"
|
||||
|
|
@ -858,25 +843,14 @@ def generate_files(list, args):
|
|||
)
|
||||
os.system(copy_command + " " + source_props + " " + target_props)
|
||||
files_list.append("<file src=" + '"' + target_props + '" target="build\\native" />')
|
||||
if not is_snpe_package_win:
|
||||
if not is_snpe_package:
|
||||
files_list.append("<file src=" + '"' + target_props + '" target="build\\netstandard1.1" />')
|
||||
files_list.append("<file src=" + '"' + target_props + '" target="build\\netstandard2.0" />')
|
||||
|
||||
# Process targets file
|
||||
if is_snpe_package_win:
|
||||
source_targets = os.path.join(
|
||||
args.sources_path,
|
||||
"csharp",
|
||||
"src",
|
||||
"Microsoft.ML.OnnxRuntime",
|
||||
"targets",
|
||||
"netstandard",
|
||||
"targets_snpe.xml",
|
||||
)
|
||||
else:
|
||||
source_targets = os.path.join(
|
||||
args.sources_path, "csharp", "src", "Microsoft.ML.OnnxRuntime", "targets", "netstandard", "targets.xml"
|
||||
)
|
||||
source_targets = os.path.join(
|
||||
args.sources_path, "csharp", "src", "Microsoft.ML.OnnxRuntime", "targets", "netstandard", "targets.xml"
|
||||
)
|
||||
target_targets = os.path.join(
|
||||
args.sources_path,
|
||||
"csharp",
|
||||
|
|
@ -888,7 +862,7 @@ def generate_files(list, args):
|
|||
)
|
||||
os.system(copy_command + " " + source_targets + " " + target_targets)
|
||||
files_list.append("<file src=" + '"' + target_targets + '" target="build\\native" />')
|
||||
if not is_snpe_package_win:
|
||||
if not is_snpe_package:
|
||||
files_list.append("<file src=" + '"' + target_targets + '" target="build\\netstandard1.1" />')
|
||||
files_list.append("<file src=" + '"' + target_targets + '" target="build\\netstandard2.0" />')
|
||||
|
||||
|
|
@ -1023,7 +997,7 @@ def generate_files(list, args):
|
|||
)
|
||||
files_list.append("</files>")
|
||||
|
||||
list += files_list
|
||||
line_list += files_list
|
||||
|
||||
|
||||
def generate_nuspec(args):
|
||||
|
|
|
|||
Loading…
Reference in a new issue