Nuget: splitting PDB files to a separated package (#8903)

This commit is contained in:
Changming Sun 2021-09-01 09:07:24 -07:00 committed by GitHub
parent 00b0a9c127
commit 6299a60bf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 139 additions and 105 deletions

View file

@ -131,7 +131,7 @@ CMake creates a target to this project
</Exec>
<Message Importance="High" Text="Bundling native shared library artifacts into a NuGet package ..." />
<Exec ContinueOnError="False" Command="$(NugetExe) pack NativeNuget.nuspec" ConsoleToMSBuild="true" WorkingDirectory="$(NativeBuildOutputDirAbs)">
<Exec ContinueOnError="False" Command="$(NugetExe) pack -Symbols -SymbolPackageFormat snupkg NativeNuget.nuspec" ConsoleToMSBuild="true" WorkingDirectory="$(NativeBuildOutputDirAbs)">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>

View file

@ -458,16 +458,17 @@ jobs:
arguments: '--configuration RelWithDebInfo -t:CreatePackage -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: BatchScript@1
displayName: 'Bundle Native NuGet and other binaries'
- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
filename: $(Build.SourcesDirectory)\tools\ci_build\github\windows\bundle_dlls_gpu_nuget.bat
workingFolder: $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.snupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts'
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
@ -497,12 +498,6 @@ jobs:
artifactName: 'drop-signed-nuget-GPU'
targetPath: '$(Build.ArtifactStagingDirectory)'
- powershell: |
$counter = 0
Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.nupkg | foreach {7z x -y -o$counter $_.fullname;$counter++}
workingDirectory: '$(Build.ArtifactStagingDirectory)'
displayName: 'Unzip files to sanitize the PE files'
- task: DotNetCoreCLI@2
displayName: 'Build C#'
inputs:
@ -513,10 +508,6 @@ jobs:
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
#TODO: enable binskim
#- task: BinSkim@4
# displayName: 'Run BinSkim'
- task: RoslynAnalyzers@2
displayName: 'Run Roslyn Analyzers'
inputs:

View file

@ -64,9 +64,9 @@ jobs:
workingDirectory: $(Build.SourcesDirectory)
- script: |
set -e -x
set -e -x
mkdir $(Build.ArtifactStagingDirectory)/testdata
cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata
cp $(Build.BinariesDirectory)/Release/libcustom_op_library.so* $(Build.ArtifactStagingDirectory)/testdata
ls -al $(Build.ArtifactStagingDirectory)
displayName: 'Create Artifacts'
@ -114,7 +114,7 @@ jobs:
export ONNX_ML=1
export CMAKE_ARGS="-DONNX_GEN_PB_TYPE_STUBS=OFF -DONNX_WERROR=OFF"
sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py ${{ parameters.AdditionalBuildFlags }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_shared_lib --config Release
displayName: 'Build and Test MacOS'
- template: c-api-artifacts-package-and-publish-steps-posix.yml
@ -126,7 +126,7 @@ jobs:
commitId: $(OnnxRuntimeGitCommitHash)
- script: |
set -e -x
set -e -x
mkdir $(Build.ArtifactStagingDirectory)/testdata
cp $(Build.BinariesDirectory)/Release/libcustom_op_library.dylib $(Build.ArtifactStagingDirectory)/testdata
displayName: 'Create Artifacts'
@ -144,7 +144,6 @@ jobs:
displayName: 'Clean Agent Directories'
condition: always()
- template: win-ci.yml
parameters:
DoCompliance: ${{ parameters.DoCompliance }}
@ -197,6 +196,7 @@ jobs:
runTests: ${{ parameters.RunOnnxRuntimeTests }}
buildJava: false
- job: NuGet_Packaging_CPU
workspace:
clean: all
@ -226,7 +226,7 @@ jobs:
inputs:
artifactName: 'onnxruntime-win-x86'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - NuGet'
inputs:
@ -268,12 +268,10 @@ jobs:
dir
workingDirectory: '$(Build.BinariesDirectory)/nuget-artifact'
displayName: 'List artifacts'
- script: |
mklink /D /J models C:\local\models
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Create models link'
- task: NuGetToolInstaller@0
displayName: Use Nuget 5.7.0
inputs:
@ -311,18 +309,19 @@ jobs:
configuration: RelWithDebInfo
arguments: '--configuration RelWithDebInfo -t:CreatePackage -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: BatchScript@1
displayName: 'Bundle Native NuGet and other binaries'
- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
filename: $(Build.SourcesDirectory)\tools\ci_build\github\windows\bundle_dlls.bat
workingFolder: $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts'
Contents: '*.nupkg'
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.snupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
@ -342,7 +341,7 @@ jobs:
parameters:
NugetPath: '$(Build.ArtifactStagingDirectory)'
NugetPackage: 'Microsoft.ML.OnnxRuntime.*nupkg'
PlatformsSupported: 'win-x64,win-x86,linux-x64,osx-x64'
PlatformsSupported: 'win-x64,win-x86,linux-x64,osx.10.14-x64'
VerifyNugetSigning: false
- task: PublishPipelineArtifact@0
@ -351,11 +350,6 @@ jobs:
artifactName: 'drop-signed-nuget-CPU'
targetPath: '$(Build.ArtifactStagingDirectory)'
- powershell: |
$counter = 0
Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.nupkg | foreach {7z x -y -o$counter $_.fullname;$counter++}
workingDirectory: '$(Build.ArtifactStagingDirectory)'
displayName: 'Unzip files to sanitize the PE files'
- task: DotNetCoreCLI@2
displayName: 'Build C#'
@ -367,9 +361,6 @@ jobs:
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: BinSkim@4
displayName: 'Run BinSkim'
- task: RoslynAnalyzers@2
displayName: 'Run Roslyn Analyzers'
inputs:
@ -386,7 +377,6 @@ jobs:
displayName: 'Clean Agent Directories'
condition: always()
- template: ../nuget/templates/test_win.yml
parameters:
AgentPool : 'Win-CPU-2021'

View file

@ -364,12 +364,10 @@ jobs:
dir
workingDirectory: '$(Build.BinariesDirectory)/nuget-artifact'
displayName: 'List artifacts'
- script: |
mklink /D /J models C:\local\models
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Create models link'
- task: NuGetToolInstaller@0
displayName: Use Nuget 5.7.0
inputs:
@ -407,18 +405,19 @@ jobs:
configuration: RelWithDebInfo
arguments: '--configuration RelWithDebInfo -t:CreatePackage -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: BatchScript@1
displayName: 'Bundle Native NuGet and other binaries'
- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
filename: $(Build.SourcesDirectory)\tools\ci_build\github\windows\bundle_dlls.bat
workingFolder: $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts'
Contents: '*.nupkg'
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.snupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
@ -438,7 +437,7 @@ jobs:
parameters:
NugetPath: '$(Build.ArtifactStagingDirectory)'
NugetPackage: 'Microsoft.ML.OnnxRuntime.*nupkg'
PlatformsSupported: 'win-x64,win-x86,linux-x64,osx-x64'
PlatformsSupported: 'win-x64,win-x86,linux-x64,osx.10.13-x64'
VerifyNugetSigning: false
- task: PublishPipelineArtifact@0
@ -447,11 +446,6 @@ jobs:
artifactName: 'drop-signed-nuget-CPU'
targetPath: '$(Build.ArtifactStagingDirectory)'
- powershell: |
$counter = 0
Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/*.nupkg | foreach {7z x -y -o$counter $_.fullname;$counter++}
workingDirectory: '$(Build.ArtifactStagingDirectory)'
displayName: 'Unzip files to sanitize the PE files'
- task: DotNetCoreCLI@2
displayName: 'Build C#'
@ -463,9 +457,6 @@ jobs:
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: BinSkim@4
displayName: 'Run BinSkim'
- task: RoslynAnalyzers@2
displayName: 'Run Roslyn Analyzers'
inputs:
@ -482,7 +473,6 @@ jobs:
displayName: 'Clean Agent Directories'
condition: always()
- template: ../nuget/templates/test_win.yml
parameters:
AgentPool : 'Win-CPU-2021'

View file

@ -1,28 +0,0 @@
REM Copyright (c) Microsoft Corporation. All rights reserved.
REM Licensed under the MIT License.
REM for available runtime identifiers, see https://github.com/dotnet/corefx/blob/release/3.1/pkg/Microsoft.NETCore.Platforms/runtime.json
set PATH=%CD%;%PATH%
SETLOCAL EnableDelayedExpansion
FOR /R %%i IN (*.nupkg) do (
set filename=%%~ni
IF NOT "!filename:~25,7!"=="Managed" (
mkdir runtimes\win-x86\native
mkdir runtimes\win10-arm\native
mkdir runtimes\win10-arm64\native
mkdir runtimes\linux-x64\native
mkdir runtimes\osx-x64\native
move onnxruntime-win-x86\lib\onnxruntime.dll runtimes\win-x86\native\onnxruntime.dll
move onnxruntime-win-x86\lib\onnxruntime.lib runtimes\win-x86\native\onnxruntime.lib
move onnxruntime-win-x86\lib\onnxruntime.pdb runtimes\win-x86\native\onnxruntime.pdb
move onnxruntime-win-arm64\lib\onnxruntime.dll runtimes\win10-arm64\native\onnxruntime.dll
move onnxruntime-win-arm64\lib\onnxruntime.lib runtimes\win10-arm64\native\onnxruntime.lib
move onnxruntime-win-arm64\lib\onnxruntime.pdb runtimes\win10-arm64\native\onnxruntime.pdb
move onnxruntime-win-arm\lib\onnxruntime.dll runtimes\win10-arm\native\onnxruntime.dll
move onnxruntime-win-arm\lib\onnxruntime.lib runtimes\win10-arm\native\onnxruntime.lib
move onnxruntime-win-arm\lib\onnxruntime.pdb runtimes\win10-arm\native\onnxruntime.pdb
move onnxruntime-linux-x64\lib\libonnxruntime.so.1* runtimes\linux-x64\native\libonnxruntime.so
move onnxruntime-osx-x64\lib\libonnxruntime.*.dylib runtimes\osx-x64\native\libonnxruntime.dylib
7z a %%~ni.nupkg runtimes
)
)

View file

@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This file is used by Zip-Nuget Packaging NoContribOps Pipeline,Zip-Nuget-Java Packaging Pipeline
New-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts -ItemType directory
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\nuget-artifact -Filter *.zip |
@ -30,10 +31,13 @@ New-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\external\protobuf\cma
Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64-*\lib\* -Destination $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo
Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\extra-artifact\protoc.exe $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\external\protobuf\cmake\RelWithDebInfo
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-arm-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-arm
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-arm64-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-arm64
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x86-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x86
$ort_dirs = Get-ChildItem -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-* -Directory
foreach ($ort_dir in $ort_dirs)
{
$dirname = Split-Path -Path $ort_dir -Leaf
$dirname = $dirname.SubString(0,$dirname.LastIndexOf('-'))
Write-Output "Renaming $ort_dir to $dirname"
Rename-Item -Path $ort_dir -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\$dirname
}
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-osx-x64-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-osx-x64

View file

@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This file is used by Zip-Nuget-Java Packaging Pipeline
New-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts -ItemType directory
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\nuget-artifact -Filter *.zip |
@ -30,7 +31,12 @@ New-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\external\protobuf\cma
Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64-cuda-*\lib\* -Destination $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo
Copy-Item -Path $Env:BUILD_BINARIESDIRECTORY\extra-artifact\protoc.exe $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\external\protobuf\cmake\RelWithDebInfo
$ort_dirs = Get-ChildItem -Path $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-* -Directory
foreach ($ort_dir in $ort_dirs)
{
$dirname = Split-Path -Path $ort_dir -Leaf
$dirname = $dirname.SubString(0,$dirname.LastIndexOf('-'))
Write-Output "Renaming $ort_dir to $dirname"
Rename-Item -Path $ort_dir -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\$dirname
}
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts | Where-Object { $_.Name -match 'onnxruntime-linux-x64-cuda-\d{1,}\.\d{1,}\.\d{1,}$' } | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-gpu
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-tensorrt-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-tensorrt
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64-tensorrt-* | Rename-Item -NewName $Env:BUILD_BINARIESDIRECTORY\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-win-x64-tensorrt

View file

@ -4,6 +4,73 @@
import argparse
import sys
import os
import re
from pathlib import Path
# What does the names of our C API tarball/zip files looks like
# os: win, linux, osx
# ep: cuda, tensorrt, None
def get_package_name(os, cpu_arch, ep):
pkg_name = None
if os == 'win':
pkg_name = "onnxruntime-win-"
pkg_name += cpu_arch
if ep == 'cuda':
pkg_name += "-cuda"
elif ep == 'tensorrt':
pkg_name += "-tensorrt"
elif os == 'linux':
pkg_name = "onnxruntime-linux-"
pkg_name += cpu_arch
if ep == 'cuda':
pkg_name += "-cuda"
elif ep == 'tensorrt':
pkg_name += "-tensorrt"
elif os == 'osx':
pkg_name = "onnxruntime-osx-" + cpu_arch
return pkg_name
# Currently we take onnxruntime_providers_cuda from CUDA build
# And onnxruntime, onnxruntime_providers_shared and onnxruntime_providers_tensorrt from tensorrt build
def is_this_file_needed(ep, filename):
return (ep != 'cuda' or 'cuda' in filename) and (ep != 'tensorrt' or 'cuda' not in filename)
# nuget_artifacts_dir: the directory with uncompressed C API tarball/zip files
# ep: cuda, tensorrt, None
# files_list: a list of xml string pieces to append
# This function has no return value. It updates files_list directly
def generate_file_list_for_ep(nuget_artifacts_dir, ep, files_list):
for child in nuget_artifacts_dir.iterdir():
for cpu_arch in ['x86', 'x64', 'arm', 'arm64']:
if child.name == get_package_name('win', cpu_arch, ep):
child = child / 'lib'
for child_file in child.iterdir():
if child_file.suffix in ['.dll', '.pdb', '.lib'] and is_this_file_needed(ep, child_file.name):
files_list.append('<file src="' + str(child_file) +
'" target="runtimes/win-%s/native"/>' % cpu_arch)
for cpu_arch in ['x64', 'arm64']:
if child.name == get_package_name('osx', cpu_arch, ep):
child = child / 'lib'
for child_file in child.iterdir():
# Check if the file has digits like onnxruntime.1.8.0.dylib. We can skip such things
is_versioned_dylib = re.match(r'.*[\.\d+]+\.dylib$', child_file.name)
if child_file.is_file() and child_file.suffix == '.dylib' and not is_versioned_dylib:
files_list.append('<file src="' + str(child_file) +
'" target="runtimes/osx.10.14-%s/native"/>' % cpu_arch)
for cpu_arch in ['x64', 'aarch64']:
if child.name == get_package_name('linux', cpu_arch, ep):
child = child / 'lib'
if cpu_arch == 'x86_64':
cpu_arch = 'x64'
for child_file in child.iterdir():
if not child_file.is_file():
continue
if child_file.suffix == '.so' and is_this_file_needed(ep, child_file.name):
files_list.append('<file src="' + str(child_file) +
'" target="runtimes/linux-%s/native"/>' % cpu_arch)
def parse_arguments():
@ -302,16 +369,30 @@ def generate_files(list, args):
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, interop_pdb) +
'" target="lib\\net5.0\\Microsoft.AI.MachineLearning.Interop.pdb" />')
is_ado_packaging_build = False
# Process runtimes
# Process onnxruntime import lib, dll, and pdb
if is_windows_build:
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.lib') +
runtimes + ' />')
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.dll') +
runtimes + ' />')
if os.path.exists(os.path.join(args.native_build_path, 'onnxruntime.pdb')):
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.pdb') +
nuget_artifacts_dir = Path(args.native_build_path) / 'nuget-artifacts'
if nuget_artifacts_dir.exists():
# Code path for ADO build pipeline, the files under 'nuget-artifacts' are
# downloaded from other build jobs
if is_cuda_gpu_package:
ep_list = ['tensorrt', 'cuda', None]
else:
ep_list = [None]
for ep in ep_list:
generate_file_list_for_ep(nuget_artifacts_dir, ep, files_list)
is_ado_packaging_build = True
else:
# Code path for local dev build
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.lib') +
runtimes + ' />')
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.dll') +
runtimes + ' />')
if os.path.exists(os.path.join(args.native_build_path, 'onnxruntime.pdb')):
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.pdb') +
runtimes + ' />')
else:
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'nuget-staging/usr/local/lib',
'libonnxruntime.so') + '" target="runtimes\\linux-' + args.target_architecture +
@ -335,7 +416,7 @@ def generate_files(list, args):
('lib\\uap10.0' if args.is_store_build else '_native') +
'\\Microsoft.AI.MachineLearning.pdb" />')
# Process execution providers which are built as shared libs
if args.execution_provider == "tensorrt":
if args.execution_provider == "tensorrt" and not is_ado_packaging_build:
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path,
nuget_dependencies['providers_shared_lib']) +
runtimes_target + args.target_architecture + '\\native" />')
@ -362,7 +443,7 @@ def generate_files(list, args):
nuget_dependencies['openvino_ep_shared_lib']) +
runtimes_target + args.target_architecture + '\\native" />')
if args.execution_provider == "cuda" or is_cuda_gpu_package:
if args.execution_provider == "cuda" or is_cuda_gpu_package and not is_ado_packaging_build:
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path,
nuget_dependencies['providers_shared_lib']) +
runtimes_target + args.target_architecture + '\\native" />')